Semantic Web Rule Language (SWRL) Process Modeling Tutorial
Updated: Aug 29
The following is a tutorial for using the Semantic Web Rule Language (SWRL) with the Protege ontology editor. I chose the process modeling domain because I think it is something many people can relate to. Also, it's a simple example that highlights some of the powerful mathematical capabilities that are a result of the set theoretic foundation of OWL and SWRL. At least that was my hope.
Here is the PDF of the tutorial: SWRL Process Modeling Tutorial
The initial ontology to start the tutorial is here: SWRLProcessTutorialStart-V2.owl
The final version of the ontology, with an example waterfall model is here: SWRLProcessTutorialFinal.owl
Thanks to all the people on the Protege user support list for answering my endless stream of questions, special thanks to Martin O'Connor.
If you have questions or comments about the tutorial feel free to email me: firstname.lastname@example.org
Also, the following document has nothing to do with SWRL but it is something I think many new comers to working with Protege and OWL might find useful. OWL (the language underneath Protege) is based on logic and set theory. For those who don't know or are rusty on those concepts here is a PDF that is a good overview of the basics. Don't be misled by the cover page, this is from a book on Mathematical Methods in Linguistics but this is just the first chapter which is a nice overview of logic and set theory: Partee, et. al. Basic Concepts of Set Theory
8/29/2023 Edit: Two updates:
1) If you don't see the appropriate inferences, make sure you have loaded the Pellet reasoner plugin and make sure you do Reasoner>Configure and check all the boxes. By default many of them are not checked because for large ontologies they can make the reasoner slow but for the tutorial and most ontologies created by new users reasoner performance is just fine with all possible inferencing turned on. IMO, it is good to start with that so you can see the full power of the reasoner, then scale it back if and whey you get into medium (thousands of entities) to large (millions of triples) ontologies where performance may become an issue. Thanks to Xiaoqi Zhao for pointing this out.
2) In this tutorial and the revised Pizza tutorial I only mention using the SWRLTab. The SWRLTab is great for many use cases but it only can reference entities by their IRIs. For ontologies such as those in the OBO foundry that have codes for IRIs you need the Rules view. In a recent post, I've created a mini-tutorial on how to setup your own custom Rules Tab for editing SWRL rules with the Rules view. I hope this will be helpful both for those who need to edit rules by their rdfs:label as well as an example of how you can create your own custom tabs with any arbitrary combination of Views you find useful. The new mini-tutorial is at: https://www.michaeldebellis.com/post/creating-a-rules-view-tab