RDFox, the first market ready high-performance in-memory knowledge graph and semantic reasoner. Designed at the University of Oxford for performance and scalability.

High performance knowledge graph and semantic reasoning engine.

Free Trial
Now we can do the impossible.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.
RDFox 10x’ed the others.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.
We went from a 3 day backload of our graph database to it taking 20 minutes.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.
RDFox is allowing us to innovate where previously it wasn’t possible.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.
RDFox has pushed the boundaries of performance.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.
RDFox can do it quicker.”
- Dow Jones
Dow Jones, institutional financial company and user of RDFox.

The next generation of graph database

Drive your applications with data

Drive your applications with data

RDFox Secondary Image.

Bring the intelligence layer closer to your data

Add responsive pattern detection and verification to your applications

Add responsive pattern detection and verification to your applications

Scale your production environment and meet real-time demands

Scale your production environment and meet real-time demands

Reasonable Vehicles
Rule the Road

To get a driving license, humans learn the rules;
so should autonomous vehicles

RDFox for Autonomous Vehicles

White Paper 2020

Use Cases

Complex pattern detection

Complex pattern detection

Triples visualised

Knowledge graph

RDFox Secondary Image Feature

Semantic reasoning

Data integration

Data integration

Read More

Who is the best Formula One driver of all time?

With so many variables in play, this is hardly an easy question to answer. But thankfully, complex questions are our specialty.

Go to f1.rdfox.tech to find the answer.

RDFox Features

The first market-ready knowledge graph designed from the ground up with reasoning in mind.

Efficiently manipulate data.

Fewer lines of code, quicker answers.

Save time by writing queries with rules.

Create data or alerts when patterns are found.

Materialise rules before querying to save time.

View more
RDFox the world's fastest and most powerful market-ready knowledge graph and semantic reasoning engine.
Getting started with RDFox

Getting started with RDFox

This article will show you how to very quickly set up your very own knowledge graph database and semantic reasoning engine. By the end you'll be able to setup RDFox locally, import triples and rules, and run queries. To follow along, request an RDFox license and download the latest release. Once you’ve received your license key, place it in a directory with your RDFox download.

Please note, this article has been updated since the release of RDFox v6.0.

The article consists of the following:

  1. Creating a data store
  2. Importing data
  3. Running queries
  4. Inserting data using SPARQL
  5. Adding rules
  6. Deleting Facts
  7. Stopping and re-starting RDFox
  8. Getting started with the web console
  9. Visualising data in the web console

If you would like a visual aid, you can watch our Getting Started Webinar. The webinar was created for Version 3.0.0, but remains applicable today.

1. Creating a datastore

Open the directory with RDFox and your license key, in the IDE of your choice. Open a new terminal and then launch RDFox by typing one of the following.

Linux or Mac:

./RDFox sandbox

Windows:

RDFox.exe sandbox

This should result in a command prompt, where you can run any of the commands described in Section 15.2 of the documentation.

Data stores hold all facts and rules in RDFox. At present, there is no data store in the directory, so we must create one before we can load any triples. To create a data store we use the dstore command as follows:

dstore create family

N.B. This example uses a family dataset, hence the data store name ‘family’.

Next, to ensure that subsequent shell commands address our new data store, we use the active command to set the family data store active within the shell:

active family

2. Importing data

We are going to load a small RDF graph in Turtle format into the active data store. This can be downloaded from here and saved in the same directory as the RDFox executable and license key.

To import the data into the active datastore we use the following command:

import +p data.ttl

TIP: remember to use the command set output out if you would like the terminal to print results. This command should report the time taken by the import and that 21 data items have been loaded from the file.

3. Running Queries

The primary query language recognized by RDFox is SPARQL. SPARQL queries can be typed or pasted directly into the shell. For more information, read our article SPARQL Basic and RDFox.

Copy and paste the following SPARQL into the shell and hit enter to print all of the triples in the store:

SELECT ?s ?p ?o WHERE { ?s ?p ?o }

You should see a few lines beginning @prefix followed by a blank line and then the original 21 triples (facts) from data.ttl. After the triples, a summary of the number of answers returned and the time taken for the query is printed.

To demonstrate a simple conjunction, print each person’s forename:

SELECT ?p ?n WHERE { ?p rdf:type :Person . ?p :forename ?n }

Note that :brian is not returned as this entity is not of type :Person as required by the first part of the where clause.

4. Inserting Data Using SPARQL

It is also possible to modify the contents of the data store via queries. For example, make the :marriedTo relationship symmetric:

INSERT { ?x :marriedTo ?y } WHERE { ?y :marriedTo ?x }

This adds one new triple to the data store reflecting the fact that Lois is married to Peter, which was derived from the fact that Peter is married to Lois. Running the query from step 3 again should now return 22 triples (use the up arrow key to step back through your command history).

5. Adding Rules

Reasoning is the ability to calculate the logical consequences of applying a set of rules to a set of facts. RDFox uses the Datalog language for expressing rules. For a more detailed explanation, read Datalog Basics and RDFox.

Reasoning is useful because it allows us to enrich a data store. For example, we can add a rule to state that if ?c has a parent ?p then ?p has a child ?c. With this rule, RDFox can then determine all of the :hasChild relationships — including for any new families that we add to the data store later on.

The above rule can be added with the following command:

import ! [?p, :hasChild, ?c] :- [?c, :hasParent, ?p] .

To check that we now have some triples with :hasChild as the predicate, evaluate the following query:

SELECT ?p ?c WHERE { ?p :hasChild ?c }

Four results are returned, all of which have all been added by RDFox by evaluating the rule defined above.

6. Deleting Facts

To prove that the rule really is ‘live’, delete the triple that says :stewie has :lois as a parent and check that the corresponding :hasChild relationship goes away too. Do this with the following SPARQL:

DELETE DATA { :stewie :hasParent :lois }

Now re-run the query from step 2 and note that the answer :lois :hasParent :stewie . no longer appears.

7. Stopping and Re-starting RDFox

Shut down RDFox by typing the quit command. Since RDFox is an in-memory database, and because we started the process using the sandbox command, which disables any form of persistence, the contents of the data store will be dropped when the process exits. While experimenting with RDFox, it may therefore be useful to write the commands to initialize the data store and load data into a script which can be passed to RDFox at startup.

The following script repeats the whole of this tutorial, including starting an endpoint.

dstore create family
active family
import +p data.ttl
set output out
SELECT ?s ?p ?o WHERE { ?s ?p ?o }
SELECT ?p ?n WHERE { ?p rdf:type :Person . ?p :forename ?n }
INSERT { ?x :marriedTo ?y } WHERE { ?y :marriedTo ?x }
import ! [?p, :hasChild, ?c] :- [?c, :hasParent, ?p] .
SELECT ?p ?c WHERE { ?p :hasChild ?c }
DELETE DATA { :stewie :hasParent :lois }

For ease, you can save this script to a new file e.g. <working_directory>/start.txt and then run it when you restart RDFox with the following command.

Linux and Mac:

./RDFox sandbox . start.txt

Windows:

RDFox.exe sandbox . start.txt

To find out more about how scripts can help, read the article on script writing here.

8. Getting started with the web console

RDFox also offers a UI console which provides a user friendly approach to writing and visualising SPARQL queries. To launch the console, RDFox needs to expose a REST API which includes a SPARQL over HTTP endpoint. We can do this from the terminal with the following command:

endpoint start

The terminal will print the port number. In a web browser, navigate to http://localhost:<port>/console, and substitute <port> with the port number printed in the terminal.

For further instructions on how to use the console for querying see the documentation here.

9. Visualising data in the web console

The data explorer provides users with a user friendly method for representing and exploring their data.

To explore the results as a graph, simply click the 'Explore results' button alongside 'run'. This will take the user to the Explore tab, populating the screen with their results. Users can now switch between the SPARQL editor and Explore view by clicking on their respective tabs at the top of the page. The Explore view will be held until 'Explore results' is clicked once again.

For example, the graph representation of the family data store would be the following:

For a more detailed walkthrough, please visit our documentation.

Looking for next steps? You can learn more about RDFox, request a demo, or start a free trial!

Upcoming Events

Metaphacts logo


Smart Solutions for Identifying Compatible Components

A configuration Management Use Case - Powered by metaphactory and RDFox 
Download the Joint White Paper

Download

Investors

Oxford Semantic Technologies is a spin out of the University of Oxford and is backed by leading investors including:

From the blog

High performance knowledge graph and semantic reasoning engine.