# ------------
# Derived rule
# ------------
#
# Proving a derived rule.

@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 a :Cat.
:Minka a :Cat.
:Charly a :Dog.

# rule derivation
[ log:graph (
    [ log:triple (var:x rdf:type :Cat)]
)] log:implies [ log:graph (
    [ log:triple (
        [ log:graph (
            [ log:triple (var:y rdf:type :Dog)]
        )] log:implies [ log:graph (
            [ log:triple (:test :is true)]
        )]
    )]
)].

# query
[ log:graph (
    [ log:triple (:test :is true)]
)] log:impliesAnswer [ log:graph (
    [ log:triple (:test :is true)]
)].
