Skip to content

Commit

Permalink
Add SPARQL evaluation tests for triple terms and reified triples
Browse files Browse the repository at this point in the history
These tests are derived from the rdf-star SPARQL evaluation tests.
https://github.com/w3c/rdf-star/tree/main/tests/sparql/eval

Closes w3c#140
  • Loading branch information
rubensworks committed Jan 30, 2025
1 parent 3341e16 commit 625f02a
Show file tree
Hide file tree
Showing 86 changed files with 3,252 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

SELECT * {
<<:a :b :c>> ?p ?o
}
45 changes: 45 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-2.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"head": {
"vars": [
"o",
"p"
]
},
"results": {
"bindings": [
{
"o": {
"value": {
"subject": {
"value": "http://example/a",
"type": "uri"
},
"predicate": {
"value": "http://example/b",
"type": "uri"
},
"object": {
"value": "http://example/c",
"type": "uri"
}
},
"type": "triple"
},
"p": {
"value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies",
"type": "uri"
}
},
{
"o": {
"value": "http://example/z",
"type": "uri"
},
"p": {
"value": "http://example/q",
"type": "uri"
}
}
]
}
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-3.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

SELECT * {
<<?s :b :c>> ?p ?o
}
54 changes: 54 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-3.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"head": {
"vars": [
"o",
"p",
"s"
]
},
"results": {
"bindings": [
{
"s": {
"value": "http://example/a",
"type": "uri"
},
"p": {
"value": "http://www.w3.org/1999/02/22-rdf-syntax-ns#reifies",
"type": "uri"
},
"o": {
"value": {
"subject": {
"value": "http://example/a",
"type": "uri"
},
"predicate": {
"value": "http://example/b",
"type": "uri"
},
"object": {
"value": "http://example/c",
"type": "uri"
}
},
"type": "triple"
}
},
{
"s": {
"value": "http://example/a",
"type": "uri"
},
"p": {
"value": "http://example/q",
"type": "uri"
},
"o": {
"value": "http://example/z",
"type": "uri"
}
}
]
}
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-4.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

SELECT * {
<<:a ?p :c>> ?q :z .
}
12 changes: 12 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-4.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ "head": {
"vars": [ "p" , "q" ]
} ,
"results": {
"bindings": [
{
"p": { "type": "uri" , "value": "http://example/b" } ,
"q": { "type": "uri" , "value": "http://example/q" }
}
]
}
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-5.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

SELECT * {
<<:a :b ?o>> ?q :z .
}
12 changes: 12 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-5.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ "head": {
"vars": [ "o" , "q" ]
} ,
"results": {
"bindings": [
{
"o": { "type": "uri" , "value": "http://example/c" } ,
"q": { "type": "uri" , "value": "http://example/q" }
}
]
}
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-6.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

