Skip to content

Commit

Permalink
Cover xsd:dateTime equality and ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Dec 21, 2024
1 parent dfeb021 commit 3f483af
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 2 deletions.
14 changes: 14 additions & 0 deletions sparql/sparql10/expr-equals/data-eq-dateTime.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@prefix : <http://example.org/things#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:xi1 :pl "1"^^xsd:integer ; :pr "2008-04-01T00:00:00Z"^^xsd:dateTime .
:xb1 :pl "true"^^xsd:boolean ; :pr "2008-04-01T00:00:00Z"^^xsd:dateTime .
:xs1 :pl "2008-04-01T00:00:00Z" ; :pr "2008-04-01T00:00:00Z"^^xsd:dateTime .

:d1 :pl "2008-04-01T00:00:00Z"^^xsd:dateTime ; :pr "2008-04-01T00:00:00Z"^^xsd:dateTime . # true
:d2 :pl "2002-04-02T12:00:00"^^xsd:dateTime ; :pr "2002-04-02T12:00:00"^^xsd:dateTime . # true
:d3 :pl "2002-04-02T23:00:00-04:00"^^xsd:dateTime ; :pr "2002-04-03T02:00:00-01:00"^^xsd:dateTime . # true
:d4 :pl "2002-04-02T23:00:00"^^xsd:dateTime ; :pr "2002-04-02T23:00:00+06:00"^^xsd:dateTime . # false
:d5 :pl "1999-12-31T24:00:00"^^xsd:dateTime ; :pr "2000-01-01T00:00:00"^^xsd:dateTime . # true
:d6 :pl "2005-04-04T24:00:00"^^xsd:dateTime ; :pr "2005-04-04T00:00:00"^^xsd:dateTime . # false
:d7 :pl "2008-04-01T00:00:00.00Z"^^xsd:dateTime ; :pr "2008-04-01T00:00:00Z"^^xsd:dateTime . # true
11 changes: 9 additions & 2 deletions sparql/sparql10/expr-equals/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
(
:eq-1 :eq-2 :eq-3 :eq-4 :eq-5 :eq-2-1 :eq-2-2
:eq-graph-1 :eq-graph-2 :eq-graph-3 :eq-graph-4 :eq-graph-5
:eq-float :eq-bool
:eq-float :eq-bool :eq-dateTime
).

:eq-1 a mf:QueryEvaluationTest ;
Expand Down Expand Up @@ -157,4 +157,11 @@
qt:data <data-eq-bool.ttl> ] ;
mf:result <result-eq-bool.ttl>
.

:eq-dateTime a mf:QueryEvaluationTest ;
rdfs:comment "= with dateTime" ;
mf:name "Equality with dateTime" ;
mf:action
[ qt:query <query-eq-dateTime.rq> ;
qt:data <data-eq-dateTime.ttl> ] ;
mf:result <result-eq-dateTime.ttl>
.
7 changes: 7 additions & 0 deletions sparql/sparql10/expr-equals/query-eq-dateTime.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX : <http://example.org/things#>
SELECT ?x
WHERE
{ ?x :pr ?vr ; :pl ?vl .
FILTER ( ?vr = ?vl ) .
}
32 changes: 32 additions & 0 deletions sparql/sparql10/expr-equals/result-eq-dateTime.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <http://example.org/things#> .

[] rdf:type rs:ResultSet ;
rs:resultVariable "x" ;
rs:solution
[ rs:binding [ rs:value :d1 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :d2 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :d3 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :d5 ;
rs:variable "x"
]
] ;
rs:solution
[ rs:binding [ rs:value :d7 ;
rs:variable "x"
]
] .
9 changes: 9 additions & 0 deletions sparql/sparql10/expr-ops/data-dateTime.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
@prefix : <http://example.org/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

