Search code examples
ontologyprotegeswrl

Does SWRL Protege Drools engine infer knowledge from owl:equivalentClass?


I am trying to build some SWRL rules with swrlx:makeOwlThing thus using drools in protege.

However, one of my rules depends on individuals whose class is inferred from assertion of owl:equivalentClass. If I run Pellet for example the equivalent class assertion works.

However when I click OWL+SWRL , and Run drools, my rule does not work since the owl:equivalentClass was never asserted. Hence I did an experiment and manually made another SWRL rule that replicates the owl:equivalentClass assertion I made on the protege editor.

Attached is the ontology where I am testing this. Rule S1 is the rule I manually had to add to replicate the two owl:equivalentClass assertions in

###  http://www.semanticweb.org/user/ontologies/2023/11/untitled-ontology-330#ProcessData
:ProcessData rdf:type owl:Class ;
             owl:equivalentClass [ rdf:type owl:Restriction ;
                                   owl:onProperty :isProcessData ;
                                   owl:hasValue "true"^^xsd:boolean
                                 ] .


###  http://www.semanticweb.org/user/ontologies/2023/11/untitled-ontology-330#ProcessDataInput
:ProcessDataInput rdf:type owl:Class ;
                  owl:equivalentClass [ rdf:type owl:Restriction ;
                                        owl:onProperty :hasAE ;
                                        owl:hasValue :Vel
                                      ] ;
                  rdfs:subClassOf :ProcessData .

So I am not sure if something is missing on my side or should I just copy all my owl:equivalentClass as SWRL rules ?

Full ontology in turtle format

https://github.com/vChavezB/swrl_equivalent_stack_ovflow/blob/main/test.ttl


Solution

  • No, you are not missing anything here and the behaviour you witnessed it expected.

    You have 2 options:

    1. Run both an OWL2 reasoner like Pellet and the Drools engine. The reasoner will infer equivalence relations and other inferences and based on those inferences Drools can infer further inferences.

    2. Add additional rules to your SWRL rules to replicate inferences from the OWL reasoner to be able to only run the Drools engine.

    My suggestion will be to give preference to option 1. My motivation is as follows.

    TL;DR: Strictly speaking the algorithms for making inferences using an OWL2 reasoner versus using a rules engine are different algorithms. There is some overlap between inferences made using and OWL2 reasoner and a rules engine. But the is also inferences that an OWL2 reasoner can make that a rules engine cannot make, and the are inferences that rule engine can make that an OWL2 reasoner cannot make. Hence, using them together gives you the best of both worlds.

    Longer explanation

    An OWL2 reasoner can give you way more inferences than what can be derived from a rules engine. The inferences from an OWL2 reasoner depends on the expressivity of your ontology - the more expressive your ontology, the more inferences can be made. Conversely, if your ontology is not very expressive, only a few inferences can be made. For an expressive ontology, you will need to add lots of rules to replicate this. Moreover, some inferences cannot be made using a rules engine. However, if your ontology is not very expressive, it may be possible replicate the axioms of your ontology as rules.

    Why then use a rules engine? The inferences gained from a rules engine is not as rich as that from an ontology, but there are some inferences that cannot be made from a OWL2 reasoner. The main advantage of a rules engine is when dealing with lots of individuals (like in the case of an RDF triple store), its performance is orders of magnitude better than that of an OWL2 reasoner.

    My suggestion for giving preference for option 1 is that you are using Protege, so it is rather unlikely that you are dealing with lots of individuals.