What is backwards chaining?

Backwards Chaining vs Forwards Chaining (aka materialisation)

Backwards chaining (also known as query rewriting) is an approach to semantic reasoning where queries are rewritten based on rules.

Backwards Chaining Advantages
-Can be used in conjunction with virtual graphs
-Does not need to do any upfront computation when ingesting a rule

Materializsation on the other hand is much more efficient, only having to do calculations once (on load, not at query time) and provides performance benefits on the order of 100-1000x.

Backwards chaining example:

Say we have this data:

:alice a :Woman.
:bob a :Man .
:sam a :Person .
:Woman rdfs:SubClassOf :Person .
:Man rdfs:SubClassOf :Person .

Querying for all members of the :Personclass, will look like this:

SELECT ?person
?person a :Person


Now, this pattern will only match Sam, as neither Alice nor Bob directly belong to the :Person class.

So a reasoner that uses backward chaining will rewrite the query to something like this:

SELECT ?person
?person a/rdfs:subClassOf* :Person


Where we use a property path to say that we are interested in paths beginning with a, and having 0 or more instances of rdfs:subClassOf.


If we now add these two triples:

:Charlie a :Boy .
:Boy rdfs:subClassOf :Man .

We will add further depth to our class hierarchy.
But again, rewriting the query will work.

Down arrow icon.