A back arrow icon.
RDFox Blog

RDFox and Reasoning

RDFox and Reasoning
Felicity Mulford

What is RDFox?

RDFox is the high-performance in-memory knowledge graph and semantic reasoner developed by Oxford Semantic Technologies. This short article will help you understand the key concepts behind RDFox and when to use them in your applications.

What are Knowledge Graphs?

A knowledge graph is a database used to store data in a graph structure, and RDFox includes a reasoning layer to interpret and manipulate the data—although many don't.

Relational databases store data in structured records whereas graph databases store data points as nodes which are connected with edges if they share some form of relationship.

Data stored in a graph can be accessed with a query that will “hop” along the edges to find the requested nodes.

What is Reasoning?

Reasoning is the process of materialising rules which apply to the data. Materialising a rule means adding new nodes or edges to the graph when it is satisfied. These new nodes and edges match the rule’s “pattern”.

A rule can be as simple as an “If… then…” statement.

For example: “If a city is located in Oxfordshire, then it is located in England”.

With this rule, RDFox will automatically establish a “Located In” edge between Oxford and England.

Materialised edges are useful because they will improve querying results by reducing the number of hops needed to find the correct nodes.

Read our article on the intuitions behind knowledge graphs and reasoning for a more detailed introduction to Knowledge Graphs and Reasoning.

How to Find Patterns with Rules

Rules help identify patterns in your data or verify that they don’t occur. RDFox offers a complete and flexible approach to modelling and materialising simple and complex rules in your data. This section lists some common rule-based patterns.

The Transitive Relation Pattern

Many relations are naturally transitive, but they are rarely explicitly described in data because they can be cumbersome to record.

Rules help materialise transitive relations effortlessly. The following rule enables RDFox to materialise all the actual “located In” relationships:

English: If ?x is located in ?y and ?y is located in ?z then ?x is located in ?z

Datalog: [?x, :locatedIn, ?z] :- [?x, :locatedIn, ?y] , [?y, :locatedIn, ?z] .

The Transitive Closure Pattern

Relations are not always transitive; in which case we might wish to define a different relation that “transitively” closes the relation. This is particularly useful in social networks where we might want to identify recommendations based on a user’s existing network.

For example, in the following network, a rule will suggest Diana follows Bob and that Alice and Diana follow Charlie to “close” the relation. Domain expertise can help influence how these relations are closed to improve the quality of the recommendations.

The Shortcut Pattern

Generating direct connections between indirectly connected objects can help reduce the number of “hops” a query has to do when navigating the graph for answers. Materialising a connection with a rule can be useful for queries you might be running frequently.

For example, creating a “country Of Birth” edge in the first example would help find the country of birth of a person born in Oxford in one hop.

The Query-View Pattern

Some queries can be expressed as a rule, in which case the results can be materialised and stored directly in the graph. This can help accelerate query response times because the results are materialised before the query is actually made.

For example, a query to find nodes that don’t meet a given criteria will search through the nodes and then test if they don’t meet the specified criteria.

However, a rule can automatically filter the nodes which don’t meet the criteria and the query can then be simplified to only search through that pre-filtered subset.

The Type and Attribute Inheritance Pattern

“Is a”, or 'subsumption relationships', can be represented in RDFox using rules. Subsumption rules are useful for identifying non-obvious relationships in your data or assigning certain properties from a class to a newly identified member.

The Cycle Detection Pattern

Rules can help identify cyclic relationships in graphs in particular when they shouldn’t occur.

A cyclic relation can be materialised with one line of Datalog:

English: if ?x :partOf ?x then :partOf is a :cyclic Relation

Datalog: [ :partOf a :cyclicRelation ] :- [ ?x , :partOf, ?x ] .

Simple Calculations

Rules can be used to perform computations over the data in the graph (e.g. unit conversions, missing values).

The Aggregation Pattern

Rules can populate the graph with aggregate values derived from the graph such as sums, counts and averages.

The Mandatory Attribute Pattern

Rules can check for incompleteness in the data and raise a warning whenever expected data is missing.

Looking for more about RDFox? Request a free trial or a demo, or read more about RDFox or where its used!

Take your first steps towards a solution.

Start with a free RDFox demo!

Take your first steps towards a solution.

Get started with RDFox for free!

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 Enterprises (OSE) and Oxford University Innovation (OUI).