Along with other exciting additions (like property paths and SHACL support), version 5 of RDFox brings with it a web console refresh that will make working with RDFox even easier than before. With the ability to create data stores and import files (data, axioms, rules) straight from the browser, you can get started with RDFox in no time at all. The purpose of this article is to show you exactly how to achieve that.
First, download the latest release of RDFox here, and unpack it into a new directory. We will call this our <working directory>. Place a copy of your license key file in there as well (if you do not have one, you can request an evaluation license here.
Then, in a terminal navigate to your <working directory> and launch the RDFox shell in sandbox mode by typing ./RDFox sandbox (or RDFox.exe sandbox on Windows). Now you should now have access to the RDFox shell, so we can start the HTTP endpoint by running the command endpoint start and RDFox should tell you which port it is listening on — that is where it is also going to serve the console web app. By default it is at: http://localhost:12110/console/.
An RDFox server can contain multiple data stores. All queries and rules are evaluated within the context of one data store only, so they allow us to run multiple applications on the same server.
To create a data store, go to http://localhost:12110/console/ in your browser and click “Create data store”
You will see the following dialogue:
Enter the name “family” and click the “Create data store” button. We do not need to change the advanced settings for now. You should see this message:
Now you can add some data do your data store — click “Import content” to open the content upload dialogue:
For this tutorial we will use the following files:
Download these and either drag them onto the content upload box or use the “Choose file” button to find them on your computer.
Once you confirm that the files have been chosen for upload, just click “Add content” and you should see a report of what content has been added:
You can dismiss this dialogue with the “OK” button.
Once you finish creating a data store and adding content to it, it is time to run some SPARQL queries! Your new data store should already be selected, so replace the default query with
Then you can click “Run query” and you see your results at the bottom of the screen:
Besides displaying query answers in tables, RDFox also offers a visual exploration mode that allows you to present your data in a very user-friendly way.
Click on the graph icon next to :peter in your results to switch to the “Explore” mode and use Peter as our starting point.
You should see a single purple box:
The dot in the upper right corner indicates that there are connections from this node to other data in the store that remain hidden. Right-click on the box to display a context menu of the edges between peter and other nodes:
Tick the boxes next to gender "male" and lois marriedTo, and click “Expand”. You should now be able to see a link between peter and the literal "male" as well as both links between peter and lois.
Notice only one of these two was present in the original data file — the other one was added by our symmetry rule.
The RDFox web console also supports deletion of facts, axioms and rules, and the procedure is very similar to how we add data. First, click the “Menu” button on the header and then select “Delete content”
Now you should see a dialogue for uploading files:
Select symmetry.dlog and when it appears on the list of files chosen for upload, click “Delete content” to remove the rule from the data store.
Now you should see a summary of what was deleted:
Click “OK” to dismiss this dialogue.
Now you can return to query mode by clicking the “Query” button on the header:
Click the “Run query” button to execute our query again. Notice this time we only get one result because we removed the rule that made the :marriedTo relationship symmetric
Finally, let us learn how to delete a data store. Suppose we no longer need the “family” data. You can click the “Menu” button on the header and choose “Delete data store” to remove it:
You should see a confirmation dialogue:
Click “Delete” to permanently delete the data store. After you do that, the “family” data store should be gone and your RDFox server should be empty.