With RDFox v3 came Datalog constraints and SWRL Support. We have asked Professor Bernardo Cuenca Grau, a founder of Oxford Semantic Technologies and Professor at the University of Oxford in the Computer Science department, about SWRL’s origins and the benefits it will bring to RDFox.
Read more about Datalog constraints in our previous article, and don't forget to check out the latest from RDFox v5.6!
“Well I will first tell you a little bit about its history. SWRL comes from an academic paper by [co-founder] Ian Horrocks* and Peter Schneider! The paper was scheduled for just before the first presentation I’ve ever given at a conference in my life, when I was a graduate student. Let’s go back to 2004… The debate at the time was surrounding what was best for the semantic web. Should the semantic web use RDF with ontologies, understood as OWL, or should it use RDF with a rule based knowledge representation language?
Ontology and rules share a common core. You can find information on this in the RDFox docs actually. Many things that you can say with ontologies you can say also with rules. For example, you can say that every student is a person. You can write that in OWL saying a student is a subclass of person. Or you can write this as a rule. There is this common core which is called OWL 2 RL and is a fragment of OWL. But there are also differences. There are things that you can say with rules that you cannot say in OWL and vice versa.
*Ian Horrocks is also a professor at the University of Oxford’s Computer Science department and is well known in the knowledge representation space. He co-founded Oxford Semantic Technologies with Professor Bernardo Cuenca Grau and Professor Boris Motik.
That’s just it. Why can’t I merge these two languages together and have it all? Well, what happens is that reasoning then becomes, what we call, undecidable. This means that you cannot have reasoning — no reasoning algorithm exists. That is a mathematical limit — you can prove mathematically that no such procedure exists. You cannot design a reasoning engine that you can guarantee will always answer correctly and always terminates or finishes within a finite amount of time.
During the debate over whether the semantic web should use OWL or rules for knowledge representation, OWL had the advantage that the W3C was standardising it. So once OWL was standardised, well that’s then the language for representing ontologies on the web and it’s not rules!
What Ian’s paper essentially did, was say if you want to have rules on-top of RDF, then you could design a language like SWRL. Rather than saying don’t use rules, it provided information on how you should do it, if you wanted to. You might not be able to compute all answers to your queries, but you could use OWL together with SWRL. The paper itself proposes SWRL, which was put forward to the W3C as some sort of pre-standard document. It is essentially a format for writing Datalog rules.
So this is what we have implemented in RDFox, a format for writing Datalog rules which was proposed back in 2004 by Ian Horrocks and Peter Schneider. Having it in RDFox makes sense because RDFox is a rule engine.”
“To implement SWRL we had to come up with a new parser that is able to interpret this format. There was nothing that you needed to fundamentally change in the RDFox reasoning engine because the language of RDFox allows you to capture SWRL natively, so the only challenge was being able to parse it. The reasoning algorithms haven’t changed.
SWRL at its core is Datalog. The power of SWRL — the ability to write rules — has been completely implemented in RDFox. But in addition to this, you can use built-in functions. As you can see in the docs, RDFox doesn’t support the whole of SWRL. Now this is because SWRL came with lots of extra functions which are not compatible with SPARQL. We have to think historically, SWRL was created and standardised before SPARQL even existed. So the functions that we support in RDFox now are the ones which are compatible with SPARQL. Should SWRL and SPARQL have been standardised at the same time then they would have just taken the SPARQL functions. However, this doesn’t mean that we can’t implement the SWRL functions, if a client wanted specific SWRL functions, then we could implement them.”
“SWRL never really was an official standard but because there was nothing else, people adopted it, tools started implementing it and people built applications on top of it. The advantage of having SWRL support in RDFox is that is people who have used SWRL in the past can continue using it. If people have an application that relies on SWRL, now they can use RDFox, because we can interpret SWRL.
Also, the rule format of RDFox is proprietary rather than standard, so by having SWRL support you will be able to load your rules in SWRL, modify them and save them in SWRL and not use our proprietary language. It is an extra format that we support which is good for users.
We actually have more powerful rules in RDFox than SWRL supports. So everything that you can say in SWRL, you can do with rules in RDFox—except the built-in functions that we have omitted at the moment—and more! So SWRL users may find using RDFox an opportunity to develop their use of rules beyond SWRL.”
SWRL is a variant of Datalog, with some additional built-ins. If we think historically, later on there were other formats for representing rules, then there came rule interchange formats, etc. In 2004, SWRL was the first semi-official specification for implementing rules with RDF—you could think of SWRL as a legacy.
Get stuck in with SWRL, Datalog, and OWL today for free with RDFox!