# ----------------------
# 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
_:bng_1 log:implies _:bng_2.

_:bng_1 {
    var:A :oneway var:B.
}

_:bng_2 {
    var:A :path var:B.
}

# path transitive property
_:bng_3 log:implies _:bng_4.

_:bng_3 {
    var:A :path var:B.
    var:B :path var:C.
}

_:bng_4 {
    var:A :path var:C.
 }

# query
_:bng_5 log:impliesAnswer _:bng_5.

_:bng_5 {
    var:A :path :nantes.
}
