From d1269e034f84a4acc714ba51ee693c0400b99891 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Sat, 7 Dec 2024 14:28:51 +0000 Subject: [PATCH] Tests for language and base direction --- sparql/sparql12/lang-basedir/data-empty.ttl | 0 sparql/sparql12/lang-basedir/data-lang.ttl | 7 ++ sparql/sparql12/lang-basedir/haslang.rq | 6 ++ sparql/sparql12/lang-basedir/haslang.srj | 28 ++++++++ sparql/sparql12/lang-basedir/haslangdir.rq | 6 ++ sparql/sparql12/lang-basedir/haslangdir.srj | 28 ++++++++ sparql/sparql12/lang-basedir/lang.rq | 6 ++ sparql/sparql12/lang-basedir/lang.srj | 27 +++++++ sparql/sparql12/lang-basedir/langdir.rq | 6 ++ sparql/sparql12/lang-basedir/langdir.srj | 27 +++++++ sparql/sparql12/lang-basedir/manifest.ttl | 79 +++++++++++++++++++++ sparql/sparql12/lang-basedir/strlang.rq | 6 ++ sparql/sparql12/lang-basedir/strlangdir.rq | 9 +++ sparql/sparql12/manifest.ttl | 1 + 14 files changed, 236 insertions(+) create mode 100644 sparql/sparql12/lang-basedir/data-empty.ttl create mode 100644 sparql/sparql12/lang-basedir/data-lang.ttl create mode 100644 sparql/sparql12/lang-basedir/haslang.rq create mode 100644 sparql/sparql12/lang-basedir/haslang.srj create mode 100644 sparql/sparql12/lang-basedir/haslangdir.rq create mode 100644 sparql/sparql12/lang-basedir/haslangdir.srj create mode 100644 sparql/sparql12/lang-basedir/lang.rq create mode 100644 sparql/sparql12/lang-basedir/lang.srj create mode 100644 sparql/sparql12/lang-basedir/langdir.rq create mode 100644 sparql/sparql12/lang-basedir/langdir.srj create mode 100644 sparql/sparql12/lang-basedir/manifest.ttl create mode 100644 sparql/sparql12/lang-basedir/strlang.rq create mode 100644 sparql/sparql12/lang-basedir/strlangdir.rq diff --git a/sparql/sparql12/lang-basedir/data-empty.ttl b/sparql/sparql12/lang-basedir/data-empty.ttl new file mode 100644 index 00000000..e69de29b diff --git a/sparql/sparql12/lang-basedir/data-lang.ttl b/sparql/sparql12/lang-basedir/data-lang.ttl new file mode 100644 index 00000000..507e1a7a --- /dev/null +++ b/sparql/sparql12/lang-basedir/data-lang.ttl @@ -0,0 +1,7 @@ +PREFIX : + +:x1 :p "abc"@en . +:x2 :p "abc"@en--ltr . +:x3 :p "تصميم المواقع"@ar--rtl . +:x4 :p 1 . +:x5 :p . diff --git a/sparql/sparql12/lang-basedir/haslang.rq b/sparql/sparql12/lang-basedir/haslang.rq new file mode 100644 index 00000000..694c66ef --- /dev/null +++ b/sparql/sparql12/lang-basedir/haslang.rq @@ -0,0 +1,6 @@ +PREFIX : + +SELECT ?x ?hasLang { + ?x :p ?object . + BIND( hasLANG(?object) AS ?hasLang ) +} ORDER BY ?x diff --git a/sparql/sparql12/lang-basedir/haslang.srj b/sparql/sparql12/lang-basedir/haslang.srj new file mode 100644 index 00000000..dd051aba --- /dev/null +++ b/sparql/sparql12/lang-basedir/haslang.srj @@ -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" } + } + ] + } +} diff --git a/sparql/sparql12/lang-basedir/haslangdir.rq b/sparql/sparql12/lang-basedir/haslangdir.rq new file mode 100644 index 00000000..77dce63d --- /dev/null +++ b/sparql/sparql12/lang-basedir/haslangdir.rq @@ -0,0 +1,6 @@ +PREFIX : + +SELECT ?x ?hasLangDir { + ?x :p ?object . + BIND( hasLANGDIR(?object) AS ?hasLangDir ) +} ORDER BY ?x diff --git a/sparql/sparql12/lang-basedir/haslangdir.srj b/sparql/sparql12/lang-basedir/haslangdir.srj new file mode 100644 index 00000000..fb00dfa5 --- /dev/null +++ b/sparql/sparql12/lang-basedir/haslangdir.srj @@ -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" } + } + ] + } +} diff --git a/sparql/sparql12/lang-basedir/lang.rq b/sparql/sparql12/lang-basedir/lang.rq new file mode 100644 index 00000000..91b55bf7 --- /dev/null +++ b/sparql/sparql12/lang-basedir/lang.rq @@ -0,0 +1,6 @@ +PREFIX : + +SELECT ?x ?lang { + ?x :p ?object . + BIND( LANG(?object) AS ?lang ) +} ORDER BY ?x diff --git a/sparql/sparql12/lang-basedir/lang.srj b/sparql/sparql12/lang-basedir/lang.srj new file mode 100644 index 00000000..3aefab99 --- /dev/null +++ b/sparql/sparql12/lang-basedir/lang.srj @@ -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" } + } + ] + } +} diff --git a/sparql/sparql12/lang-basedir/langdir.rq b/sparql/sparql12/lang-basedir/langdir.rq new file mode 100644 index 00000000..14f7f418 --- /dev/null +++ b/sparql/sparql12/lang-basedir/langdir.rq @@ -0,0 +1,6 @@ +PREFIX : + +SELECT ?x ?langdir { + ?x :p ?object . + BIND( LANGDIR(?object) AS ?langdir ) +} ORDER BY ?x diff --git a/sparql/sparql12/lang-basedir/langdir.srj b/sparql/sparql12/lang-basedir/langdir.srj new file mode 100644 index 00000000..f20c1f0a --- /dev/null +++ b/sparql/sparql12/lang-basedir/langdir.srj @@ -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" } + } + ] + } +} diff --git a/sparql/sparql12/lang-basedir/manifest.ttl b/sparql/sparql12/lang-basedir/manifest.ttl new file mode 100644 index 00000000..b4e71d27 --- /dev/null +++ b/sparql/sparql12/lang-basedir/manifest.ttl @@ -0,0 +1,79 @@ +@prefix rdf: . +@prefix : . +@prefix rdfs: . +@prefix mf: . +@prefix qt: . +@prefix dawgt: . + +: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 ; + qt:data ] ; + mf:result ; + . + +:haslangdir rdf:type mf:QueryEvaluationTest ; + mf:name "hasLANG"; + rdfs:comment "Function hasLANGDIR" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:lang rdf:type mf:QueryEvaluationTest ; + mf:name "LANG"; + rdfs:comment "Function LANG" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:langdir rdf:type mf:QueryEvaluationTest ; + mf:name "LANGDIR"; + rdfs:comment "Function LANGDIR" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:strlang rdf:type mf:QueryEvaluationTest ; + mf:name "STRLANG"; + rdfs:comment "Function STRLANG" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . + +:strlangdir rdf:type mf:QueryEvaluationTest ; + mf:name "STRLANGDIR"; + rdfs:comment "Function STRLANGDIR" ; + dawgt:approval dawgt:Proposed ; + mf:action + [ qt:query ; + qt:data ] ; + mf:result ; + . diff --git a/sparql/sparql12/lang-basedir/strlang.rq b/sparql/sparql12/lang-basedir/strlang.rq new file mode 100644 index 00000000..545c0b0f --- /dev/null +++ b/sparql/sparql12/lang-basedir/strlang.rq @@ -0,0 +1,6 @@ +SELECT + ( STRLANG("abc", "en") AS ?term1 ) + ( STRLANG("abc", "") AS ?term2 ) + ( STRLANG(123, "en") AS ?term3 ) + ( STRLANG( , "en") AS ?term4 ) +WHERE {} diff --git a/sparql/sparql12/lang-basedir/strlangdir.rq b/sparql/sparql12/lang-basedir/strlangdir.rq new file mode 100644 index 00000000..8b3676fc --- /dev/null +++ b/sparql/sparql12/lang-basedir/strlangdir.rq @@ -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(, "en", "ltr") AS ?term7 ) +WHERE {} diff --git a/sparql/sparql12/manifest.ttl b/sparql/sparql12/manifest.ttl index 02f9d1a1..5e9aaea7 100644 --- a/sparql/sparql12/manifest.ttl +++ b/sparql/sparql12/manifest.ttl @@ -35,4 +35,5 @@ trs:manifest rdf:type mf:Manifest ; + ) .