From d1269e034f84a4acc714ba51ee693c0400b99891 Mon Sep 17 00:00:00 2001 From: Andy Seaborne Date: Sat, 7 Dec 2024 14:28:51 +0000 Subject: [PATCH 1/2] 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 ; + ) . From 6ee53b486328063d093cfdcce598f19e2a559779 Mon Sep 17 00:00:00 2001 From: afs Date: Sat, 7 Dec 2024 15:57:09 +0000 Subject: [PATCH 2/2] Automated manifest generation --- sparql/sparql12/index.html | 3 + sparql/sparql12/lang-basedir/index.html | 242 ++++++++++++++++++++ sparql/sparql12/lang-basedir/strlang.rq | 2 + sparql/sparql12/lang-basedir/strlang.srj | 11 + sparql/sparql12/lang-basedir/strlangdir.rq | 13 +- sparql/sparql12/lang-basedir/strlangdir.srj | 12 + 6 files changed, 278 insertions(+), 5 deletions(-) create mode 100644 sparql/sparql12/lang-basedir/index.html create mode 100644 sparql/sparql12/lang-basedir/strlang.srj create mode 100644 sparql/sparql12/lang-basedir/strlangdir.srj diff --git a/sparql/sparql12/index.html b/sparql/sparql12/index.html index 27c73c46..09c6784e 100644 --- a/sparql/sparql12/index.html +++ b/sparql/sparql12/index.html @@ -81,6 +81,9 @@

  • grouping/
  • +
  • + lang-basedir/ +
  • syntax-triple-terms-negative/
  • diff --git a/sparql/sparql12/lang-basedir/index.html b/sparql/sparql12/lang-basedir/index.html new file mode 100644 index 00000000..5898914f --- /dev/null +++ b/sparql/sparql12/lang-basedir/index.html @@ -0,0 +1,242 @@ + + + + + + + + + Language and base direction + + + + +

    + + W3C + +

    +

    Language and base direction

    +

    Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.

    +
    +
    +

    Abstract

    +

    +

    +

    This page describes SPARQL 1.2 test suite of the W3C RDF-star Working Group.

    +

    Contributing Tests

    +

    The test manifests and entries are built automatically from manifest.ttl using a Rake task. Tests may be contributed via pull request to https://github.com/w3c/rdf-tests with suitable changes to the manifest.ttl and referenced files.

    +

    Distribution

    +

    Distributed under both the W3C Test Suite License and the W3C 3-clause BSD License. To contribute to a W3C Test Suite, see the policies and contribution forms.

    +

    Disclaimer

    +

    UNDER BOTH MUTUALLY EXCLUSIVE LICENSES, THIS DOCUMENT AND ALL DOCUMENTS, TESTS AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. + COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.

    +
    +
    +

    + Test Descriptions +

    +
    +
    + + haslang: + + hasLANG +
    +
    +
    +

    Function hasLANG

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + haslang.srj +
    +
    +
    +
    + + haslangdir: + + hasLANG +
    +
    +
    +

    Function hasLANGDIR

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + haslangdir.srj +
    +
    +
    +
    + + lang: + + LANG +
    +
    +
    +

    Function LANG

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + lang.srj +
    +
    +
    +
    + + langdir: + + LANGDIR +
    +
    +
    +

    Function LANGDIR

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + langdir.srj +
    +
    +
    +
    + + strlang: + + STRLANG +
    +
    +
    +

    Function STRLANG

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + strlang.srj +
    +
    +
    +
    + + strlangdir: + + STRLANGDIR +
    +
    +
    +

    Function STRLANGDIR

    +
    +
    +
    type
    +
    mf:QueryEvaluationTest
    +
    approval
    +
    +
    action
    +
    +
    +
    +
    +
    result
    +
    + strlangdir.srj +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/sparql/sparql12/lang-basedir/strlang.rq b/sparql/sparql12/lang-basedir/strlang.rq index 545c0b0f..74cc4921 100644 --- a/sparql/sparql12/lang-basedir/strlang.rq +++ b/sparql/sparql12/lang-basedir/strlang.rq @@ -1,3 +1,5 @@ +PREFIX rdf: + SELECT ( STRLANG("abc", "en") AS ?term1 ) ( STRLANG("abc", "") AS ?term2 ) diff --git a/sparql/sparql12/lang-basedir/strlang.srj b/sparql/sparql12/lang-basedir/strlang.srj new file mode 100644 index 00000000..03d3b212 --- /dev/null +++ b/sparql/sparql12/lang-basedir/strlang.srj @@ -0,0 +1,11 @@ +{ "head": { + "vars": [ "term1" , "term2" , "term3" , "term4" ] + } , + "results": { + "bindings": [ + { + "term1": { "type": "literal" , "xml:lang": "en" , "value": "abc" } + } + ] + } +} diff --git a/sparql/sparql12/lang-basedir/strlangdir.rq b/sparql/sparql12/lang-basedir/strlangdir.rq index 8b3676fc..dc82a608 100644 --- a/sparql/sparql12/lang-basedir/strlangdir.rq +++ b/sparql/sparql12/lang-basedir/strlangdir.rq @@ -1,9 +1,12 @@ +PREFIX rdf: + 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 ) + ( STRLANGDIR("abc", "en", "") AS ?term3 ) + ( STRLANGDIR("قطة", "ar", "rtl") AS ?term4 ) + ( STRLANGDIR("abc", "en", "") AS ?term5 ) + ( STRLANGDIR("abc", "", "ltr") AS ?term6 ) + ( STRLANGDIR(123, "", "ltr") AS ?term7 ) + ( STRLANGDIR(, "en", "ltr") AS ?term8 ) WHERE {} diff --git a/sparql/sparql12/lang-basedir/strlangdir.srj b/sparql/sparql12/lang-basedir/strlangdir.srj new file mode 100644 index 00000000..91e5f078 --- /dev/null +++ b/sparql/sparql12/lang-basedir/strlangdir.srj @@ -0,0 +1,12 @@ +{ "head": { + "vars": [ "term1" , "term2" , "term3" , "term4" , "term5" , "term6" , "term7" , "term8" ] + } , + "results": { + "bindings": [ + { + "term1": { "type": "literal" , "xml:lang": "en" , "its:dir": "ltr" , "value": "abc" } , + "term4": { "type": "literal" , "xml:lang": "ar" , "its:dir": "rtl" , "value": "قطة" } + } + ] + } +}