# --------------------------
# Scoped Negation As Failure
# --------------------------

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <http://example.org/#>.

# facts
:Alice :loves :Bob.
:Bob a :Person.

# rule
[ log:graph (
    [ log:triple (var:SCOPE log:notIncludes [ log:graph (
        [ log:triple (:Alice :hates var:X)]
    )])]
    [ log:triple (var:X rdf:type :Person)]
)] log:implies [ log:graph (
    [ log:triple (:Alice :hates :Nobody)]
)].

# query
[ log:graph (
    [ log:triple (var:s :hates var:o)]
)] log:impliesAnswer [ log:graph (
    [ log:triple (var:s :hates var:o)]
)].
