You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have written the following code to utilize the SWRLRuleEngine for executing a self-defined rule. When I output the ontology to a file and inspect it in Protege, I notice that only the rule is being recorded in the ontology, not the inferences. In contrast, when I execute the rule through the Protege plugin, the inferred results are correctly displayed.
I am puzzled by this discrepancy and would like to know what might be incorrect with my code.
// Read an OWL ontology using the OWLAPI
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
OWLDataFactory factory = manager.getOWLDataFactory();
String PathName = "src/main/java/org/swrlapi/example/exercise_based_pulmonary_rehabilitation2.0.owl";
File file = new File(PathName);
OWLOntology localEBPRont = manager.loadOntologyFromOntologyDocument(file);
SWRLRuleEngine ruleEngine = SWRLAPIFactory.createSWRLRuleEngine(localEBPRont);
SWRLAPIRule rule = ruleEngine.createSWRLRule("PatientProfile-ChestTightness",
"PatientAssessment(?p) ^ ChestTightness(?e)-> hasPatientProfile(?p, ?e)");
ruleEngine.infer();
File folder = new File("src/main/java/org/swrlapi/example");
File filesave = new File(folder, "inferredResult_saving.owl");
manager.saveOntology(localEBPRont, IRI.create(filesave.toURI()));
The text was updated successfully, but these errors were encountered:
I have written the following code to utilize the SWRLRuleEngine for executing a self-defined rule. When I output the ontology to a file and inspect it in Protege, I notice that only the rule is being recorded in the ontology, not the inferences. In contrast, when I execute the rule through the Protege plugin, the inferred results are correctly displayed.
I am puzzled by this discrepancy and would like to know what might be incorrect with my code.
The text was updated successfully, but these errors were encountered: