# ----------------------
# Traversing graph paths
# ----------------------
#
# Examples of graph based reasoning.

@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <http://example.org/#>.

# French roads
:paris :oneway :orleans.
:paris :oneway :chartres.
:paris :oneway :amiens.
:orleans :oneway :blois.
:orleans :oneway :bourges.
:blois :oneway :tours.
:chartres :oneway :lemans.
:lemans :oneway :angers.
:lemans :oneway :tours.
:angers :oneway :nantes.

# oneway subproperty of path
[ log:graph (
    [ log:triple (var:A :oneway var:B)]
)] log:implies [ log:graph (
    [ log:triple (var:A :path var:B)]
)].

# path transitive property
[ log:graph (
    [ log:triple (var:A :path var:B)]
    [ log:triple (var:B :path var:C)]
)] log:implies [ log:graph (
    [ log:triple (var:A :path var:C)]
)].

# query
[ log:graph (
    [ log:triple (var:A :path :nantes)]
)] log:impliesAnswer [ log:graph (
    [ log:triple (var:A :path :nantes)]
)].