:tzasc :p1 "2008-10-01T00:00:00Z"^^xsd:dateTime ; :p2 "2008-10-03T00:00:00Z"^^xsd:dateTime .
:tzdesc :p1 "2008-10-03T00:00:00Z"^^xsd:dateTime ; :p2 "2008-10-01T00:00:00Z"^^xsd:dateTime .
:tzeq :p1 "2008-10-01T00:00:00Z"^^xsd:dateTime ; :p2 "2008-10-01T00:00:00Z"^^xsd:dateTime .
:ntzasc :p1 "2008-10-01T00:00:00"^^xsd:dateTime ; :p2 "2008-10-03T00:00:00"^^xsd:dateTime .
:ntzdesc :p1 "2008-10-03T00:00:00"^^xsd:dateTime ; :p2 "2008-10-01T00:00:00"^^xsd:dateTime .
:ntzeq :p1 "2008-10-01T00:00:00"^^xsd:dateTime ; :p2 "2008-10-01T00:00:00"^^xsd:dateTime .
40 changes: 40 additions & 0 deletions sparql/sparql10/expr-ops/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
mf:entries
(
:ge-1 :le-1 :mul-1 :plus-1 :minus-1 :unplus-1 :unminus-1
:dateTime-le-2
:dateTime-ge-2
:dateTime-lt-2
:dateTime-gt-2
).


Expand Down Expand Up @@ -86,3 +90,39 @@
qt:data <data.ttl> ] ;
mf:result <result-le-1.srx>
.

:dateTime-le-2 a mf:QueryEvaluationTest ;
mf:name "DateTime Less-than or equals" ;
rdfs:comment "<= in FILTER expressions" ;
mf:action
[ qt:query <query-le-2.rq> ;
qt:data <data-dateTime.ttl> ] ;
mf:result <result-dateTime-le-2.srx>
.

:dateTime-ge-2 a mf:QueryEvaluationTest ;
mf:name "DateTime Greater-than or equals" ;
rdfs:comment "<= in FILTER expressions" ;
mf:action
[ qt:query <query-ge-2.rq> ;
qt:data <data-dateTime.ttl> ] ;
mf:result <result-dateTime-ge-2.srx>
.

:dateTime-lt-2 a mf:QueryEvaluationTest ;
mf:name "DateTime Less-than" ;
rdfs:comment "< in FILTER expressions" ;
mf:action
[ qt:query <query-lt-2.rq> ;
qt:data <data-dateTime.ttl> ] ;
mf:result <result-dateTime-lt-2.srx>
.

:dateTime-gt-2 a mf:QueryEvaluationTest ;
mf:name "DateTime Greater-than" ;
rdfs:comment "> in FILTER expressions" ;
mf:action
[ qt:query <query-gt-2.rq> ;
qt:data <data-dateTime.ttl> ] ;
mf:result <result-dateTime-gt-2.srx>
.
5 changes: 5 additions & 0 deletions sparql/sparql10/expr-ops/query-ge-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example.org/>
SELECT ?s WHERE {
?s :p1 ?o1 ; :p2 ?o2 .
FILTER(?o1 >= ?o2)
}
5 changes: 5 additions & 0 deletions sparql/sparql10/expr-ops/query-gt-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example.org/>
SELECT ?s WHERE {
?s :p1 ?o1 ; :p2 ?o2 .
FILTER(?o1 > ?o2)
}
5 changes: 5 additions & 0 deletions sparql/sparql10/expr-ops/query-le-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example.org/>
SELECT ?s WHERE {
?s :p1 ?o1 ; :p2 ?o2 .
FILTER(?o1 <= ?o2)
}
5 changes: 5 additions & 0 deletions sparql/sparql10/expr-ops/query-lt-2.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX : <http://example.org/>
SELECT ?s WHERE {
?s :p1 ?o1 ; :p2 ?o2 .
FILTER(?o1 < ?o2)
}
28 changes: 28 additions & 0 deletions sparql/sparql10/expr-ops/result-dateTime-ge-2.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://example.org/ntzeq</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/ntzdesc</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzeq</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzdesc</uri>
</binding>
</result>
</results>
</sparql>
18 changes: 18 additions & 0 deletions sparql/sparql10/expr-ops/result-dateTime-gt-2.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://example.org/ntzdesc</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzdesc</uri>
</binding>
</result>
</results>
</sparql>
28 changes: 28 additions & 0 deletions sparql/sparql10/expr-ops/result-dateTime-le-2.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://example.org/ntzeq</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/ntzasc</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzeq</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzasc</uri>
</binding>
</result>
</results>
</sparql>
18 changes: 18 additions & 0 deletions sparql/sparql10/expr-ops/result-dateTime-lt-2.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
</head>
<results>
<result>
<binding name="s">
<uri>http://example.org/ntzasc</uri>
</binding>
</result>
<result>
<binding name="s">
<uri>http://example.org/tzasc</uri>
</binding>
</result>
</results>
</sparql>

0 comments on commit 3f483af

Please sign in to comment.