Skip to content

Commit

Permalink
Tests for language and base direction
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Dec 7, 2024
1 parent dfeb021 commit d1269e0
Show file tree
Hide file tree
Showing 14 changed files with 236 additions and 0 deletions.
Empty file.
7 changes: 7 additions & 0 deletions sparql/sparql12/lang-basedir/data-lang.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PREFIX : <http://example/>

:x1 :p "abc"@en .
:x2 :p "abc"@en--ltr .
:x3 :p "تصميم المواقع"@ar--rtl .
:x4 :p 1 .
:x5 :p <http://example/> .
6 changes: 6 additions & 0 deletions sparql/sparql12/lang-basedir/haslang.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://example/>

SELECT ?x ?hasLang {
?x :p ?object .
BIND( hasLANG(?object) AS ?hasLang )
} ORDER BY ?x
28 changes: 28 additions & 0 deletions sparql/sparql12/lang-basedir/haslang.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ "head": {
"vars": [ "x" , "hasLang" ]
} ,
"results": {
"bindings": [
{
"x": { "type": "uri" , "value": "http://example/x1" } ,
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x2" } ,
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x3" } ,
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x4" } ,
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x5" } ,
"hasLang": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
}
]
}
}
6 changes: 6 additions & 0 deletions sparql/sparql12/lang-basedir/haslangdir.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://example/>

SELECT ?x ?hasLangDir {
?x :p ?object .
BIND( hasLANGDIR(?object) AS ?hasLangDir )
} ORDER BY ?x
28 changes: 28 additions & 0 deletions sparql/sparql12/lang-basedir/haslangdir.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{ "head": {
"vars": [ "x" , "hasLangDir" ]
} ,
"results": {
"bindings": [
{
"x": { "type": "uri" , "value": "http://example/x1" } ,
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x2" } ,
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x3" } ,
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "true" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x4" } ,
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x5" } ,
"hasLangDir": { "type": "literal" , "datatype": "http://www.w3.org/2001/XMLSchema#boolean" , "value": "false" }
}
]
}
}
6 changes: 6 additions & 0 deletions sparql/sparql12/lang-basedir/lang.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://example/>

SELECT ?x ?lang {
?x :p ?object .
BIND( LANG(?object) AS ?lang )
} ORDER BY ?x
27 changes: 27 additions & 0 deletions sparql/sparql12/lang-basedir/lang.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ "head": {
"vars": [ "x" , "lang" ]
} ,
"results": {
"bindings": [
{
"x": { "type": "uri" , "value": "http://example/x1" } ,
"lang": { "type": "literal" , "value": "en" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x2" } ,
"lang": { "type": "literal" , "value": "en" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x3" } ,
"lang": { "type": "literal" , "value": "ar" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x4" } ,
"lang": { "type": "literal" , "value": "" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x5" }
}
]
}
}
6 changes: 6 additions & 0 deletions sparql/sparql12/lang-basedir/langdir.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PREFIX : <http://example/>

SELECT ?x ?langdir {
?x :p ?object .
BIND( LANGDIR(?object) AS ?langdir )
} ORDER BY ?x
27 changes: 27 additions & 0 deletions sparql/sparql12/lang-basedir/langdir.srj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ "head": {
"vars": [ "x" , "langdir" ]
} ,
"results": {
"bindings": [
{
"x": { "type": "uri" , "value": "http://example/x1" } ,
"langdir": { "type": "literal" , "value": "" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x2" } ,
"langdir": { "type": "literal" , "value": "ltr" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x3" } ,
"langdir": { "type": "literal" , "value": "rtl" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x4" } ,
"langdir": { "type": "literal" , "value": "" }
} ,
{
"x": { "type": "uri" , "value": "http://example/x5" }
}
]
}
}
79 changes: 79 additions & 0 deletions sparql/sparql12/lang-basedir/manifest.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix : <https://w3c.github.io/rdf-tests/sparql/sparql12/grouping#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
@prefix dawgt: <http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#> .

:manifest rdf:type mf:Manifest ;
rdfs:label "Language and base direction" ;
mf:entries
(
:haslang
:haslangdir
:lang
:langdir
:strlang
:strlangdir
) .


:haslang rdf:type mf:QueryEvaluationTest ;
mf:name "hasLANG";
rdfs:comment "Function hasLANG" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <haslang.rq> ;
qt:data <data-lang.ttl> ] ;
mf:result <haslang.srj> ;
.

:haslangdir rdf:type mf:QueryEvaluationTest ;
mf:name "hasLANG";
rdfs:comment "Function hasLANGDIR" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <haslangdir.rq> ;
qt:data <data-lang.ttl> ] ;
mf:result <haslangdir.srj> ;
.

:lang rdf:type mf:QueryEvaluationTest ;
mf:name "LANG";
rdfs:comment "Function LANG" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <lang.rq> ;
qt:data <data-lang.ttl> ] ;
mf:result <lang.srj> ;
.

:langdir rdf:type mf:QueryEvaluationTest ;
mf:name "LANGDIR";
rdfs:comment "Function LANGDIR" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <langdir.rq> ;
qt:data <data-lang.ttl> ] ;
mf:result <langdir.srj> ;
.

:strlang rdf:type mf:QueryEvaluationTest ;
mf:name "STRLANG";
rdfs:comment "Function STRLANG" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <strlang.rq> ;
qt:data <data-empty.ttl> ] ;
mf:result <strlang.srj> ;
.

:strlangdir rdf:type mf:QueryEvaluationTest ;
mf:name "STRLANGDIR";
rdfs:comment "Function STRLANGDIR" ;
dawgt:approval dawgt:Proposed ;
mf:action
[ qt:query <strlangdir.rq> ;
qt:data <data-empty.ttl> ] ;
mf:result <strlangdir.srj> ;
.
6 changes: 6 additions & 0 deletions sparql/sparql12/lang-basedir/strlang.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT
( STRLANG("abc", "en") AS ?term1 )
( STRLANG("abc", "") AS ?term2 )
( STRLANG(123, "en") AS ?term3 )
( STRLANG(<http:/example/x> , "en") AS ?term4 )
WHERE {}
9 changes: 9 additions & 0 deletions sparql/sparql12/lang-basedir/strlangdir.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
( STRLANGDIR("abc", "en", "ltr") AS ?term1 )
( STRLANGDIR("abc", "en", "LTR") AS ?term2 )
( STRLANGDIR("قطة", "ar", "rtl") AS ?term3 )
( STRLANGDIR("abc", "en", "") AS ?term4 )
( STRLANGDIR("abc", "", "ltr") AS ?term5 )
( STRLANGDIR(123, "", "ltr") AS ?term6 )
( STRLANGDIR(<http:/example/x>, "en", "ltr") AS ?term7 )
WHERE {}
1 change: 1 addition & 0 deletions sparql/sparql12/manifest.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ trs:manifest rdf:type mf:Manifest ;
<grouping/manifest.ttl>
<syntax-triple-terms-negative/manifest.ttl>
<syntax-triple-terms-positive/manifest.ttl>
<lang-basedir/manifest.ttl>
) .

0 comments on commit d1269e0

Please sign in to comment.