top of page
  • Writer's pictureMichael DeBellis

Drools vs. Pellet for SWRL rules

Updated: Nov 8, 2022

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.

  1. 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.

  2. 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.

1,665 views10 comments

10 Comments


Guest
Dec 17, 2023

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!

Like

Guest
Dec 12, 2023

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.

Like
Guest
Dec 12, 2023
Replying to

I would write the "the small checkbox"

Like

Guest
Jan 05, 2023

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 (?)

Like
Guest
Nov 26, 2023
Replying to

The DROOLS reasoner can be used as an API from this project https://github.com/protegeproject/swrlapi-drools-engine

Like

Jamal Ghebli
Jamal Ghebli
Nov 09, 2022

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.

Like
Michael DeBellis
Michael DeBellis
Nov 09, 2022
Replying to

You shouldn't need to bother with jar files. If you just use the normal Protege tool to install a plugin that should work. I walk you through how to install a plugin (in fact the Pellet reasoner plugin) in my Pizza tutorial: https://www.michaeldebellis.com/post/new-protege-pizza-tutorial Check out: Exercise 5: Install and Run the Pellet Reasoner on p. 15 of the tutorial PDF on that page. If you are still having trouble you can contact me directly. My email is in the PDF document on p. 1 (don't want to put it here for fear of getting spam). Hope that helps, let me know if you are still having trouble. If for some reason you need to build Pellet from the source the…

Like

hmat1976
Jan 06, 2021

Thank you Michael, stop using Drools after the first time I used. Because it mess up my ontology by adding the subclass relationships....

Like
Michael DeBellis
Michael DeBellis
Apr 05, 2022
Replying to

It definitely has its uses. For example, if you want to use MakeOWLThing or if you need to optimize performance but for most users I agree it is just confusing and it is much easier to stick to the Pellet reasoner.

Like
bottom of page