SELECT * {
<<?a ?b :nomatch >> ?q :z .
}
9 changes: 9 additions & 0 deletions sparql/sparql12/eval-triple-terms/basic-6.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{ "head": {
"vars": [ "a" , "b" , "q" ]
} ,
"results": {
"bindings": [

]
}
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-1.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

CONSTRUCT {
<<:a :b :c >> :q :z .
} WHERE { }
3 changes: 3 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-1.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PREFIX : <http://example/>

<< :a :b :c >> :q :z .
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

CONSTRUCT WHERE {
<<:a :b :c >> :q :z .
}
3 changes: 3 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-2.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PREFIX : <http://example/>

<< :a :b :c >> :q :z .
7 changes: 7 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-3.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX : <http://example/>

CONSTRUCT {
<< ?s ?p ?o >> :source :ABC .
} WHERE {
?s ?p ?o .
}
10 changes: 10 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-3.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX : <http://example/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

<< _:reifier2 rdf:reifies <<( :a :b :c )>> >> :source :ABC.

<< _:reifier2 :q :z >> :source :ABC .

<< :a :b :c >> :source :ABC .

<< :s :p :o >> :source :ABC .
7 changes: 7 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-4.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX : <http://example/>

CONSTRUCT {
:a :b ?c {| :source :ABC |} .
} WHERE {
:a :b ?c .
}
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-4.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

:a :b :c .

<< :a :b :c >> :source :ABC .
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-5.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

CONSTRUCT WHERE {
:a :b ?c {| ?q ?z |} .
}
8 changes: 8 additions & 0 deletions sparql/sparql12/eval-triple-terms/construct-5.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PREFIX : <http://example/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>

:a :b :c .

_:reifier1 rdf:reifies <<( :a :b :c )>>.

<< :a :b :c ~ _:reifier2 >> :q :z .
12 changes: 12 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-0-reifiedtriples.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PREFIX : <http://example/>

<<:a :b :c>> :q :z .
:a :q <<:a :b :c>> .

:f :g << <<:x1 :y1 123 >> :p :o >> .

:f :g << :s :p <<:x2 :y3 123 >> >> .

<< :s1 :p1 :o1 >> :q << :s1 :p1 :o1 >> .

:a :b :c {| :q1 :z1 |} .
5 changes: 5 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-0-tripleterms.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example/>

:a :q <<(:a :b :c)>> .

:f :g <<( :s :p <<(:x2 :y3 123 )>> )>> .
3 changes: 3 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-1.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
PREFIX : <http://example/>

<<:a :b :c>> :q :z .
24 changes: 24 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-2.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PREFIX : <http://example/>

:s :p1 :o .
<<:s :p1 :o>> :q :z .

# pattern-3
:a1 :b <<:s :p1 :o ~ :reifier >> .
<<:s :p1 :o ~ :reifier >> :b :a2 .

# pattern-3-nomatch
:a1 :b2 <<:s :p1 :o >> .
<<:s :p1 :o >> :b2 :a2 .

# pattern-5
:s :p2 :o .
<<:s :p2 :o>> :sym <<:s :p2 :o>> .

# pattern-6
<<:s :p2 :o>> :p3 :z .
<< <<:s :p2 :o>> :p3 :z >> :q :o .

# pattern-8
<<:s :p2 :o ~ :reifier2 >> :p4 :z .
<< <<:s :p2 :o ~ :reifier2 >> :p4 :z >> :q :o .
4 changes: 4 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-3.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREFIX : <http://example/>

:a :b :c {| :q :z |} .
:s :p :o .
13 changes: 13 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-4.trig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX : <http://example/>

:s :p :o1 .

GRAPH :g {
<<:s :p :o1 >> :q1 :z1 .
<<:s :p :o2 >> :q2 :z2 .
}

GRAPH :g1 { _:b :r :o3 . _:b :r :o4 . }

GRAPH :g2 { << _:b :r :o3 >> :pb "abc" . }

10 changes: 10 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-5.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX : <http://example/>

<<:s1 :p :o>> :q :z .
<<:s2 :p :o>> :p "same-p" .
<<:s3 :p :o>> : "same-p" .


:z1 :q << :s1 :p :o >> .
:z2 :p << :s2 :p :o >> .

4 changes: 4 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-6.trig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREFIX : <http://example/>

GRAPH :g1 { :s1 :p1 :o1 }
GRAPH :g2 { :s2 :p2 :o2 }
31 changes: 31 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-7.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
PREFIX : <http://example/>

:x1 :left <<( :a :b 123 )>> .
:x1 :right <<( :a :b 123.0 )>> .

:x2 :left <<( :a :b 123 )>> .
:x2 :right <<( :a :b 123 )>> .

:x3 :left <<( :a :q <<( :a :b 123 )>> )>> .
:x3 :right <<( :a :q <<( :a :b 123.0 )>> )>> .

:x4 :left <<( :a :b 123 )>> .
:x4 :right <<( :c :d 123 )>> .

:x5 :left <<( _:bnode1 :b 123 )>> .
:x5 :right <<( _:bnode1 :b 123 )>> .

:x6 :left <<( _:bnode2 :b 123e0 )>> .
:x6 :right <<( _:bnode2 :b 123 )>> .

:x7 :left <<( :a :b 9 )>> .
:x7 :right <<( :a :b 123 )>> .

:x8 :left << :a :b 9 >> .
:x8 :right << :a :b 9 >> .

:x9 :left << :a :b 9 ~ :irireifier >> .
:x9 :right << :a :b 9 ~ :irireifier >> .

:x10 :left << :a :b 9 ~ _:bnodereifier >> .
:x10 :right << :a :b 9 ~ _:bnodereifier >> .
18 changes: 18 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-order-kind.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
PREFIX : <http://example/>

# The different kinds of orderable items.
# (Not in collation order).

:item :p :x .

:item :p <<( :s :p :o )>> .

:item :p "abc" .

:item :p _:b .

## (Lowest) no value assigned to the variable or expression in this solution.
## Blank nodes
## IRIs
## RDF literals
## RDF-star embedded triple terms
22 changes: 22 additions & 0 deletions sparql/sparql12/eval-triple-terms/data-order.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
PREFIX : <http://example.com/>

# Items that can be ordered
# The test query deals with up to 20 items.
# The integer in the subject does not correspond to expected order.

:s-01 :p <<(:s :p 123)>> .
:s-02 :p <<(:s :p -456)>> .

:s-03 :p _:blank-node .

:s-04 :p <<(:s2 :p 900)>> .
:s-05 :p <<(:s1 :p 999)>> .
:s-06 :p <<(:s1 :a 999)>> .

:s-07 :p "string" .

:s-08 :p <<( :s :p <<(:x :y :z)>> )>> .

:s-09 :p <http://host/entity> .


Empty file.
Loading

0 comments on commit 625f02a

Please sign in to comment.