Hello and welcome to another episode of the RDFox introductory series.
In this episode, we're going to be looking at importing OWL axioms and Datalog rules using the command line. If you haven't already, please do check out our previous videos where we cover the fundamentals of reasoning and some functionality that can be achieved in both Datalog and OWL.
So the first thing we need to do here is have a running version of RDFox. I've already got one up and running with the data loaded from our workshop, so if you're following along there, this is exactly where you'll be, otherwise it could be your own data.
The first thing I want to do though is actually run the command ‘info’, which will give us some information about our running instance. The stats I want to focus on are these two right here, the total number of explicit facts and all facts both explicit and inferred. You can see here that these numbers are the same. That's because we don't yet have any axioms or rules in our system, so we purely have explicit facts. But as we add axioms and rules, this will of course change.
So let's go ahead and import our axioms first. Here on the left, we have an OWL ontology written out in turtle syntax. It's important to note that OWL can be written in several syntaxes, and depending on which syntax you use, functional, for example, will be handled in a slightly different way to what we're doing here, and you can even skip some of the steps that I'm about to go through. Turtle, however, has to be first imported to RDFox as data.
Once we've got our data in, we can then point RDFox at the data that we've added and tell it that these are in fact axioms, they're a bit special, and that we want RDFox to reason over them. Because our axioms, data, and our existing explicit facts are very different, we don't want to mix the two. So for now, I'm going to be adding my axioms to their own name graph that I'm going to call ‘myAxioms’. So let's go ahead and do that first with the ‘import’ command. To add something to a name graph, we have to use a chevron and then give the name of the name graph where we want them to end up. In this case, I'm going to call it ‘myAxioms’ to make things nice and clear. The ‘myAxioms’ name graph doesn't yet exist, so RE Fox will be creating it as I use this ‘import’ command. But this would also work if the ‘myAxioms’ name graph was mentioned in other triples and quads. Then all I need to do is provide the relative file path, which in this case is going to be axioms/axioms.ttl, and we're good to go.
Here, RDFox will tell us that we have imported the 450 facts, but again, at this point they are just explicit facts. They are not yet being treated as axioms. For that we need to use the command ‘importaxioms’ and we will point RDFox at where our axioms are, which as we've just seen is in ‘myAxioms’ named graph. Now if we run this command, RDFox will reason over those axioms and add the inferred results to our graph.
So now if we run the ‘info’ command, we will see that the total number of explicit facts and all known facts are very different. The explicit facts now are approximately 4 and a half million plus the 450 axioms that we added but the total number of all facts that include inferred facts are about 1.3 million more. In this single command with our set of axioms, we have inferred all of these additional facts that have really been added to our data store. Now what's crucial to remember here is this: all of this has been done on a live system, we haven't had to restart, we haven't had to manually trigger an update or anything like that. RDFox has taken care of all of it for us.
So a perfect example of that of where that's so powerful is if we decide we want to in fact remove these inferences and of course the axioms. So to do that, it takes a single command, which is just the reverse of importing it, where we will use ‘importaxioms :myAxioms -’ and RDFox will remove the inferences. So just to make sure that all of that has happened, let's run ‘info’ one more time and we can see now that we are back to our explicit number of facts and the total facts being the same because we have removed all of the inferred facts that we previously just added. So that's our axioms.
Let's have a look at importing a rule, which is even easier than what we just showed because we just use a single command ‘import’ and then the relevant file path, which in this case is rules/r1.dlog. And just like that, these inferences will be made.
So if you'd like to learn anything more about RDFox or the functionality of rules that you can use when we're importing them, please do check out our previous videos where we go into exactly that in detail.
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 Enterprises (OSE) and Oxford University Innovation (OUI).