Skip to content

Commit

Permalink
fixing graph:statement
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Oct 13, 2024
1 parent 7ed31c0 commit 6f924e3
Show file tree
Hide file tree
Showing 106 changed files with 120,668 additions and 20,642 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.3
1.6.4
36 changes: 18 additions & 18 deletions cases/ackermann.trig
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@
# where A(4,0) has a value of 2 digits, A(4,1) has a value of 5 digits
# and A(4,2) has a value of 19729 digits.

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

# ackermann(x, y)
_:bng_1 log:isImpliedBy _:bng_2.

GRAPH _:bng_1 {
_:bng_1 {
(var:X var:Y) :ackermann var:A.
}

GRAPH _:bng_2 {
_:bng_2 {
(var:Y 3) math:sum var:B.
(var:X var:B 2) :ackermann var:C.
(var:C 3) math:difference var:A.
Expand All @@ -43,57 +43,57 @@ GRAPH _:bng_2 {
# succ (x=0)
_:bng_3 log:isImpliedBy _:bng_4.

GRAPH _:bng_3 {
_:bng_3 {
(0 var:Y var:Z) :ackermann var:A.
}

GRAPH _:bng_4 {
_:bng_4 {
[] rdf:value true; log:callWithCut true.
(var:Y 1) math:sum var:A.
}

# sum (x=1)
_:bng_5 log:isImpliedBy _:bng_6.

GRAPH _:bng_5 {
_:bng_5 {
(1 var:Y var:Z) :ackermann var:A.
}

GRAPH _:bng_6 {
_:bng_6 {
[] rdf:value true; log:callWithCut true.
(var:Y var:Z) math:sum var:A.
}

# product (x=2)
_:bng_7 log:isImpliedBy _:bng_8.

GRAPH _:bng_7 {
_:bng_7 {
(2 var:Y var:Z) :ackermann var:A.
}

GRAPH _:bng_8 {
_:bng_8 {
[] rdf:value true; log:callWithCut true.
(var:Y var:Z) math:product var:A.
}

# exponentiation (x=3), tetration (x=4), pentation (x=5), hexation (x=6), etc
_:bng_9 log:isImpliedBy _:bng_10.

GRAPH _:bng_9 {
_:bng_9 {
(var:X 0 var:Z) :ackermann 1.
}

GRAPH _:bng_10 {
_:bng_10 {
[] rdf:value true; log:callWithCut true.
}

_:bng_11 log:isImpliedBy _:bng_12.

GRAPH _:bng_11 {
_:bng_11 {
(var:X var:Y var:Z) :ackermann var:A.
}

GRAPH _:bng_12 {
_:bng_12 {
(var:Y 1) math:difference var:B.
(var:X var:B var:Z) :ackermann var:C.
(var:X 1) math:difference var:D.
Expand All @@ -103,7 +103,7 @@ GRAPH _:bng_12 {
# query
_:bng_14 log:query _:bng_14.

GRAPH _:bng_14 {
_:bng_14 {
(0 0) :ackermann var:A0.
(0 6) :ackermann var:A1.
(1 2) :ackermann var:A2.
Expand Down
32 changes: 16 additions & 16 deletions cases/acp.trig
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Access control policy example
# -----------------------------

PREFIX list: <http://www.w3.org/2000/10/swap/list#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX var: <http://www.w3.org/2000/10/swap/var#>
PREFIX : <#>
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <#>.

:test1 :policy :PolicyX;
:has :A, :B, :C.
Expand All @@ -17,73 +17,73 @@ PREFIX : <#>

_:bng_1 log:isImpliedBy _:bng_2.

GRAPH _:bng_1 {
_:bng_1 {
var:Pol :pass :allOfTest.
}

GRAPH _:bng_2 {
_:bng_2 {
var:Test :policy var:Pol.
var:Pol a :Policy.
(_:bng_3 _:bng_4) log:forAllIn var:X.
}

GRAPH _:bng_3 {
_:bng_3 {
var:Pol :allOf var:Field.
}

GRAPH _:bng_4 {
_:bng_4 {
var:Test :has var:Field.
}

_:bng_5 log:isImpliedBy _:bng_6.

GRAPH _:bng_5 {
_:bng_5 {
var:Pol :pass :anyOfTest.
}

GRAPH _:bng_6 {
_:bng_6 {
var:Test :policy var:Pol.
var:Pol a :Policy.
(var:Field _:bng_7 var:List) log:collectAllIn var:X.
var:List list:length var:L.
(var:L) log:notEqualTo (0).
}

GRAPH _:bng_7 {
_:bng_7 {
var:Pol :anyOf var:Field.
var:Test :has var:Field.
}

_:bng_8 log:isImpliedBy _:bng_9.

GRAPH _:bng_8 {
_:bng_8 {
var:Pol :pass :noneOfTest.
}

GRAPH _:bng_9 {
_:bng_9 {
var:Test :policy var:Pol.
var:Pol a :Policy.
(var:Field _:bng_10 var:List) log:collectAllIn var:X.
var:List list:length var:L.
(var:L) log:equalTo (0).
}

GRAPH _:bng_10 {
_:bng_10 {
var:Pol :noneOf var:Field.
var:Test :has var:Field.
}

# query
_:bng_11 log:query _:bng_12.

GRAPH _:bng_11 {
_:bng_11 {
var:Pol a :Policy.
var:Pol :pass :allOfTest.
var:Pol :pass :anyOfTest.
var:Pol :pass :noneOfTest.
}

GRAPH _:bng_12 {
_:bng_12 {
:test :for var:Pol.
:test :is true.
}
20 changes: 10 additions & 10 deletions cases/age.trig
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
#
# Is the age of a person above some duration?

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX time: <http://www.w3.org/2000/10/swap/time#>
PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX var: <http://www.w3.org/2000/10/swap/var#>
PREFIX : <#>
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix time: <http://www.w3.org/2000/10/swap/time#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <#>.

# person data
:patH :birthDay "1944-08-21"^^xsd:date.

# is the age of a person above some duration?
_:bng_1 log:isImpliedBy _:bng_2.

GRAPH _:bng_1 {
_:bng_1 {
var:S :ageAbove var:A.
}

GRAPH _:bng_2 {
_:bng_2 {
var:S :birthDay var:B.
#[] rdf:value ""; time:localTime var:D.
var:D log:equalTo "2024-08-21T00:00:00.0Z"^^xsd:dateTime.
Expand All @@ -33,6 +33,6 @@ GRAPH _:bng_2 {
# query
_:bng_3 log:query _:bng_3.

GRAPH _:bng_3 {
_:bng_3 {
var:S :ageAbove "P80Y"^^xsd:duration.
}
16 changes: 8 additions & 8 deletions cases/backward.trig
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,26 @@
#
# See https://www.w3.org/2000/10/swap/doc/tutorial-1.pdf page 17

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

# something is more interesting if it is greater
_:bng_1 log:isImpliedBy _:bng_2.

GRAPH _:bng_1 {
_:bng_1 {
var:X :moreInterestingThan var:Y.
}

GRAPH _:bng_2 {
_:bng_2 {
var:X math:greaterThan var:Y.
}

# query
_:bng_3 log:query _:bng_3.

GRAPH _:bng_3 {
_:bng_3 {
[] rdf:value 5; :moreInterestingThan 3.
}
8 changes: 4 additions & 4 deletions cases/cobbler.trig
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
# Example from https://shs.hal.science/halshs-04148373/document
# Using functional logic http://intrologic.stanford.edu/chapters/chapter_11.html

PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX var: <http://www.w3.org/2000/10/swap/var#>
PREFIX : <#>
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix : <#>.

# some x is a good cobbler
_:x :is (:good :Cobbler).

# is there some x which is good at some y
_:bng_1 log:query _:bng_1.

GRAPH _:bng_1 {
_:bng_1 {
var:x :is (:good var:y).
}
25 changes: 13 additions & 12 deletions cases/complement.trig
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Negation as envisioned by Wouter Termont
# ----------------------------------------

PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX var: <http://www.w3.org/2000/10/swap/var#>
PREFIX : <#>
@prefix var: <http://www.w3.org/2000/10/swap/var#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <#>.

# Each predicate in RDF represents a binary relation, i.e. a set of 2-tuples.
# For each of those relations you can formulate exactly one complementary
Expand All @@ -13,43 +13,44 @@ PREFIX : <#>
# between these complements by a predicate, e.g. log:complement, then we
# can express the following in pure RDF
#
# GRAPH # NOT {
# NOT {
# _:s1 :p1 _:o1.
# _:s2 :p2 _:o2.
# _:s3 :p3 _:o3.
# }

_:bng_1 log:implies _:bng_2.

GRAPH _:bng_1 {
_:bng_1 {
_:s1 :p1 _:o1.
_:s2 :p2 _:o2.
}

GRAPH _:bng_2 {
_:bng_2 {
:c3 log:complement :p3.
_:s3 :c3 _:o3.
}

_:bng_3 log:implies _:bng_4.

GRAPH _:bng_3 {
_:bng_3 {
_:s2 :p2 _:o2.
_:s3 :p3 _:o3.
}

GRAPH _:bng_4 {
_:bng_4 {
:c1 log:complement :p1.
_:s1 :c1 _:o1.
}

_:bng_5 log:implies _:bng_6.

GRAPH _:bng_5 {
_:bng_5 {
_:s3 :p3 _:o3.
_:s1 :p1 _:o1.
}

GRAPH _:bng_6 {
_:bng_6 {
:c2 log:complement :p2.
_:s2 :c2 _:o2.
}
Expand All @@ -62,7 +63,7 @@ GRAPH _:bng_6 {
# fuse
_:bng_7 log:implies false.

GRAPH _:bng_7 {
_:bng_7 {
var:P log:complement var:C.
var:S var:P var:O.
var:S var:C var:O.
Expand All @@ -71,6 +72,6 @@ GRAPH _:bng_7 {
# query
_:bng_8 log:query _:bng_8.

GRAPH _:bng_8 {
_:bng_8 {
_:bng_7 log:implies false.
}
Loading

0 comments on commit 6f924e3

Please sign in to comment.