Quantcast

use swrl api and got error:Invalid SWRL atom predicate

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

use swrl api and got error:Invalid SWRL atom predicate

mary
my code is as follows:
public static void myswrl(File file){
                try {
                         OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
                         OWLOntology ontology = ontologyManager.loadOntologyFromOntologyDocument(file);
                         System.out.println(ontology.getClassesInSignature());//list class
                     System.out.println(ontology.getObjectPropertiesInSignature());//list property
                         // Create SQWRL query engine using the SWRLAPI
                         SQWRLQueryEngine queryEngine = SWRLAPIFactory.createSQWRLQueryEngine(ontology);

                         // Create and execute a SQWRL query using the SWRLAPI
                         SQWRLResult result = queryEngine.runSQWRLQuery("q1",
                                         "SecurityRequirement(?s)^hasObject(?s,vold) -> sqwrl:select(?s)");
                         // Process the SQWRL result
                         if (result.next())
                                 System.out.println("Name: " + result.getLiteral("x").getInt());
                         System.out.println("********************End Running the query let's see the result*********************");
                     System.out.println("********** Query result is : "+result.toString());
                         }
                }
The result are as follows:
[<http://hello#Object>,   <http://hello#SecurityRequirement>]
[<http://hello#hasObject>]
Error parsing SWRL rule or SQWRL query: Invalid SWRL atom predicate 'SecurityRequirement'

I got the error and don't know how to deal with it.
I can find Class named SecurityRequirement and Property named hasObject in the result of the code.          


Please help me .Thanks advance.
Loading...