-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding forward and backward rule examples
- Loading branch information
Showing
5 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@prefix : <http://example.org/ns#>. | ||
|
||
5 :moreInterestingThan 3 . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
@prefix : <http://example.org/ns#>. | ||
|
||
:Socrates a :Mortal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters