1

although this question may seem duplicate, I think it is not,

In brief:

What to use for SWRL rules with OWL API 5.1.0, where can I find a tutorial or some examples.

Details:

It seems the latest version of SWRL API is 2.0.5 and swrlapi-drools-engine 2.0.5 are not compatible with OWL API 5.1.0.

I have a project that is fully built using OWL API 5.1.0, I want to utilise SWRL as suggested here: SWRLAPI

 // Create a SWRL rule engine using the SWRLAPI
 SWRLRuleEngine swrlRuleEngine = SWRLAPIFactory.createSWRLRuleEngine(ontology);

That code eventually calls this

SWRLAPIOWLOntology swrlapiowlOntology = new DefaultSWRLAPIOWLOntology(ontology, iriResolver);

which calls this

iriResolver.updatePrefixes(this.ontology);

That generates the exception:

Exception: java.lang.NoSuchMethodError. Message: org.semanticweb.owlapi.model.OWLDocumentFormat.isPrefixOWLOntologyFormat()Z

Kindly, What do you suggest?

Thanks in advance for your time, and for Ignazio and Galigator

Sincere regards

user3781976
  • 119
  • 1
  • 11
  • 2
    Do you need drools in the picture, or just SWRL reasoning? Openllet and HermiT both handle SWRL and have versions compatible with owlapi 5 – Ignazio Jul 06 '18 at 18:38
  • Thanks very much, Ignazio, for your comment, I need to create and execute SWRL rules and SQWRL queries (during the execution time), SWRL-API requires SWRLAPI-based rule engine implementation which they provide via a Drools-based SWRL rule engine. I thank you for telling me about Openllet, I am going to learn how to use it tomorrow, I have found this java code test as an example [link](https://github.com/Galigator/openllet/blob/integration/tests/src/test/java/openllet/test/owlapi/OWLAPITests.java) Kindly do you suggest any other tutorial for that purpose? Sincere regards and I am very thankful. – user3781976 Jul 08 '18 at 11:10
  • 1
    If I understood correctly, Openllet handles ontologies that contain SWRL rules and reason with them, but I could not find an example on how to create the SWRL rules from the first place, I assume rules should be created using OWL API? – user3781976 Jul 10 '18 at 16:37
  • Kindly could you please refer me to two kinds of JAVA examples one is about classes and object properties such as Person(?x), hasParent(?x, ?y), hasParent(?x, ?z), hasSpouse(?y, ?z) -> ChildOfMarriedParents(?x) and another one about sum/addition of numbers. r1: has_price(?h, ?p) ^ list_head(?h) -> has_price_sum(?h, ?p) r2: has_price(?x, ?p) ^ has_price_sum(?y, ?s) ^ follows(?x, ?y) ^ swrlb:add(?xs, ?s, ?p) -> has_price_sum(?x, ?xs) – user3781976 Jul 10 '18 at 16:39
  • @user3781976, have you solved this issue? I am getting the same error. What was your solution? – Bruno Pessanha Sep 06 '18 at 10:45
  • @BrunoPessanha Sadly, I could not find examples that I could learn from. Therefore, I have halted my progress about using SWRL rules. kindly, if you manage to find such examples, please do post them as an answer. – user3781976 Sep 18 '18 at 12:58
  • 1
    @user3781976, You are using OWL version 5 which is not compatible with SWRL API apparently. I am now using OWL API 4.2.8 together with SWRLAPI 2.0.5 and Drools Engine 2.0.5. At least the first example you posted here (ChildOfMarriedParents) seems to be correct. – Bruno Pessanha Oct 01 '18 at 09:07

0 Answers0