Search Mailing List Archives


Limit search to: Subject & Body Subject Author
Sort by: Reverse Sort
Limit to: All This Week Last Week This Month Last Month
Select Date Range     through    

[protege-dev] Protege-API 3.5 - Help me please

Naruepon Panawong jnaruepon.p at gmail.com
Thu Feb 20 19:54:45 PST 2014


I use Protege 3.5 for design my ontology and I use protege api (swrl) for
rule engine.

Some code and Question
                String uri ="filename";
OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromURI(uri);
LocalFolderRepository rep = new LocalFolderRepository(new
File("filename"),true);
owlModel.getRepositoryManager().addGlobalRepository(rep);
owlModel.getNamespaceManager().setDefaultNamespace("
http://www.owl-ontologies.com/xxxxxxxx.owl#");
owlModel.getNamespaceManager().setPrefix("sqwrl","
http://sqwrl.stanford.edu/ontologies/built-ins/3.4/sqwrl.owl#");
owlModel.getNamespaceManager().setPrefix("swrl","
http://www.w3.org/2003/11/swrl#");
owlModel.getNamespaceManager().setPrefix("xsp","
http://www.owl-ontologies.com/2005/08/07/xsp.owl#");
owlModel.getNamespaceManager().setPrefix("swrlb","
http://www.w3.org/2003/11/swrlb#");
owlModel.getNamespaceManager().setPrefix("rdf","
http://www.w3.org/1999/02/22-rdf-syntax-ns#");
owlModel.getNamespaceManager().setPrefix("xsd","
http://www.w3.org/2001/XMLSchema#");
owlModel.getNamespaceManager().setPrefix("rdfs","
http://www.w3.org/2000/01/rdf-schema#");
owlModel.getNamespaceManager().setPrefix("owl","
http://www.w3.org/2002/07/owl#");


P3SWRLRuleEngineFactory.registerRuleEngine(JessNames.PluginName, new
JessSWRLRuleEngineCreator());
SWRLRuleEngine ruleEngine =
P3SWRLRuleEngineFactory.create(JessNames.PluginName, owlModel);
                OWLNamedClass aClass = owlModel.getOWLNamedClass("A");
OWLObjectProperty ageProperty = owlModel.getOWLObjectProperty("hasA");
 RDFIndividual individual1 = aClass.createRDFIndividual("Person1");
individual1.setPropertyValue(ageProperty, "Age19-25");
 SWRLFactory factory = new SWRLFactory(owlModel);
factory.enableAll();
 SWRLImp imp = factory.createImp("Q1","rule");
imp.enable();

                ruleEngine.infer();

Q1. Why I use ruleEngine.infer();   // Error, I can't fix it. (Can you send
me for jar file that fix it?)

                ruleEngine.reset();
                ruleEngine.importSWRLRulesAndOWLKnowledge();
                ruleEngine.run();

System.out.println("Infered axioms
size="+ruleEngine.getNumberOfInferredOWLAxioms());
System.out.println("\nInfered axioms ="+ruleEngine.getInferredOWLAxioms());
System.out.println("Infered Individuals
="+ruleEngine.getNumberOfInferredOWLAxioms());
Q2. ruleEngine.infer(); --> Error I change new method, It return all Axioms
(I want return by rule)


Q3. How I resolve Invalid query name Q1
                ruleEngine.runSQWRLQueries();
Result result = ruleEngine.getSQWRLResult("Q1");

Best Regards.
Naruepon.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.stanford.edu/pipermail/protege-dev/attachments/20140221/e06b1746/attachment.html>


More information about the protege-dev mailing list