Back to The Blog

Getting started with the new web console

RDFox 5.0.0

RDFox 5.0.0

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.

Setup

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

Creating a data store

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:

Importing data

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:

data.ttl

@prefix : <https://oxfordsemantic.tech/RDFox/getting-started/> .

:peter :forename "Peter" ;
    a :Person ;
    :marriedTo :lois ;
    :gender "male" .

:lois :forename "Lois" ;
    a :Person ;
    :gender "female" .

:meg :forename "Meg" ;
    a :Person ;
    :hasParent :lois, :peter ;
    :gender "female" .

:chris :forename "Chris" ;
    a :Person ;
    :hasParent :peter ;
    :gender "male" .

:stewie :forename "Stewie" ;
    a :Person ;
    :hasParent :lois ;
    :gender "male" .

:brian :forename "Brian" . # Brian is a dog

symmetry.dlog

@prefix : <https://oxfordsemantic.tech/RDFox/getting-started/> .

[?b, :marriedTo, ?a] :- [?a, :marriedTo, ?b] .

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.

Running SPARQL queries

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

PREFIX : <https://oxfordsemantic.tech/RDFox/getting-started/>
SELECT ?spouse1 ?spouse2
WHERE {
 ?spouse1 :marriedTo ?spouse2
}
ORDER BY ?spouse1

Then you can click “Run query” and you see your results at the bottom of the screen:

Exploring your data store

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.

Deleting data

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

Deleting a data store

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.

...

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.