Back to The Blog

SWRL with Professor Bernardo Cuenca Grau

RDFox and SWRL Support

RDFox and SWRL Support

RDFox and SWRL Support

The latest release of RDFox came with 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.

So Professor, what is SWRL?

“Well I will first tell you a little bit about its history. SWRL comes from an academic paper by 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.

So, what if I want to say everything that I can with OWL plus everything that I can with rules?

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

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

How was SWRL implemented in RDFox?

“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.”

What benefits will SWRL support give to an RDFox user?

“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.”

How does SWRL compare to Datalog?

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.

To try RDFox yourself, click here to request an evaluation license. To find out more about rules in RDFox, read our articles:

...

The Team and Resources

The team behind Oxford Semantic Technologies started working on RDFox in 2011 at the Computer Science Department of the University of Oxford with the conviction that flexible and high-performance reasoning was a possibility for data-intensive applications without jeopardising the correctness of the results. RDFox is the first market-ready knowledge graph designed from the ground up with reasoning in mind. Oxford Semantic Technologies is a spin-out of the University of Oxford and is backed by leading investors including Samsung Venture Investment Corporation (SVIC), Oxford Sciences Innovation (OSI) and Oxford University’s investment arm (OUI). The author is proud to be a member of this team.