One of the most common things that new users of the SWRLTab in Protege do is use the three buttons at the bottom of the window: "OWL + SWRL ->Drools", "Run Drools", and "Drools->OWL" to run their SWRL rules. This post explains the difference between using Drools and using the Pellet reasoner and why using Pellet is usually the better option.
SWRL is meant to be an extension of OWL so the standard way to run SWRL rules is to just run a reasoner that supports the W3C SWRL specification. Unfortunately, most reasoners at this point don't support the specification. The only one that does is the Pellet reasoner which is not the default reasoner for Protege. So to run your rules as part of running the reasoner you need to download the Pellet plugin and then select it as your reasoner in Protege. Once you do this then you can completely ignore those Drools buttons at the bottom. Your rules will run every time you run the reasoner, just as any other inferences about properties or class definitions.
The reason those buttons are there is because Drools can be useful for specific purposes. For more detail on Drools I recommend this paper by Martin O’Connor and Amar Das. However for the average user Pellet is a better choice.
There are two reasons Pellet is usually preferable to Drools.
Because Pellet fires SWRL rules as part of the reasoner, any inference caused by a rule will be highlighted in yellow (just as any other inference). Also, just like any other reasoner inference, it will have a "?" next to it so that the user can click on the "?" and get an explanation of which rule(s) or other axioms caused that inference. These capabilities are lost when one uses Drools. Drools asserts new information into the ontology as axioms which to Protégé look the same as other user defined axioms. Hence the fact that an axiom was inferred by a rule rather than stated by the user is lost as is the ability to understand what specific rules caused the inference.
Drools is a kind of theorem prover and like most such engines it keeps churning away inferences until it can't churn anymore. This can result in a lot of redundant information being added to your ontology. For example, suppose you define a simple class hierarchy where Mammal is a subclass of Animal and Dog is a subclass of Mammal. The reasoner will infer that Dog is a subclass of Animal because the subclass relation is transitive. However, the Protégé UI won't show this information because it is redundant. However, suppose you run your SWRL rules using the Drools buttons. Drools will churn away making every inference it can including that Dog is a subclass of Animal. After running Drools you will have this redundant information added to your ontology because to Protégé it looks as if you have specifically stated that subclass information and Protégé shows all user declared information even if as in this case it is redundant.
For these reasons it is usually best to use Pellet to run your SWRL rules rather than Drools. Drools can be useful for specific purposes that are mostly for more advanced users. For example the experimental builtin makeOWLThing is only supported by Drools. A good rule of thumb is: if you don't know of a good reason to use Drools then stick to Pellet.
Addendum: Another excellent use of DROOLS is that it is used to extend SWRL's time built-ins to implement the Allen model for reasoning about time.
Thanks a lot Michael for an explanation. I am also struggling with another issue in Protégé working in the SWRLTab. Do you know why differentFrom and other built-ins, such as swrlb:notEqual don't work? My rule without built ins provides some results. I tried with Pellet, HermIT and Drools. Thank you!
Hello Michael,
Excellent information.
Is it possible to select just certain rules in SWRL Tabs ? Every time I try to select a single rule with the small case, it triggers all the rules.
Hi Michael, I have some questions regarding MakeOWLThing. Is MakeOWLThing part of the SWRL standard or was this specifically developed for Protege? The only place I see this builtin defined is in http://swrl.stanford.edu/ontologies/built-ins/3.3/swrlx.owl# but not in the SWRL spec website. And about Drools. I intend to run the SWRL Rules (in specific MakeOWLThing) with an SWRL engine in non-interactive mode (i.e., without the Protege GUI). Would you recommend using Drools directly from https://github.com/kiegroup/drools or use https://github.com/protegeproject/swrlapi which is part of the protege project? I am still not sure what the difference could be, as far as I understand Protege uses Drools so it would be better to use the drools engine directly for non-interactive mode (?)
Hello Michael,
Thank you for your explanation, I tried to use Pellet reasoner (com.clarkparsia.protege.plugin.pellet-2.2.0.jar), but unfortunately dose not work with me.
Could you please give me some extra practical explanation.
Thank you Michael, stop using Drools after the first time I used. Because it mess up my ontology by adding the subclass relationships....