Skip to content

Commit d1269e0

Browse files
committed
Tests for language and base direction
1 parent dfeb021 commit d1269e0

14 files changed

+236
-0
lines changed

sparql/sparql12/lang-basedir/data-empty.ttl

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
PREFIX : <http://example/>
2+
3+
:x1 :p "abc"@en .
4+
:x2 :p "abc"@en--ltr .
5+
:x3 :p "تصميم المواقع"@ar--rtl .
6+
:x4 :p 1 .
7+
:x5 :p <http://example/> .
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PREFIX : <http://example/>
2+
3+
SELECT ?x ?hasLang {
4+
?x :p ?object .
5+
BIND( hasLANG(?object) AS ?hasLang )
6+
} ORDER BY ?x
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{ "head": {
2+
"vars": [ "x" , "hasLang" ]
3+
} ,
4+
"results": {
5+
"bindings": [
6+
{
7+
"x": { "type": "uri" , "value": "http://example/x1" } ,
8+
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
9+
} ,
10+
{
11+
"x": { "type": "uri" , "value": "http://example/x2" } ,
12+
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
13+
} ,
14+
{
15+
"x": { "type": "uri" , "value": "http://example/x3" } ,
16+
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
17+
} ,
18+
{
19+
"x": { "type": "uri" , "value": "http://example/x4" } ,
20+
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
21+
} ,
22+
{
23+
"x": { "type": "uri" , "value": "http://example/x5" } ,
24+
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
25+
}
26+
]
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PREFIX : <http://example/>
2+
3+
SELECT ?x ?hasLangDir {
4+
?x :p ?object .
5+
BIND( hasLANGDIR(?object) AS ?hasLangDir )
6+
} ORDER BY ?x
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{ "head": {
2+
"vars": [ "x" , "hasLangDir" ]
3+
} ,
4+
"results": {
5+
"bindings": [
6+
{
7+
"x": { "type": "uri" , "value": "http://example/x1" } ,
8+
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
9+
} ,
10+
{
11+
"x": { "type": "uri" , "value": "http://example/x2" } ,
12+
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
13+
} ,
14+
{
15+
"x": { "type": "uri" , "value": "http://example/x3" } ,
16+
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
17+
} ,
18+
{
19+
"x": { "type": "uri" , "value": "http://example/x4" } ,
20+
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
21+
} ,
22+
{
23+
"x": { "type": "uri" , "value": "http://example/x5" } ,
24+
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
25+
}
26+
]
27+
}
28+
}

sparql/sparql12/lang-basedir/lang.rq

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PREFIX : <http://example/>
2+
3+
SELECT ?x ?lang {
4+
?x :p ?object .
5+
BIND( LANG(?object) AS ?lang )
6+
} ORDER BY ?x

sparql/sparql12/lang-basedir/lang.srj

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ "head": {
2+
"vars": [ "x" , "lang" ]
3+
} ,
4+
"results": {
5+
"bindings": [
6+
{
7+
"x": { "type": "uri" , "value": "http://example/x1" } ,
8+
"lang": { "type": "literal" , "value": "en" }
9+
} ,
10+
{
11+
"x": { "type": "uri" , "value": "http://example/x2" } ,
12+
"lang": { "type": "literal" , "value": "en" }
13+
} ,
14+
{
15+
"x": { "type": "uri" , "value": "http://example/x3" } ,
16+
"lang": { "type": "literal" , "value": "ar" }
17+
} ,
18+
{
19+
"x": { "type": "uri" , "value": "http://example/x4" } ,
20+
"lang": { "type": "literal" , "value": "" }
21+
} ,
22+
{
23+
"x": { "type": "uri" , "value": "http://example/x5" }
24+
}
25+
]
26+
}
27+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PREFIX : <http://example/>
2+
3+
SELECT ?x ?langdir {
4+
?x :p ?object .
5+
BIND( LANGDIR(?object) AS ?langdir )
6+
} ORDER BY ?x
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ "head": {
2+
"vars": [ "x" , "langdir" ]
3+
} ,
4+
"results": {
5+
"bindings": [
6+
{
7+
"x": { "type": "uri" , "value": "http://example/x1" } ,
8+
"langdir": { "type": "literal" , "value": "" }
9+
} ,
10+
{
11+
"x": { "type": "uri" , "value": "http://example/x2" } ,
12+
"langdir": { "type": "literal" , "value": "ltr" }
13+
} ,
14+
{
15+
"x": { "type": "uri" , "value": "http://example/x3" } ,
16+
"langdir": { "type": "literal" , "value": "rtl" }
17+
} ,
18+
{
19+
"x": { "type": "uri" , "value": "http://example/x4" } ,
20+
"langdir": { "type": "literal" , "value": "" }
21+
} ,
22+
{
23+
"x": { "type": "uri" , "value": "http://example/x5" }
24+
}
25+
]
26+
}
27+
}
+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2+
@prefix : <https://w3c.github.io/rdf-tests/sparql/sparql12/grouping#> .
3+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
4+
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
5+
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
6+
@prefix dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> .
7+
8+
:manifest rdf:type mf:Manifest ;
9+
rdfs:label "Language and base direction" ;
10+
mf:entries
11+
(
12+
:haslang
13+
:haslangdir
14+
:lang
15+
:langdir
16+
:strlang
17+
:strlangdir
18+
) .
19+
20+
21+
:haslang rdf:type mf:QueryEvaluationTest ;
22+
mf:name "hasLANG";
23+
rdfs:comment "Function hasLANG" ;
24+
dawgt:approval dawgt:Proposed ;
25+
mf:action
26+
[ qt:query <haslang.rq> ;
27+
qt:data <data-lang.ttl> ] ;
28+
mf:result <haslang.srj> ;
29+
.
30+
31+
:haslangdir rdf:type mf:QueryEvaluationTest ;
32+
mf:name "hasLANG";
33+
rdfs:comment "Function hasLANGDIR" ;
34+
dawgt:approval dawgt:Proposed ;
35+
mf:action
36+
[ qt:query <haslangdir.rq> ;
37+
qt:data <data-lang.ttl> ] ;
38+
mf:result <haslangdir.srj> ;
39+
.
40+
41+
:lang rdf:type mf:QueryEvaluationTest ;
42+
mf:name "LANG";
43+
rdfs:comment "Function LANG" ;
44+
dawgt:approval dawgt:Proposed ;
45+
mf:action
46+
[ qt:query <lang.rq> ;
47+
qt:data <data-lang.ttl> ] ;
48+
mf:result <lang.srj> ;
49+
.
50+
51+
:langdir rdf:type mf:QueryEvaluationTest ;
52+
mf:name "LANGDIR";
53+
rdfs:comment "Function LANGDIR" ;
54+
dawgt:approval dawgt:Proposed ;
55+
mf:action
56+
[ qt:query <langdir.rq> ;
57+
qt:data <data-lang.ttl> ] ;
58+
mf:result <langdir.srj> ;
59+
.
60+
61+
:strlang rdf:type mf:QueryEvaluationTest ;
62+
mf:name "STRLANG";
63+
rdfs:comment "Function STRLANG" ;
64+
dawgt:approval dawgt:Proposed ;
65+
mf:action
66+
[ qt:query <strlang.rq> ;
67+
qt:data <data-empty.ttl> ] ;
68+
mf:result <strlang.srj> ;
69+
.
70+
71+
:strlangdir rdf:type mf:QueryEvaluationTest ;
72+
mf:name "STRLANGDIR";
73+
rdfs:comment "Function STRLANGDIR" ;
74+
dawgt:approval dawgt:Proposed ;
75+
mf:action
76+
[ qt:query <strlangdir.rq> ;
77+
qt:data <data-empty.ttl> ] ;
78+
mf:result <strlangdir.srj> ;
79+
.
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SELECT
2+
( STRLANG("abc", "en") AS ?term1 )
3+
( STRLANG("abc", "") AS ?term2 )
4+
( STRLANG(123, "en") AS ?term3 )
5+
( STRLANG(<http:/example/x> , "en") AS ?term4 )
6+
WHERE {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SELECT
2+
( STRLANGDIR("abc", "en", "ltr") AS ?term1 )
3+
( STRLANGDIR("abc", "en", "LTR") AS ?term2 )
4+
( STRLANGDIR("قطة", "ar", "rtl") AS ?term3 )
5+
( STRLANGDIR("abc", "en", "") AS ?term4 )
6+
( STRLANGDIR("abc", "", "ltr") AS ?term5 )
7+
( STRLANGDIR(123, "", "ltr") AS ?term6 )
8+
( STRLANGDIR(<http:/example/x>, "en", "ltr") AS ?term7 )
9+
WHERE {}

sparql/sparql12/manifest.ttl

+1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ trs:manifest rdf:type mf:Manifest ;
3535
<grouping/manifest.ttl>
3636
<syntax-triple-terms-negative/manifest.ttl>
3737
<syntax-triple-terms-positive/manifest.ttl>
38+
<lang-basedir/manifest.ttl>
3839
) .

0 commit comments

Comments
 (0)