Skip to content

Commit

Permalink
adding forward and backward rule examples
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Nov 24, 2023
1 parent dbb3287 commit f21753f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 0 deletions.
27 changes: 27 additions & 0 deletions rdfreasoning/temp/backward.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix rule: <http://eyereasoner.github.io/rule#>.
@prefix : <http://example.org/ns#>.

# see https://www.w3.org/2000/10/swap/doc/tutorial-1.pdf page 17
# something is more interesting if it is greater
[] a rule:BackwardRule;
rule:vars (
_:X
_:Y
);
rule:conclusion (
(_:X :moreInterestingThan _:Y)
);
rule:premise (
(_:X math:greaterThan _:Y)
).

# query
[] a rule:QueryRule;
rule:vars ();
rule:premise (
(5 :moreInterestingThan 3)
);
rule:conclusion (
(5 :moreInterestingThan 3)
).
30 changes: 30 additions & 0 deletions rdfreasoning/temp/forward.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rule: <http://eyereasoner.github.io/rule#>.
@prefix : <http://example.org/ns#>.

# facts
:Socrates a :Human.

# humans are mortal
[] a rule:ForwardRule;
rule:vars (
_:S
);
rule:premise (
(_:S rdf:type :Human)
);
rule:conclusion (
(_:S rdf:type :Mortal)
).

# query
[] a rule:QueryRule;
rule:vars (
_:S
);
rule:premise (
(_:S rdf:type :Mortal)
);
rule:conclusion (
(_:S rdf:type :Mortal)
).
3 changes: 3 additions & 0 deletions rdfreasoning/temp/out/backward.ttl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@prefix : <http://example.org/ns#>.

5 :moreInterestingThan 3 .
3 changes: 3 additions & 0 deletions rdfreasoning/temp/out/forward.ttl.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@prefix : <http://example.org/ns#>.

:Socrates a :Mortal.
2 changes: 2 additions & 0 deletions rdfreasoning/temp/test
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash -x
eye --quiet --nope append.ttl --output out/append.ttl.out
eye --quiet --nope backward.ttl --output out/backward.ttl.out
eye --quiet --nope forward.ttl --output out/forward.ttl.out
eye --quiet --nope lott.ttl --output out/lott.ttl.out
eye --quiet --nope sha512.ttl --output out/sha512.ttl.out
eye --quiet --nope socrates-contradiction.ttl 2> out/socrates-contradiction.ttl.out
Expand Down

0 comments on commit f21753f

Please sign in to comment.