This is an automated email from the ASF dual-hosted git repository. afs pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit 5c4198e13fb2d06758e62550ef70b6bb87a69c15 Author: Andy Seaborne <[email protected]> AuthorDate: Fri May 29 14:38:56 2026 +0100 Align test code to rdf-tests sync --- .../java/org/apache/jena/arq/ARQTestSuite.java | 8 +- .../test/java/org/apache/jena/arq/TestConsts.java | 3 + .../apache/jena/arq/junit/sparql/SparqlTests.java | 8 -- .../jena/riot/Scripts_RIOT_rdf_tests_std.java | 11 ++- .../apache/jena/riot/writer/TestTurtleWriter.java | 23 +++++- .../{Scripts_SPARQL.java => Scripts_ARQ.java} | 30 +------ .../org/apache/jena/sparql/Scripts_RefEngine.java | 27 ++++++- .../org/apache/jena/sparql/Scripts_SPARQL.java | 10 +-- .../function/scripting/TS_FunctionScripting.java | 1 + .../jena/sparql/modify/AbstractTestUpdateBase.java | 4 +- .../jena/sparql/resultset/TestResultSet.java | 3 +- .../apache/jena/sparql/syntax/TestQueryParser.java | 7 +- .../java/org/apache/jena/system/TestReadXML.java | 17 ++-- jena-arq/testing/ARQ/Lateral/lateral-1.arq | 2 +- jena-arq/testing/ARQ/Lateral/lateral-1.srj | 12 +-- jena-arq/testing/ARQ/manifest-arq.ttl | 40 +++++----- jena-arq/testing/ARQ/manifest-ref-arq.ttl | 40 ++++++---- ...codepoint-esc-01.rq => codepoint-esc-01-bad.rq} | 3 +- .../codepoint-escapes/codepoint-esc-02-bad.rq | 5 ++ .../sparql12/codepoint-escapes/codepoint-esc-02.rq | 8 -- .../codepoint-escapes/codepoint-esc-03-bad.rq | 6 ++ .../codepoint-escapes/codepoint-esc-04-bad.rq | 7 ++ .../sparql12/codepoint-escapes/codepoint-esc-04.rq | 5 -- .../sparql12/codepoint-escapes/codepoint-esc-05.rq | 9 ++- .../sparql12/codepoint-escapes/codepoint-esc-06.rq | 12 ++- .../sparql12/codepoint-escapes/codepoint-esc-07.rq | 11 ++- .../sparql12/codepoint-escapes/codepoint-esc-08.rq | 6 -- .../codepoint-escapes/codepoint-esc-bad-03.rq | 5 -- .../sparql/sparql12/codepoint-escapes/manifest.ttl | 92 +++++++++++++++------- .../codepoint-escapes/surrogate-esc-01-bad.rq | 5 ++ .../codepoint-escapes/surrogate-esc-02-bad.rq | 5 ++ .../codepoint-escapes/surrogate-esc-03-bad.rq | 5 ++ .../codepoint-escapes/surrogate-esc-04-bad.rq | 5 ++ .../codepoint-escapes/surrogate-esc-05-bad.rq | 5 ++ 34 files changed, 257 insertions(+), 183 deletions(-) diff --git a/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java b/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java index 36d62b077b..73f7bbfcff 100644 --- a/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java +++ b/jena-arq/src/test/java/org/apache/jena/arq/ARQTestSuite.java @@ -75,6 +75,7 @@ import org.apache.jena.util.TS_UtilsARQ; Scripts_SPARQL.class, Scripts_RefEngine.class, Scripts_SPARQL_Dataset.class, + Scripts_ARQ.class, // Composite datatypes extension Scripts_CDTs.class @@ -83,12 +84,7 @@ import org.apache.jena.util.TS_UtilsARQ; //, org.apache.jena.arq.examples.TC_Examples.class }) public class ARQTestSuite { - static { - JenaSystem.init(); - } - - public static final String testDirARQ = "testing/ARQ"; - public static final String testDirUpdate = "testing/Update"; + static { JenaSystem.init(); } public static final String log4jPropertiesResourceName = "log4j2.properties"; diff --git a/jena-arq/src/test/java/org/apache/jena/arq/TestConsts.java b/jena-arq/src/test/java/org/apache/jena/arq/TestConsts.java index 3ba1ccce44..de9872df4e 100644 --- a/jena-arq/src/test/java/org/apache/jena/arq/TestConsts.java +++ b/jena-arq/src/test/java/org/apache/jena/arq/TestConsts.java @@ -37,6 +37,9 @@ public class TestConsts { public static final String SPARQL11_TESTS_DIR = CG_TESTS_DIR+"sparql/sparql11/"; public static final String SPARQL12_TESTS_DIR = CG_TESTS_DIR+"sparql/sparql12/"; + public static final String testDirARQ = "testing/ARQ/"; + public static final String testDirUpdate = "testing/Update/"; + // Other RIOT tests by manifest public static final String RIOT_TESTS_DIR = "testing/RIOT/Lang/"; } diff --git a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java index 4b724af489..beab6fb7da 100644 --- a/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java +++ b/jena-arq/src/test/java/org/apache/jena/arq/junit/sparql/SparqlTests.java @@ -77,9 +77,6 @@ public class SparqlTests { // ---- Query syntax tests if ( equalsType(testType, TestManifest.PositiveSyntaxTest) ) { - if ( entryContainsSubstring(entry, "codepoint-escapes#codepoint-esc-07") ) - // \U escape outside a string or URI. - return null; return new QuerySyntaxTest(entry, querySyntax, true); } if ( equalsType(testType, TestManifest_11.PositiveSyntaxTest11) ) @@ -90,13 +87,8 @@ public class SparqlTests { return new QuerySyntaxTest(entry, Syntax.syntaxARQ, true); } - //"codepoint-escapes#codepoint-esc-bad-07" - // == Bad if ( equalsType(testType, TestManifest.NegativeSyntaxTest) ) { - if ( entryContainsSubstring(entry, "codepoint-escapes#codepoint-esc-bad-03") ) - // \U escape outside a string or URI. - return null; return new QuerySyntaxTest(entry, querySyntax, false); } if ( equalsType(testType, TestManifest_11.NegativeSyntaxTest11) ) { diff --git a/jena-arq/src/test/java/org/apache/jena/riot/Scripts_RIOT_rdf_tests_std.java b/jena-arq/src/test/java/org/apache/jena/riot/Scripts_RIOT_rdf_tests_std.java index cea736bd95..6c6f43a407 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/Scripts_RIOT_rdf_tests_std.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/Scripts_RIOT_rdf_tests_std.java @@ -35,6 +35,7 @@ import org.apache.jena.arq.junit.Scripts; public class Scripts_RIOT_rdf_tests_std { // Excludes the semantics tests. // Excludes canonicalization tests (separate) + // RDF 1.2 tests include RDF 1.1 tests @Order(1) @TestFactory @@ -68,10 +69,18 @@ public class Scripts_RIOT_rdf_tests_std { @TestFactory @DisplayName("rdf-tests CG - RDF/XML") public Stream<DynamicNode> testFactory_rdf_xml() { - // Caution! RDF 1.1 until RRX updated. + // Caution! RDF 1.1 until RDF/XML tests fixed return Scripts.manifestTestFactory(TestConsts.RDF11_TESTS_DIR+"rdf-xml/manifest.ttl"); } +// @Order(5) +// @TestFactory +// @DisplayName("rdf-tests CG - RDF/XML RDF 1.2") +// public Stream<DynamicNode> testFactory_rdf_xml() { +// return Scripts.manifestTestFactory(TestConsts.RDF12_TESTS_DIR+"manifest.ttl"); +// } + + // Canonicalization tests in Scripts_RIOT_c14n_tests // @Order(10) diff --git a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java index 69004b7963..e82c40a617 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestTurtleWriter.java @@ -113,7 +113,28 @@ public class TestTurtleWriter { @Test public void bnode_cycles() { - Model m = RDFDataMgr.loadModel("testing/DAWG-Final/construct/data-ident.ttl"); + String data = """ + @prefix foaf: <http://xmlns.com/foaf/0.1/> . + @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . + @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . + + _:alice + rdf:type foaf:Person ; + foaf:name "Alice" ; + foaf:mbox <mailto:alice@work> ; + foaf:knows _:bob ; + . + + _:bob + rdf:type foaf:Person ; + foaf:name "Bob" ; + foaf:knows _:alice ; + foaf:mbox <mailto:bob@work> ; + foaf:mbox <mailto:bob@home> ; + . + """; + + Model m = RDFParser.fromString(data, Lang.TTL).toModel(); assertTrue(m.size() > 0); ByteArrayOutputStream output = new ByteArrayOutputStream(); diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java similarity index 64% copy from jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java copy to jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java index a40f741d04..001c34b252 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_ARQ.java @@ -25,13 +25,12 @@ import java.util.stream.Stream; import org.junit.jupiter.api.*; -import org.apache.jena.arq.TestConsts; import org.apache.jena.arq.junit.Scripts; import org.apache.jena.arq.junit.sparql.SparqlTests; import org.apache.jena.sparql.expr.E_Function; import org.apache.jena.sparql.expr.NodeValue; -public class Scripts_SPARQL { +public class Scripts_ARQ { private static boolean bVerboseWarnings; private static boolean bWarnOnUnknownFunction; @@ -52,32 +51,7 @@ public class Scripts_SPARQL { @TestFactory @DisplayName("ARQ-SPARQL") public Stream<DynamicNode> testFactorySPARQL_ARQ() { - return all("testing/ARQ/Syntax/manifest-syntax.ttl", - "testing/ARQ/manifest-arq.ttl", - "testing/ARQ/Serialization/manifest.ttl"); - } - - // Test from rdf-tests (and other replaces). - @TestFactory - @DisplayName("SPARQL 1.0") - public Stream<DynamicNode> testFactorySPARQL_10() { - return all(TestConsts.SPARQL10_TESTS_DIR+"manifest.ttl"); - } - - @TestFactory - @DisplayName("SPARQL 1.1") - public Stream<DynamicNode> testFactorySPARQL_11() { - return all(TestConsts.SPARQL11_TESTS_DIR+"manifest-sparql11-query.ttl", - // Not CSV tests - no comparision supported. - // No XML results - part of SPARQL 1.0. - TestConsts.SPARQL11_TESTS_DIR+"json-res/manifest.ttl", - TestConsts.SPARQL11_TESTS_DIR+"manifest-sparql11-update.ttl"); - } - - @TestFactory - @DisplayName("SPARQL 1.2") - public Stream<DynamicNode> testFactorySPARQL_12() { - return all(TestConsts.SPARQL12_TESTS_DIR+"manifest.ttl"); + return all("testing/ARQ/manifest-arq.ttl"); } private static Stream<DynamicNode> all(String... manifests) { diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java index 712ceaffb4..05a457d02f 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_RefEngine.java @@ -25,12 +25,14 @@ import java.util.stream.Stream; import org.junit.jupiter.api.*; +import org.apache.jena.arq.TestConsts; import org.apache.jena.arq.junit.Scripts; import org.apache.jena.sparql.engine.ref.QueryEngineRef; import org.apache.jena.sparql.expr.E_Function; import org.apache.jena.sparql.expr.NodeValue; public class Scripts_RefEngine { + @BeforeAll public static void beforeClass() { NodeValue.VerboseWarnings = false; @@ -46,8 +48,27 @@ public class Scripts_RefEngine { } @TestFactory - @DisplayName("ARQ-RefEngine") - public Stream<DynamicNode> testFactorySPARQL_ARQ() { - return Scripts.manifestTestFactorySPARQL("testing/ARQ/manifest-ref-arq.ttl"); + @DisplayName("RefEngine - ARQ-SPARQL") + public Stream<DynamicNode> testFactoryRefARQ() { + return Scripts.manifestTestFactorySPARQL(TestConsts.testDirARQ+"manifest-ref-arq.ttl"); + } + + + @TestFactory + @DisplayName("RefEngine - SPARQL 1.0") + public Stream<DynamicNode> testFactoryRefSPARQL10() { + return Scripts.manifestTestFactorySPARQL(TestConsts.SPARQL10_TESTS_DIR+"manifest-evaluation.ttl"); + } + + @TestFactory + @DisplayName("RefEngine - SPARQL 1.1") + public Stream<DynamicNode> testFactoryRefSPARQL11() { + return Scripts.manifestTestFactorySPARQL(TestConsts.SPARQL11_TESTS_DIR+"manifest-sparql11-query.ttl"); + } + + @TestFactory + @DisplayName("RefEngine - SPARQL 1.2") + public Stream<DynamicNode> testFactoryRefSPARQL12() { + return Scripts.manifestTestFactorySPARQL(TestConsts.SPARQL12_TESTS_DIR+"manifest.ttl"); } } diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java index a40f741d04..9d4f0ca66b 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/Scripts_SPARQL.java @@ -49,15 +49,7 @@ public class Scripts_SPARQL { E_Function.WarnOnUnknownFunction = bWarnOnUnknownFunction; } - @TestFactory - @DisplayName("ARQ-SPARQL") - public Stream<DynamicNode> testFactorySPARQL_ARQ() { - return all("testing/ARQ/Syntax/manifest-syntax.ttl", - "testing/ARQ/manifest-arq.ttl", - "testing/ARQ/Serialization/manifest.ttl"); - } - - // Test from rdf-tests (and other replaces). + // Test from rdf-tests @TestFactory @DisplayName("SPARQL 1.0") public Stream<DynamicNode> testFactorySPARQL_10() { diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TS_FunctionScripting.java b/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TS_FunctionScripting.java index 5d231f8faa..02c4a5fd24 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TS_FunctionScripting.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/function/scripting/TS_FunctionScripting.java @@ -35,6 +35,7 @@ import org.apache.jena.sparql.expr.E_Function; Manifest_SPARQL_Scripting.class }) public class TS_FunctionScripting { + static boolean b = false; @BeforeSuite diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java index 615389d463..d245b0dd00 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/modify/AbstractTestUpdateBase.java @@ -21,7 +21,7 @@ package org.apache.jena.sparql.modify; -import org.apache.jena.arq.ARQTestSuite; +import org.apache.jena.arq.TestConsts; import org.apache.jena.graph.Graph; import org.apache.jena.graph.GraphUtil; import org.apache.jena.graph.Node; @@ -50,7 +50,7 @@ public abstract class AbstractTestUpdateBase GraphUtil.addInto(g, data); } - protected static final String FileBase = ARQTestSuite.testDirUpdate; + protected static final String FileBase = TestConsts.testDirUpdate; protected static void script(DatasetGraph gStore, String filename) { UpdateAction.readExecute(FileBase + "/" + filename, gStore); diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TestResultSet.java b/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TestResultSet.java index b763576c4e..405a2c6a33 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TestResultSet.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/resultset/TestResultSet.java @@ -168,8 +168,7 @@ public class TestResultSet { ResultSetFormatter.outputAsJSON(arr, rs1); rs1.reset(); ByteArrayInputStream ins = new ByteArrayInputStream(arr.toByteArray()); - ResultSet rs2 = ResultSetFactory.fromJSON(ins); // Test using the DAWG - // examples + ResultSet rs2 = ResultSetFactory.fromJSON(ins); assertTrue(ResultsCompare.equalsByTerm(rs1, rs2)); } diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/syntax/TestQueryParser.java b/jena-arq/src/test/java/org/apache/jena/sparql/syntax/TestQueryParser.java index dd40139037..383e665491 100644 --- a/jena-arq/src/test/java/org/apache/jena/sparql/syntax/TestQueryParser.java +++ b/jena-arq/src/test/java/org/apache/jena/sparql/syntax/TestQueryParser.java @@ -26,6 +26,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; +import org.apache.jena.atlas.lib.StrUtils; import org.apache.jena.atlas.logging.LogCtl; import org.apache.jena.query.QueryFactory; import org.apache.jena.query.QueryParseException; @@ -75,13 +76,15 @@ public class TestQueryParser { @Test public void syntax_unicode_escaped_surrogate_uri() { QueryParseException ex = assertThrows(QueryParseException.class, ()->testParse("SELECT * { <http://example/\\uD83D> ?p ?o}")); - assertTrue(ex.getMessage().contains("surrogate")); + boolean check = StrUtils.containsIgnoreCase(ex.getMessage(), "surrogate"); + assertTrue(check); } @Test public void syntax_unicode_escaped_surrogate_strings() { QueryParseException ex = assertThrows(QueryParseException.class, ()->testParse("SELECT * { ?s ?p '\\uD83D'}")); - assertTrue(ex.getMessage().contains("surrogate")); + boolean check = StrUtils.containsIgnoreCase(ex.getMessage(), "surrogate"); + assertTrue(check); } @Test diff --git a/jena-arq/src/test/java/org/apache/jena/system/TestReadXML.java b/jena-arq/src/test/java/org/apache/jena/system/TestReadXML.java index b7717fddd1..ac8a89a575 100644 --- a/jena-arq/src/test/java/org/apache/jena/system/TestReadXML.java +++ b/jena-arq/src/test/java/org/apache/jena/system/TestReadXML.java @@ -34,12 +34,17 @@ import org.junit.jupiter.api.Test; import org.apache.jena.query.ResultSetFactory; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; +import org.apache.jena.sys.JenaSystem; import org.apache.jena.util.JenaXMLInput; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; public class TestReadXML { + private static String DIR = "file:testing/xml-input-setup/"; + + static { JenaSystem.init(); } + // SAX @Test public void sax_setup() { try { @@ -58,14 +63,14 @@ public class TestReadXML { @Test public void rdfxml_dtd_http_migration() { // DTD http does not exist, no error because it was ignored Model model = ModelFactory.createDefaultModel(); - model.read("file:testing/xml/rdfxml-dtd-http.rdf"); + model.read(DIR+"rdfxml-dtd-http.rdf"); } // SAX : When allowing DTDs in RDF/XML, and ignoring external ones. @Test public void rdfxml_dtd_file_migration() { // DTD http does not exist, no error because it was ignored Model model = ModelFactory.createDefaultModel(); - model.read("file:testing/xml/rdfxml-dtd-file.rdf"); + model.read(DIR+"rdfxml-dtd-file.rdf"); } // StAX - best available option is ignore DTDs @@ -93,21 +98,21 @@ public class TestReadXML { } @Test public void srx_dtd_http() { - ResultSetFactory.load("file:testing/xml/srx-dtd-http.srx"); + ResultSetFactory.load(DIR+"srx-dtd-http.srx"); } @Test public void srx_dtd_file() { - ResultSetFactory.load("file:testing/xml/srx-dtd-file.srx"); + ResultSetFactory.load(DIR+"srx-dtd-file.srx"); } // TriX uses StAX @Test public void trix_dtd_http() { Model model = ModelFactory.createDefaultModel(); - model.read("file:testing/xml/trix-dtd-http.trix"); + model.read(DIR+"trix-dtd-http.trix"); } @Test public void trix_dtd_file() { Model model = ModelFactory.createDefaultModel(); - model.read("file:testing/xml/trix-dtd-file.trix"); + model.read(DIR+"trix-dtd-file.trix"); } } diff --git a/jena-arq/testing/ARQ/Lateral/lateral-1.arq b/jena-arq/testing/ARQ/Lateral/lateral-1.arq index 0a8a6931a1..9666fd9cc8 100644 --- a/jena-arq/testing/ARQ/Lateral/lateral-1.arq +++ b/jena-arq/testing/ARQ/Lateral/lateral-1.arq @@ -2,5 +2,5 @@ PREFIX : <http://example/> SELECT ?s ?label { ?s :p ?o - LATERAL { SELECT * { ?s :label ?label } LIMIT 2 } + LATERAL { SELECT * { ?s :label ?label } ORDER BY ?s LIMIT 2 } } diff --git a/jena-arq/testing/ARQ/Lateral/lateral-1.srj b/jena-arq/testing/ARQ/Lateral/lateral-1.srj index 5415a7a039..846bb00be4 100644 --- a/jena-arq/testing/ARQ/Lateral/lateral-1.srj +++ b/jena-arq/testing/ARQ/Lateral/lateral-1.srj @@ -5,15 +5,11 @@ "bindings": [ { "s": { "type": "uri" , "value": "http://example/s3" } , - "label": { "type": "literal" , "value": "s3-three" } + "label": { "type": "literal" , "value": "s3-one" } } , { "s": { "type": "uri" , "value": "http://example/s3" } , - "label": { "type": "literal" , "value": "s3-two" } - } , - { - "s": { "type": "uri" , "value": "http://example/s1" } , - "label": { "type": "literal" , "value": "s1-one" } + "label": { "type": "literal" , "value": "s3-three" } } , { "s": { "type": "uri" , "value": "http://example/s2" } , @@ -22,6 +18,10 @@ { "s": { "type": "uri" , "value": "http://example/s2" } , "label": { "type": "literal" , "value": "s2-two" } + } , + { + "s": { "type": "uri" , "value": "http://example/s1" } , + "label": { "type": "literal" , "value": "s1-one" } } ] } diff --git a/jena-arq/testing/ARQ/manifest-arq.ttl b/jena-arq/testing/ARQ/manifest-arq.ttl index 36e9438f75..2821d89521 100644 --- a/jena-arq/testing/ARQ/manifest-arq.ttl +++ b/jena-arq/testing/ARQ/manifest-arq.ttl @@ -1,23 +1,27 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . -@prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> . -@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> . +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> +PREFIX mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> +PREFIX qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> <> rdf:type mf:Manifest ; rdfs:label "ARQ - Scripts" ; @@ -25,7 +29,7 @@ ## ARQ : Features and extensions <Syntax-ARQ/manifest.ttl> <Syntax-Lateral/manifest.ttl> - <Lateral/manifest.ttl> + <Lateral/manifest.ttl> <Serialization/manifest.ttl> <PropertyFunctions/manifest.ttl> diff --git a/jena-arq/testing/ARQ/manifest-ref-arq.ttl b/jena-arq/testing/ARQ/manifest-ref-arq.ttl index dab88292c7..c7448ba1d3 100644 --- a/jena-arq/testing/ARQ/manifest-ref-arq.ttl +++ b/jena-arq/testing/ARQ/manifest-ref-arq.ttl @@ -1,25 +1,31 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at # -# http://www.apache.org/licenses/LICENSE-2.0 +# https://www.apache.org/licenses/LICENSE-2.0 # -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> . -@prefix mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> . -@prefix qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> . +PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> +PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> +PREFIX mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> +PREFIX mfx: <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> +PREFIX qt: <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> <> rdf:type mf:Manifest ; rdfs:label "ARQ - Scripts (Reference Query Engine)" ; mf:include ( + ## The reference query engine may not support ARQ extensions + ## or may support them only partially. ) . \ No newline at end of file diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01-bad.rq similarity index 99% rename from jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01.rq rename to jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01-bad.rq index 514546ebb8..6a77119960 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-01-bad.rq @@ -1,3 +1,2 @@ -\u0041\u0053\u004B\u0020\u007B\u007D - # The query `ASK {}` entirely encoded using codepoint escapes. +\u0041\u0053\u004B\u0020\u007B\u007D diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02-bad.rq new file mode 100644 index 0000000000..6da7c5e87e --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02-bad.rq @@ -0,0 +1,5 @@ +# Codepoint escape in prefixed name : PNAME_NS + +SELECT * { + ?x n\0073:abc ?o +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02.rq deleted file mode 100644 index 8343b436e7..0000000000 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-02.rq +++ /dev/null @@ -1,8 +0,0 @@ -PREFIX ns: <http://example.org/> -SELECT * WHERE { - ?s ?p ns:id\u005c=123 -} - -# the escape here produces '\' REVERSE SOLIDUS (U+5C) -# its unescaping must lead to a Prefixed Name ns:id\=123 using an escaped -# equals sign (U+3D), representing the IRI <http://example.org/id=123>. diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-03-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-03-bad.rq new file mode 100644 index 0000000000..c9a20ba681 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-03-bad.rq @@ -0,0 +1,6 @@ +# Codepoint escape in prefixed name : PN_LOCAL +PREFIX ns: <http://example/ns#> + +SELECT * { + ?x ns:a\u0062c ?o +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04-bad.rq new file mode 100644 index 0000000000..982b5d1703 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04-bad.rq @@ -0,0 +1,7 @@ +# Codepoint escape in variable + +PREIFX ns: <http://example/ns#> + +SELECT * { + ?a\u0062c ns:abc ?o +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04.rq deleted file mode 100644 index b856b471b1..0000000000 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-04.rq +++ /dev/null @@ -1,5 +0,0 @@ -SELECT * WHERE { - ?s ?p "\\u0074" -} -# Legal codepoint escape of LATIN SMALL LETTER T (U+74), resulting in a -# valid backslash escape \t for CHARACTER TABULATION (U+9). diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-05.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-05.rq index 0408b8bba7..85b06bffdc 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-05.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-05.rq @@ -1,5 +1,6 @@ -SELECT * WHERE { - ?s ?p "\u005C\u005Cn" +# Codepoint escape in an IRI + +SELECT * { + ## /abc + <http://example/\u0061\U00000062\u0063> ?p ?o . } -# Two legal codepoint escapes of REVERSE SOLIDUS (U+5C), resulting in a -# valid backslash escape \\ for REVERSE SOLIDUS (U+5C) followed by 'n'. diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-06.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-06.rq index 5989bc9ad4..a342a3e41d 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-06.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-06.rq @@ -1,8 +1,6 @@ -PREFIX og: <http://ogp.me/ns#> -SELECT * WHERE { - ?page og:audio\u00253Atitle ?title -} +# Codepoint escape in a string -# the escape here produces '%' PERCENT SIGN (U+25) -# its unescaping must lead to a Prefixed Name og:audio%3Atitle which includes -# the percent-encoding %3A (COLON). +SELECT * { + ## "abc" + <http://example/abc> ?p "\U00000061\u0062\U00000063" . +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-07.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-07.rq index 75cb86fc5c..106f3b6e5c 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-07.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-07.rq @@ -1,7 +1,6 @@ -SELECT\u0020*\U00000009WHERE { - ?s ?p "value" -} +# Codepoint escape in a string -# the escapes here produce whitespace -- SPACESPACE (U+20) and -# CHARACTER TABULATION (U+9) -- surrounding the `*` token in the -# SELECT projection. +SELECT * { + ## 'abc' + <http://example/abc> ?p '\U00000061\u0062\U00000063' . +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-08.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-08.rq deleted file mode 100644 index 0fb5b5ddbc..0000000000 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-08.rq +++ /dev/null @@ -1,6 +0,0 @@ -SELECT * WHERE { - ?s ?p \u0022value" -} - -# the escape here produces QUOTATION MARK (U+22) -# its unescaping must lead to the literal 'value'. diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-bad-03.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-bad-03.rq deleted file mode 100644 index bde523852e..0000000000 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/codepoint-esc-bad-03.rq +++ /dev/null @@ -1,5 +0,0 @@ -SELECT * WHERE { - ?s ?p "\\u0041" -} -# Legal codepoint escape of LATIN CAPITAL LETTER A (U+41), resulting in an -# invalid backslash escape \A. diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/manifest.ttl b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/manifest.ttl index 66e4acc99c..d9286ec27c 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/manifest.ttl +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/manifest.ttl @@ -8,61 +8,93 @@ <> rdf:type mf:Manifest ; rdfs:label "SPARQL Codepoint-Escaping Tests" ; mf:entries - ( - :codepoint-esc-01 - :codepoint-esc-02 - :codepoint-esc-bad-03 - :codepoint-esc-04 - :codepoint-esc-05 - :codepoint-esc-06 - :codepoint-esc-07 - :codepoint-esc-08 + ( + :codepoint-esc-01-bad + :codepoint-esc-02-bad + :codepoint-esc-03-bad + :codepoint-esc-04-bad + :codepoint-esc-05 + :codepoint-esc-06 + :codepoint-esc-07 + + :surrogate-esc-01-bad + :surrogate-esc-02-bad + :surrogate-esc-03-bad + :surrogate-esc-04-bad + :surrogate-esc-05-bad ) . -:codepoint-esc-01 rdf:type mf:PositiveSyntaxTest ; +:codepoint-esc-01-bad rdf:type mf:NegativeSyntaxTest ; dawgt:approval dawgt:Proposed ; - mf:name "codepoint-esc-01.rq" ; - mf:action <codepoint-esc-01.rq> . + mf:name "codepoint-esc-01-bad.rq" ; + rdfs:comment "Whole query in codepoint escapes" ; + mf:action <codepoint-esc-01-bad.rq> . -:codepoint-esc-02 rdf:type mf:PositiveSyntaxTest ; +:codepoint-esc-02-bad rdf:type mf:NegativeSyntaxTest ; dawgt:approval dawgt:Proposed ; - mf:name "codepoint-esc-02.rq" ; - rdfs:comment "codepoint escape for the backslash of a PN_LOCAL_ESC in the PN_LOCAL part of a PrefixedName" ; - mf:action <codepoint-esc-02.rq> . + mf:name "codepoint-esc-02-bad.rq" ; + rdfs:comment "Codepoint escape in PNAME_NS of a prefixed name" ; + mf:action <codepoint-esc-02-bad.rq> . -:codepoint-esc-bad-03 rdf:type mf:NegativeSyntaxTest ; +:codepoint-esc-03-bad rdf:type mf:NegativeSyntaxTest ; dawgt:approval dawgt:Proposed ; - mf:name "codepoint-esc-bad-03.rq" ; - rdfs:comment "codepoint escape that results in an invalid backslash escape (requires handling codepoint escaping before backslash escaping)" ; - mf:action <codepoint-esc-bad-03.rq> . + mf:name "codepoint-esc-03-bad.rq" ; + rdfs:comment "Codepoint escape in PN_LOCAL of a prefixed name" ; + mf:action <codepoint-esc-03-bad.rq> . -:codepoint-esc-04 rdf:type mf:PositiveSyntaxTest ; +:codepoint-esc-04-bad rdf:type mf:NegativeSyntaxTest ; dawgt:approval dawgt:Proposed ; - mf:name "codepoint-esc-04.rq" ; - rdfs:comment "codepoint escape that results in a valid backslash escape" ; - mf:action <codepoint-esc-04.rq> . + mf:name "codepoint-esc-04-bad.rq" ; + rdfs:comment "Codepoint escape in variable" ; + mf:action <codepoint-esc-04-bad.rq> . :codepoint-esc-05 rdf:type mf:PositiveSyntaxTest ; dawgt:approval dawgt:Proposed ; mf:name "codepoint-esc-05.rq" ; + rdfs:comment "Codepoint escape in IRI" ; mf:action <codepoint-esc-05.rq> . :codepoint-esc-06 rdf:type mf:PositiveSyntaxTest ; dawgt:approval dawgt:Proposed ; mf:name "codepoint-esc-06.rq" ; - rdfs:comment "codepoint escape for the percent sign in the PL_LOCAL part of a PrefixedName" ; + rdfs:comment "Codepoint escape in string - double quoted string" ; mf:action <codepoint-esc-06.rq> . :codepoint-esc-07 rdf:type mf:PositiveSyntaxTest ; dawgt:approval dawgt:Proposed ; mf:name "codepoint-esc-07.rq" ; - rdfs:comment "codepoint escape for whitespace separating the projection tokens: SELECT * WHERE" ; + rdfs:comment "Codepoint escape in string - single quoted string" ; mf:action <codepoint-esc-07.rq> . -:codepoint-esc-08 rdf:type mf:PositiveSyntaxTest ; + +:surrogate-esc-01-bad rdf:type mf:NegativeSyntaxTest ; dawgt:approval dawgt:Proposed ; - mf:name "codepoint-esc-08.rq" ; - rdfs:comment "codepoint escape for the starting double-quote of a literal" ; - mf:action <codepoint-esc-08.rq> . + mf:name "surrogate-esc-01-bad.rq" ; + rdfs:comment "Surrogate pair - not accepted" ; + mf:action <surrogate-esc-01-bad.rq> . + +:surrogate-esc-02-bad rdf:type mf:NegativeSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "surrogate-esc-02-bad.rq" ; + rdfs:comment "Surrogate - low-high - not accepted" ; + mf:action <surrogate-esc-02-bad.rq> . + +:surrogate-esc-03-bad rdf:type mf:NegativeSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "surrogate-esc-03-bad.rq" ; + rdfs:comment "Surrogate - lone high escape sequence" ; + mf:action <surrogate-esc-03-bad.rq> . + +:surrogate-esc-04-bad rdf:type mf:NegativeSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "surrogate-esc-04-bad.rq" ; + rdfs:comment "Surrogate - lone low escape sequence" ; + mf:action <surrogate-esc-04-bad.rq> . + +:surrogate-esc-05-bad rdf:type mf:NegativeSyntaxTest ; + dawgt:approval dawgt:Proposed ; + mf:name "surrogate-esc-05-bad.rq" ; + rdfs:comment "Surrogate pair - IRI" ; + mf:action <surrogate-esc-05-bad.rq> . diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-01-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-01-bad.rq new file mode 100644 index 0000000000..4ef52df2c2 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-01-bad.rq @@ -0,0 +1,5 @@ +## Surrogate pair. Not legal. + +SELECT * { + ?s ?p "\uD83C\uDCA1" . +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-02-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-02-bad.rq new file mode 100644 index 0000000000..f911f0e64c --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-02-bad.rq @@ -0,0 +1,5 @@ +## Surrogates. Low-high (not a pair). Not legal. + +SELECT * { + ?s ?p "\uDCA1\uD83C" . +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-03-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-03-bad.rq new file mode 100644 index 0000000000..9234b9cb8d --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-03-bad.rq @@ -0,0 +1,5 @@ +## High surrogate. Not legal. + +SELECT * { + ?s ?p "Single high surrogate (\uD83C)" +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-04-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-04-bad.rq new file mode 100644 index 0000000000..cf01ae7977 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-04-bad.rq @@ -0,0 +1,5 @@ +## Low surrogate. Not legal. + +SELECT * { + ?s ?p "Single low surrogate (\uDCA1)" +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-05-bad.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-05-bad.rq new file mode 100644 index 0000000000..4cf9f2e144 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql12/codepoint-escapes/surrogate-esc-05-bad.rq @@ -0,0 +1,5 @@ +## Surrogate pair in IRI. Not legal. + +SELECT * { + ?s ?p <http://example/\uD83C\uDCA1> +}
