This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit 4498797533d75e6cbacfff9094909fb19dc65a6d Author: Andy Seaborne <[email protected]> AuthorDate: Wed Feb 4 17:59:04 2026 +0000 Update rdf-tests sparql/sparql11/aggregates --- .../main/java/org/apache/jena/riot/RDFParser.java | 31 +- .../src/main/java/org/apache/jena/system/G.java | 40 - .../apache/jena/arq/junit/sparql/SparqlTests.java | 6 +- .../sparql/sparql11/aggregates/agg-avg-distinct.rq | 6 + .../sparql11/aggregates/agg-avg-distinct.srx | 41 + .../sparql11/aggregates/agg-count-distinct.rq | 4 + .../sparql11/aggregates/agg-count-distinct.srx | 41 + .../sparql11/aggregates/agg-count-rows-distinct.rq | 4 + .../aggregates/agg-count-rows-distinct.srx | 41 + .../aggregates/agg-empty-group-count-graph.rq | 5 + .../aggregates/agg-empty-group-count-graph.ttl | 22 + .../sparql11/aggregates/agg-group-builtin.rq | 6 + .../sparql11/aggregates/agg-group-builtin.srx | 33 + .../sparql/sparql11/aggregates/agg-group-fn.rq | 6 + .../sparql/sparql11/aggregates/agg-group-fn.srx | 43 + .../sparql11/aggregates/agg-groupconcat-4.rq | 2 +- .../{agg-groupconcat-4.rq => agg-groupconcat-6.rq} | 4 +- .../sparql11/aggregates/agg-groupconcat-6.srx | 5 + .../aggregates/agg-groupconcat-distinct.rq | 7 + .../aggregates/agg-groupconcat-distinct.srx | 5 + .../sparql/sparql11/aggregates/agg-max-distinct.rq | 6 + .../sparql11/aggregates/agg-max-distinct.srx | 41 + .../sparql/sparql11/aggregates/agg-min-distinct.rq | 6 + .../sparql11/aggregates/agg-min-distinct.srx | 41 + .../sparql11/aggregates/agg-multiple-having.rq | 7 + .../sparql11/aggregates/agg-multiple-having.srx | 18 + .../sparql11/aggregates/agg-numeric-duplicates.ttl | 7 + .../sparql11/aggregates/agg-sample-distinct.rq | 10 + .../sparql/sparql11/aggregates/agg-sum-distinct.rq | 6 + .../sparql11/aggregates/agg-sum-distinct.srx | 41 + .../sparql/sparql11/aggregates/index.html | 1232 ++++++++++++++++++++ .../sparql/sparql11/aggregates/manifest.ttl | 129 +- .../sparql/sparql11/aggregates/singleton.ttl | 3 + .../main/java/org/apache/jena/atlas/lib/Lib.java | 30 + 34 files changed, 1852 insertions(+), 77 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java index ae6f968d6b..1ddde04c25 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParser.java @@ -21,6 +21,7 @@ package org.apache.jena.riot; +import static org.apache.jena.atlas.lib.Lib.*; import static org.apache.jena.riot.RDFLanguages.NQUADS; import static org.apache.jena.riot.RDFLanguages.NTRIPLES; import static org.apache.jena.riot.RDFLanguages.RDFJSON; @@ -39,6 +40,7 @@ import java.util.Optional; import org.apache.jena.atlas.io.IO; import org.apache.jena.atlas.lib.InternalErrorException; +import org.apache.jena.atlas.lib.Lib; import org.apache.jena.atlas.web.ContentType; import org.apache.jena.atlas.web.TypedInputStream; import org.apache.jena.graph.Graph; @@ -194,7 +196,7 @@ public class RDFParser { boolean canonicalLexicalValues, LangTagForm langTagForm, boolean resolveURIs, IRIxResolver resolver, PrefixMap prefixMap, FactoryRDF factory, ErrorHandler errorHandler, Context context) { - int x = countNonNull(uri, path, content, inputStream, javaReader); + int x = Lib.countNonNull(uri, path, content, inputStream, javaReader); if ( x >= 2 ) throw new IllegalArgumentException("Only one source allowed: one of uri, path, content, inputStream and javaReader must be set"); if ( x < 1 ) @@ -227,33 +229,6 @@ public class RDFParser { this.context = context; } - /** Count the nulls */ - private int countNonNull(Object... objs) { - int x = 0; - for ( Object obj : objs ) - if ( obj != null ) - x++; - return x; - } - - /** One or more non-null */ - private boolean isNonNull(Object... objs) { - int x = 0; - for ( Object obj : objs ) - if ( obj != null ) - return true; - return false; - } - - /** All null */ - private boolean allNull(Object... objs) { - int x = 0; - for ( Object obj : objs ) - if ( obj != null ) - return false; - return true; - } - /** * Parse the source, sending the results to a {@link Graph}. * <p> diff --git a/jena-arq/src/main/java/org/apache/jena/system/G.java b/jena-arq/src/main/java/org/apache/jena/system/G.java index 0c53f96d08..7392a0b0c2 100644 --- a/jena-arq/src/main/java/org/apache/jena/system/G.java +++ b/jena-arq/src/main/java/org/apache/jena/system/G.java @@ -792,46 +792,6 @@ public class G { } finally { iter.close(); } } - /** Are all the arguments non-null? */ - @SafeVarargs - public static <X> boolean allNonNull(X ... objects) { - return countNonNulls(objects) == objects.length; - } - - /** Is one and only one argument non-null? */ - @SafeVarargs - public static <X> boolean exactlyOneSet(X ... objects) { - return countNonNulls(objects) == 1; - } - - /** Is one or none of the arguments non-null? */ - @SafeVarargs - public static <X> X atMostOne(X ... objects) { - int c = 0; - X x = null; - for ( X obj : objects ) { - if ( obj != null ) { - c++; - if ( c > 1 ) - throw new RDFDataException("atMostOne:"+Arrays.asList(objects)); - if ( x == null ) - x = obj; - } - } - return x; - } - - /** Count non-nulls */ - @SafeVarargs - public static <X> int countNonNulls(X ... objects) { - int x = 0; - for ( Object obj : objects ) { - if ( obj != null ) - x++; - } - return x; - } - // ---- Project /** Project quads to triples */ 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 6ab2b909cd..4b724af489 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 @@ -113,13 +113,9 @@ public class SparqlTests { // ---- Query Evaluation Tests if ( equalsType(testType, TestManifest.QueryEvaluationTest) ) { - // Locally no supported. + // Locally not supported. // Omitted tests. - // ?? - if ( entryContainsSubstring(entry, "aggregates/manifest#agg-groupconcat-04") ) - return new OmittedTest(entry); - // Two BNODE in the SELECT if ( entryContainsSubstring(entry, "functions/manifest#bnode01") ) return new OmittedTest(entry); diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.rq new file mode 100644 index 0000000000..3abb717440 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.rq @@ -0,0 +1,6 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (AVG(DISTINCT ?o) AS ?avg) +WHERE { + ?s ?p ?o +} +GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.srx new file mode 100644 index 0000000000..fbed261079 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-avg-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="avg"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="avg"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.5</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="avg"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.6</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="avg"> + <literal datatype="http://www.w3.org/2001/XMLSchema#double">1050</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="avg"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.6</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.rq new file mode 100644 index 0000000000..6b03a3a252 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.rq @@ -0,0 +1,4 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (COUNT(DISTINCT ?o) AS ?count) WHERE { + ?s ?p ?o +} GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.srx new file mode 100644 index 0000000000..ae799c7533 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="count"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.rq new file mode 100644 index 0000000000..217e721caa --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.rq @@ -0,0 +1,4 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (COUNT(DISTINCT *) AS ?count) WHERE { + ?s ?p ?o +} GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.srx new file mode 100644 index 0000000000..ae799c7533 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-count-rows-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="count"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="count"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.rq new file mode 100644 index 0000000000..8797fee921 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.rq @@ -0,0 +1,5 @@ +PREFIX : <http://example/> + +SELECT ?g ?c WHERE { + GRAPH ?g {SELECT (count(*) AS ?c) WHERE { ?s :p ?x }} +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.ttl b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.ttl new file mode 100644 index 0000000000..1bcd7f86d3 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-empty-group-count-graph.ttl @@ -0,0 +1,22 @@ +@prefix : <http://example/> . +@prefix rs: <http://www.w3.org/2001/sw/DataAccess/tests/result-set#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +[] rdf:type rs:ResultSet ; + rs:resultVariable "g" ; + rs:resultVariable "c" ; + rs:solution [ rs:binding [ rs:value <empty.ttl> ; + rs:variable "g" + ] ; + rs:binding [ rs:value "0"^^xsd:integer ; + rs:variable "c" + ] + ] ; + rs:solution [ rs:binding [ rs:value <singleton.ttl> ; + rs:variable "g" + ] ; + rs:binding [ rs:value "1"^^xsd:integer ; + rs:variable "c" + ] + ] . diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.rq new file mode 100644 index 0000000000..3d558676d2 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.rq @@ -0,0 +1,6 @@ +PREFIX : <http://www.example.org/> +SELECT ?d (COUNT(*) AS ?c) +WHERE { + ?s ?p ?o +} +GROUP BY (DATATYPE(?o) AS ?d) diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.srx new file mode 100644 index 0000000000..71bf13208c --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-builtin.srx @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="d"/> + <variable name="c"/> + </head> + <results> + <result> + <binding name="d"> + <uri>http://www.w3.org/2001/XMLSchema#decimal</uri> + </binding> + <binding name="c"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal> + </binding> + </result> + <result> + <binding name="d"> + <uri>http://www.w3.org/2001/XMLSchema#double</uri> + </binding> + <binding name="c"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">4</literal> + </binding> + </result> + <result> + <binding name="d"> + <uri>http://www.w3.org/2001/XMLSchema#integer</uri> + </binding> + <binding name="c"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">4</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.rq new file mode 100644 index 0000000000..260e60ccee --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.rq @@ -0,0 +1,6 @@ +PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> +SELECT ?i +WHERE { + ?s ?p ?o +} +GROUP BY (xsd:integer(?o) AS ?i) diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.srx new file mode 100644 index 0000000000..e34a993dc1 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-group-fn.srx @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="i"/> + </head> + <results> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">0</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2000</literal> + </binding> + </result> + <result> + <binding name="i"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">30000</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq index a0d7cba768..6563d2c636 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq @@ -3,5 +3,5 @@ ASK { {SELECT (GROUP_CONCAT(?o) AS ?g) WHERE { VALUES ?o { "1"@en "2"@en } }} - FILTER(?g = "1 2"@en || ?g = "2 1"@en) + FILTER(?g = "1 2" || ?g = "2 1") } diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.rq similarity index 55% copy from jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq copy to jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.rq index a0d7cba768..bdf24c2402 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-4.rq +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.rq @@ -1,7 +1,7 @@ PREFIX : <http://www.example.org/> ASK { {SELECT (GROUP_CONCAT(?o) AS ?g) WHERE { - VALUES ?o { "1"@en "2"@en } + VALUES ?o { "1"@en } }} - FILTER(?g = "1 2"@en || ?g = "2 1"@en) + FILTER(?g = "1") } diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.srx new file mode 100644 index 0000000000..7830ed1db8 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-6.srx @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head/> + <boolean>true</boolean> +</sparql> \ No newline at end of file diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.rq new file mode 100644 index 0000000000..8574a1453d --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.rq @@ -0,0 +1,7 @@ +PREFIX : <http://www.example.org/> +ASK { + {SELECT (GROUP_CONCAT(DISTINCT ?o) AS ?g) WHERE { + VALUES ?o { "1" "2" "1" } + }} + FILTER(?g = "1 2" || ?g = "2 1") +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.srx new file mode 100644 index 0000000000..7830ed1db8 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-groupconcat-distinct.srx @@ -0,0 +1,5 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head/> + <boolean>true</boolean> +</sparql> \ No newline at end of file diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.rq new file mode 100644 index 0000000000..422035efaa --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.rq @@ -0,0 +1,6 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (MAX(DISTINCT ?o) AS ?max) +WHERE { + ?s ?p ?o +} +GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.srx new file mode 100644 index 0000000000..2fe4937c5b --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-max-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="max"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="max"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="max"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">2.2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="max"> + <literal datatype="http://www.w3.org/2001/XMLSchema#double">2.0E3</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="max"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">2.2</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.rq new file mode 100644 index 0000000000..a93966f2f2 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.rq @@ -0,0 +1,6 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (MIN(DISTINCT ?o) AS ?min) +WHERE { + ?s ?p ?o +} +GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.srx new file mode 100644 index 0000000000..cf28062d61 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-min-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="min"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="min"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="min"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">1.0</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="min"> + <literal datatype="http://www.w3.org/2001/XMLSchema#double">1.0E2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="min"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.rq new file mode 100644 index 0000000000..ff6690bc8e --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.rq @@ -0,0 +1,7 @@ +PREFIX : <http://www.example.org/> +SELECT ?s +WHERE { + ?s ?p ?o +} +GROUP BY ?s +HAVING (COUNT(*) > 1) (COUNT(*) < 3) diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.srx new file mode 100644 index 0000000000..1942120f77 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-multiple-having.srx @@ -0,0 +1,18 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed2</uri> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-numeric-duplicates.ttl b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-numeric-duplicates.ttl new file mode 100644 index 0000000000..9f330ebce3 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-numeric-duplicates.ttl @@ -0,0 +1,7 @@ +@prefix : <http://www.example.org/> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +:ints :int 1, 2, 2 . +:decimals :dec 1.0, 2.2, 2.2 . +:doubles :double 1.0E2, 2.0E3, 2.0E3 . +:mixed1 :int 1 ; :dec 2.2 . diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sample-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sample-distinct.rq new file mode 100644 index 0000000000..767eaa85db --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sample-distinct.rq @@ -0,0 +1,10 @@ +PREFIX : <http://www.example.org/> +ASK { + { + SELECT (SAMPLE(DISTINCT ?o) AS ?sample) + WHERE { + ?s :dec ?o + } + } + FILTER(?sample = 1.0 || ?sample = 2.2 || ?sample = 3.5) +} diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.rq b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.rq new file mode 100644 index 0000000000..dceb966c10 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.rq @@ -0,0 +1,6 @@ +PREFIX : <http://www.example.org/> +SELECT ?s (SUM(DISTINCT ?o) AS ?sum) +WHERE { + ?s ?p ?o +} +GROUP BY ?s diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.srx b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.srx new file mode 100644 index 0000000000..d440e489fe --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/agg-sum-distinct.srx @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<sparql xmlns="http://www.w3.org/2005/sparql-results#"> + <head> + <variable name="s"/> + <variable name="sum"/> + </head> + <results> + <result> + <binding name="s"> + <uri>http://www.example.org/ints</uri> + </binding> + <binding name="sum"> + <literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/decimals</uri> + </binding> + <binding name="sum"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">3.2</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/doubles</uri> + </binding> + <binding name="sum"> + <literal datatype="http://www.w3.org/2001/XMLSchema#double">2100</literal> + </binding> + </result> + <result> + <binding name="s"> + <uri>http://www.example.org/mixed1</uri> + </binding> + <binding name="sum"> + <literal datatype="http://www.w3.org/2001/XMLSchema#decimal">3.2</literal> + </binding> + </result> + </results> +</sparql> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/index.html b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/index.html new file mode 100644 index 0000000000..e3b2fddc22 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/index.html @@ -0,0 +1,1232 @@ +<!DOCTYPE html> +<html lang='en' prefix='dawgt: http://www.w3.org/2001/sw/DataAccess/tests/test-dawg# mf: http://www.w3.org/2001/sw/DataAccess/tests/test-manifest# mfx: http://jena.hpl.hp.com/2005/05/test-manifest-extra# qt: http://www.w3.org/2001/sw/DataAccess/tests/test-query# sd: http://www.w3.org/ns/sparql-service-description# ut: http://www.w3.org/2009/sparql/tests/test-update#'> + <head> + <meta content='text/html;charset=utf-8' http-equiv='Content-Type'> + <meta content='width=device-width, initial-scale=1.0' name='viewport'> + <link href='https://www.w3.org/StyleSheets/TR/base' rel='stylesheet' type='text/css'> + <style> + body {background-image: none;} + dl.editor>dd { + margin: 0 0 0 40px; + } + dl.test-detail { + padding: 0.5em; + } + dl.test-detail>dt { + float: left; + clear: left; + text-align: right; + font-weight: bold; + color: green; + } + dl.test-detail>dt:after {content: ": "} + dl.test-detail>dd { + margin: 0 0 0 110px; + padding: 0 0 0.5em 0; + } + dl.test-description>dt {margin-top: 2em;} + dd {margin-left: 0;} + dd code {display: inline;} + footer {text-align: center;} + </style> + <title> + Aggregates + </title> + <style> + em.rfc2119 { + text-transform: lowercase; + font-variant: small-caps; + font-style: normal; + color: #900; + } + a.testlink { + color: inherit; + text-decoration: none; + } + a.testlink:hover { + text-decoration: underline; + } + .warning {color: orange;} + .error {color: red;} + </style> + </head> + <body resource='./' typeof='mf:Manifest'> + <p> + <a href='http://www.w3.org/'> + <img alt='W3C' height='48' src='http://www.w3.org/Icons/w3c_home' width='72'> + </a> + </p> + <h1 property='rdfs:label'>Aggregates</h1> + <p><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2010 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.org/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights [...] + <hr title='Separator for header'> + <div> + <h2 id='abstract'>Abstract</h2> + <p property='rdfs:comment'> + </p> + <p>This page describes W3C SPARQL Working Group's SPARQL 1.1 test suite.</p> + <h3 id='contributing-tests'>Contributing Tests</h3> + <p>The test manifests and entries are built automatically from <a href="manifest.ttl">manifest.ttl</a> using a Rake task. Tests may be contributed via pull request to <a href="https://github.com/w3c/rdf-tests">https://github.com/w3c/rdf-tests</a> with suitable changes to the <a href="manifest.ttl">manifest.ttl</a> and referenced files.</p> + <h3 id='distribution'>Distribution</h3> + <p>Distributed under both the <a href="http://www.w3.org/Consortium/Legal/2008/04-testsuite-license">W3C Test Suite License</a> and the <a href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license">W3C 3-clause BSD License</a>. To contribute to a W3C Test Suite, see the <a href="http://www.w3.org/2004/10/27-testcases">policies and contribution forms</a>.</p> + <h3 id='disclaimer'>Disclaimer</h3> + <p>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 PA [...] + 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.</p> + </div> + <div> + <h2> + Test Descriptions + </h2> + <dl class='test-description'> + <dt id='agg01'> + <a class='testlink' href='#agg01'> + agg01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg01' property='mf:name'>COUNT 1</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Simple count</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg01.srx' property='mf:result'>agg01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg02'> + <a class='testlink' href='#agg02'> + agg02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg02' property='mf:name'>COUNT 2</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count with grouping</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg02.srx' property='mf:result'>agg02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg03'> + <a class='testlink' href='#agg03'> + agg03: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg03' property='mf:name'>COUNT 3</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg03' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count with grouping and HAVING clause</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg03.srx' property='mf:result'>agg03.srx</a> + </dd> + </dl> + </dd> + <dt id='agg04'> + <a class='testlink' href='#agg04'> + agg04: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg04' property='mf:name'>COUNT 4</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg04' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count(*)</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg04.srx' property='mf:result'>agg04.srx</a> + </dd> + </dl> + </dd> + <dt id='agg05'> + <a class='testlink' href='#agg05'> + agg05: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg05' property='mf:name'>COUNT 5</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg05' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count(*) with grouping</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg05.srx' property='mf:result'>agg05.srx</a> + </dd> + </dl> + </dd> + <dt id='agg06'> + <a class='testlink' href='#agg06'> + agg06: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg06' property='mf:name'>COUNT 6</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg06' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count(<em>) with HAVING Count(</em>)</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg06.srx' property='mf:result'>agg06.srx</a> + </dd> + </dl> + </dd> + <dt id='agg07'> + <a class='testlink' href='#agg07'> + agg07: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg07' property='mf:name'>COUNT 7</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg07' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Count(<em>) with grouping and HAVING Count(</em>)</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg07.srx' property='mf:result'>agg07.srx</a> + </dd> + </dl> + </dd> + <dt id='agg08'> + <a class='testlink' href='#agg08'> + agg08: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg08' property='mf:name'>COUNT 8</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg08' typeof='mf:NegativeSyntaxTest11'> + <div property='rdfs:comment'> + <p>grouping by expression, done wrong</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:NegativeSyntaxTest11</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <a href='agg08.rq' property='mf:action'>agg08.rq</a> + </dd> + </dl> + </dd> + <dt id='agg08b'> + <a class='testlink' href='#agg08b'> + agg08b: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg08b' property='mf:name'>COUNT 8b</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg08b' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>grouping by expression, done correctly</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg08b.srx' property='mf:result'>agg08b.srx</a> + </dd> + </dl> + </dd> + <dt id='agg09'> + <a class='testlink' href='#agg09'> + agg09: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg09' property='mf:name'>COUNT 9</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg09' typeof='mf:NegativeSyntaxTest11'> + <div property='rdfs:comment'> + <p>Projection of an ungrouped variable (not appearing in the GROUP BY expression)</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:NegativeSyntaxTest11</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <a href='agg09.rq' property='mf:action'>agg09.rq</a> + </dd> + </dl> + </dd> + <dt id='agg10'> + <a class='testlink' href='#agg10'> + agg10: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg10' property='mf:name'>COUNT 10</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg10' typeof='mf:NegativeSyntaxTest11'> + <div property='rdfs:comment'> + <p>Projection of an ungrouped variable (no GROUP BY expression at all)</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:NegativeSyntaxTest11</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <a href='agg10.rq' property='mf:action'>agg10.rq</a> + </dd> + </dl> + </dd> + <dt id='agg11'> + <a class='testlink' href='#agg11'> + agg11: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg11' property='mf:name'>COUNT 11</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg11' typeof='mf:NegativeSyntaxTest11'> + <div property='rdfs:comment'> + <p>Use of an ungrouped variable in a project expression</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:NegativeSyntaxTest11</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <a href='agg11.rq' property='mf:action'>agg11.rq</a> + </dd> + </dl> + </dd> + <dt id='agg12'> + <a class='testlink' href='#agg12'> + agg12: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg12' property='mf:name'>COUNT 12</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg12' typeof='mf:NegativeSyntaxTest11'> + <div property='rdfs:comment'> + <p>Use of an ungrouped variable in a project expression, where the variable appears in a GROUP BY expression</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:NegativeSyntaxTest11</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <a href='agg12.rq' property='mf:action'>agg12.rq</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-01'> + <a class='testlink' href='#agg-groupconcat-01'> + agg-groupconcat-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-01' property='mf:name'>GROUP_CONCAT 1</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-1.srx' property='mf:result'>agg-groupconcat-1.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-02'> + <a class='testlink' href='#agg-groupconcat-02'> + agg-groupconcat-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-02' property='mf:name'>GROUP_CONCAT 2</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-2.srx' property='mf:result'>agg-groupconcat-2.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-03'> + <a class='testlink' href='#agg-groupconcat-03'> + agg-groupconcat-03: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-03' property='mf:name'>GROUP_CONCAT with SEPARATOR</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-03' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-3.srx' property='mf:result'>agg-groupconcat-3.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-04'> + <a class='testlink' href='#agg-groupconcat-04'> + agg-groupconcat-04: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-04' property='mf:name'>GROUP_CONCAT with same language tag</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-04' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-4.srx' property='mf:result'>agg-groupconcat-4.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-05'> + <a class='testlink' href='#agg-groupconcat-05'> + agg-groupconcat-05: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-05' property='mf:name'>GROUP_CONCAT with different language tags</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-05' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-5.srx' property='mf:result'>agg-groupconcat-5.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-sum-01'> + <a class='testlink' href='#agg-sum-01'> + agg-sum-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-01' property='mf:name'>SUM</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-sum-01.srx' property='mf:result'>agg-sum-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-sum-02'> + <a class='testlink' href='#agg-sum-02'> + agg-sum-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-02' property='mf:name'>SUM with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-sum-02.srx' property='mf:result'>agg-sum-02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-avg-01'> + <a class='testlink' href='#agg-avg-01'> + agg-avg-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-01' property='mf:name'>AVG</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-avg-01.srx' property='mf:result'>agg-avg-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-avg-02'> + <a class='testlink' href='#agg-avg-02'> + agg-avg-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-02' property='mf:name'>AVG with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-avg-02.srx' property='mf:result'>agg-avg-02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-avg-03'> + <a class='testlink' href='#agg-avg-03'> + agg-avg-03: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-03' property='mf:name'>AVG with empty group (value defined to be 0)</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-03' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-avg-03.srx' property='mf:result'>agg-avg-03.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-min-01'> + <a class='testlink' href='#agg-min-01'> + agg-min-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-01' property='mf:name'>MIN</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-min-01.srx' property='mf:result'>agg-min-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-min-02'> + <a class='testlink' href='#agg-min-02'> + agg-min-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-02' property='mf:name'>MIN with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-min-02.srx' property='mf:result'>agg-min-02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-max-01'> + <a class='testlink' href='#agg-max-01'> + agg-max-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-01' property='mf:name'>MAX</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-max-01.srx' property='mf:result'>agg-max-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-max-02'> + <a class='testlink' href='#agg-max-02'> + agg-max-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-02' property='mf:name'>MAX with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-max-02.srx' property='mf:result'>agg-max-02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-sample-01'> + <a class='testlink' href='#agg-sample-01'> + agg-sample-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sample-01' property='mf:name'>SAMPLE</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sample-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-sample-01.srx' property='mf:result'>agg-sample-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-err-01'> + <a class='testlink' href='#agg-err-01'> + agg-err-01: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-err-01' property='mf:name'>Error in AVG</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-err-01' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Error in AVG return no binding</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-err-01.srx' property='mf:result'>agg-err-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-err-02'> + <a class='testlink' href='#agg-err-02'> + agg-err-02: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-err-02' property='mf:name'>Protect from error in AVG</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-err-02' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>Protect from error in AVG using IF and COALESCE</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-err-02.srx' property='mf:result'>agg-err-02.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-empty-group-max-1'> + <a class='testlink' href='#agg-empty-group-max-1'> + agg-empty-group-max-1: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-max-1' property='mf:name'>agg on empty set, explicit grouping</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-max-1' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>aggregating empty results returns no rows, as there are no grouped results.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-empty-group-max-1.srx' property='mf:result'>agg-empty-group-max-1.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-empty-group-max-2'> + <a class='testlink' href='#agg-empty-group-max-2'> + agg-empty-group-max-2: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-max-2' property='mf:name'>agg on empty set, no grouping</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-max-2' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>aggregating empty results with no group-by always returns a single result.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-empty-group-max-2.srx' property='mf:result'>agg-empty-group-max-2.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-empty-group-count-1'> + <a class='testlink' href='#agg-empty-group-count-1'> + agg-empty-group-count-1: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-1' property='mf:name'>COUNT: no match, with group</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-1' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>counting no results with grouping returns no results.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-empty-group-count-1.srj' property='mf:result'>agg-empty-group-count-1.srj</a> + </dd> + </dl> + </dd> + <dt id='agg-empty-group-count-2'> + <a class='testlink' href='#agg-empty-group-count-2'> + agg-empty-group-count-2: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-2' property='mf:name'>COUNT: no match, no group</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-2' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>counting no results without grouping always returns a single result.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-empty-group-count-2.srj' property='mf:result'>agg-empty-group-count-2.srj</a> + </dd> + </dl> + </dd> + <dt id='agg-empty-group-count-graph'> + <a class='testlink' href='#agg-empty-group-count-graph'> + agg-empty-group-count-graph: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-graph' property='mf:name'>COUNT: no GROUP BY inside of GRAPH</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-empty-group-count-graph' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>counting no results without grouping always returns a single result per named graph.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-empty-group-count-graph.ttl' property='mf:result'>agg-empty-group-count-graph.ttl</a> + </dd> + </dl> + </dd> + <dt id='agg-multiple-having'> + <a class='testlink' href='#agg-multiple-having'> + agg-multiple-having: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-multiple-having' property='mf:name'>HAVING: multiple conditions</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-multiple-having' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + <p>HAVING can contain multiple conditions.</p> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-multiple-having.srx' property='mf:result'>agg-multiple-having.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-group-fn'> + <a class='testlink' href='#agg-group-fn'> + agg-group-fn: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-group-fn' property='mf:name'>GROUP BY with a function</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-group-fn' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-group-fn.srx' property='mf:result'>agg-group-fn.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-group-builtin'> + <a class='testlink' href='#agg-group-builtin'> + agg-group-builtin: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-group-builtin' property='mf:name'>GROUP BY with a built-in function</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-group-builtin' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-group-builtin.srx' property='mf:result'>agg-group-builtin.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-avg-distinct'> + <a class='testlink' href='#agg-avg-distinct'> + agg-avg-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-distinct' property='mf:name'>AVG DISTINCT with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-avg-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-avg-distinct.srx' property='mf:result'>agg-avg-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-count-distinct'> + <a class='testlink' href='#agg-count-distinct'> + agg-count-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-count-distinct' property='mf:name'>COUNT DISTINCT with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-count-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-count-distinct.srx' property='mf:result'>agg-count-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-count-rows-distinct'> + <a class='testlink' href='#agg-count-rows-distinct'> + agg-count-rows-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-count-rows-distinct' property='mf:name'>COUNT(DISTINCT *) with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-count-rows-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-count-rows-distinct.srx' property='mf:result'>agg-count-rows-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-groupconcat-distinct'> + <a class='testlink' href='#agg-groupconcat-distinct'> + agg-groupconcat-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-distinct' property='mf:name'>GROUP_CONCAT DISTINCT</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-groupconcat-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-groupconcat-distinct.srx' property='mf:result'>agg-groupconcat-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-max-distinct'> + <a class='testlink' href='#agg-max-distinct'> + agg-max-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-distinct' property='mf:name'>MAX DISTINCT with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-max-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-max-distinct.srx' property='mf:result'>agg-max-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-min-distinct'> + <a class='testlink' href='#agg-min-distinct'> + agg-min-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-distinct' property='mf:name'>MIN DISTINCT with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-min-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-min-distinct.srx' property='mf:result'>agg-min-distinct.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-sample-distinct'> + <a class='testlink' href='#agg-sample-distinct'> + agg-sample-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sample-distinct' property='mf:name'>SAMPLE DISTINCT</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sample-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-sample-01.srx' property='mf:result'>agg-sample-01.srx</a> + </dd> + </dl> + </dd> + <dt id='agg-sum-distinct'> + <a class='testlink' href='#agg-sum-distinct'> + agg-sum-distinct: + </a> + <span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-distinct' property='mf:name'>SUM DISTINCT with GROUP BY</span> + </dt> + <dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/aggregates/manifest#agg-sum-distinct' typeof='mf:QueryEvaluationTest'> + <div property='rdfs:comment'> + </div> + <dl class='test-detail'> + <dt>type</dt> + <dd>mf:QueryEvaluationTest</dd> + <dt>approval</dt> + <dd property='mf:approval' resource=''></dd> + <dt>action</dt> + <dd> + <dl class='test-detail' property='mf:action' resource=''> + </dl> + </dd> + <dt>result</dt> + <dd> + <a href='agg-sum-distinct.srx' property='mf:result'>agg-sum-distinct.srx</a> + </dd> + </dl> + </dd> + </dl> + </div> + <footer> + <p><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright ©</a> 2015 <a href="http://www.w3.org/">W3C</a>® (<a href="http://www.csail.mit.edu/">MIT</a>, <a href="http://www.ercim.org/">ERCIM</a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C® <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> a [...] + </footer> + </body> +</html> diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/manifest.ttl b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/manifest.ttl index 4275d14a51..8bce5b64fd 100644 --- a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/manifest.ttl +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/manifest.ttl @@ -37,13 +37,25 @@ :agg-min-02 :agg-max-01 :agg-max-02 - :agg-sample-01 + :agg-sample-01 :agg-err-01 :agg-err-02 :agg-empty-group-max-1 :agg-empty-group-max-2 :agg-empty-group-count-1 :agg-empty-group-count-2 + :agg-empty-group-count-graph + :agg-multiple-having + :agg-group-fn + :agg-group-builtin + :agg-avg-distinct + :agg-count-distinct + :agg-count-rows-distinct + :agg-groupconcat-distinct + :agg-max-distinct + :agg-min-distinct + :agg-sample-distinct + :agg-sum-distinct ) . @@ -231,6 +243,14 @@ mf:result <agg-groupconcat-5.srx> . +:agg-groupconcat-06 rdf:type mf:QueryEvaluationTest ; + mf:name "GROUP_CONCAT with one element" ; + mf:feature sparql:group_concat ; + mf:action + [ qt:query <agg-groupconcat-6.rq> ] ; + mf:result <agg-groupconcat-6.srx> + . + :agg-avg-01 rdf:type mf:QueryEvaluationTest ; mf:name "AVG" ; mf:feature sparql:avg ; @@ -401,3 +421,110 @@ qt:data <empty.ttl> ] ; mf:result <agg-empty-group-count-2.srj> . + +:agg-empty-group-count-graph rdf:type mf:QueryEvaluationTest ; + mf:name "COUNT: no GROUP BY inside of GRAPH" ; + rdfs:comment "counting no results without grouping always returns a single result per named graph." ; + mf:action + [ qt:query <agg-empty-group-count-graph.rq> ; + qt:data <empty.ttl> ; + qt:graphData <empty.ttl> ; + qt:graphData <singleton.ttl> ] ; + mf:result <agg-empty-group-count-graph.ttl> + . + +:agg-multiple-having rdf:type mf:QueryEvaluationTest ; + mf:name "HAVING: multiple conditions" ; + rdfs:comment "HAVING can contain multiple conditions." ; + mf:action + [ qt:query <agg-multiple-having.rq> ; + qt:data <agg-numeric.ttl> ] ; + mf:result <agg-multiple-having.srx> + . + +:agg-group-fn rdf:type mf:QueryEvaluationTest ; + mf:name "GROUP BY with a function" ; + mf:action + [ qt:query <agg-group-fn.rq> ; + qt:data <agg-numeric.ttl> ] ; + mf:result <agg-group-fn.srx> + . + +:agg-group-builtin rdf:type mf:QueryEvaluationTest ; + mf:name "GROUP BY with a built-in function" ; + mf:action + [ qt:query <agg-group-builtin.rq> ; + qt:data <agg-numeric.ttl> ] ; + mf:result <agg-group-builtin.srx> + . + +:agg-avg-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "AVG DISTINCT with GROUP BY" ; + mf:feature sparql:avg ; + mf:action + [ qt:query <agg-avg-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-avg-distinct.srx> + . + +:agg-count-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "COUNT DISTINCT with GROUP BY" ; + mf:feature sparql:count ; + mf:action + [ qt:query <agg-count-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-count-distinct.srx> + . + +:agg-count-rows-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "COUNT(DISTINCT *) with GROUP BY" ; + mf:feature sparql:count ; + mf:action + [ qt:query <agg-count-rows-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-count-rows-distinct.srx> + . + +:agg-groupconcat-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "GROUP_CONCAT DISTINCT" ; + mf:feature sparql:group_concat ; + mf:action + [ qt:query <agg-groupconcat-distinct.rq> ] ; + mf:result <agg-groupconcat-distinct.srx> + . + +:agg-max-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "MAX DISTINCT with GROUP BY" ; + mf:feature sparql:max ; + mf:action + [ qt:query <agg-max-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-max-distinct.srx> + . + +:agg-min-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "MIN DISTINCT with GROUP BY" ; + mf:feature sparql:min ; + mf:action + [ qt:query <agg-min-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-min-distinct.srx> + . + +:agg-sample-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "SAMPLE DISTINCT" ; + mf:feature sparql:sample ; + mf:action + [ qt:query <agg-sample-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-sample-01.srx> + . + +:agg-sum-distinct rdf:type mf:QueryEvaluationTest ; + mf:name "SUM DISTINCT with GROUP BY" ; + mf:feature sparql:sum ; + mf:action + [ qt:query <agg-sum-distinct.rq> ; + qt:data <agg-numeric-duplicates.ttl> ] ; + mf:result <agg-sum-distinct.srx> + . diff --git a/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/singleton.ttl b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/singleton.ttl new file mode 100644 index 0000000000..05dd76a090 --- /dev/null +++ b/jena-arq/testing/rdf-tests-cg/sparql/sparql11/aggregates/singleton.ttl @@ -0,0 +1,3 @@ +@prefix ex: <http://example/> . + +ex:s ex:p ex:o . diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/Lib.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/Lib.java index 0e1e70a1b0..161be8a79a 100644 --- a/jena-base/src/main/java/org/apache/jena/atlas/lib/Lib.java +++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/Lib.java @@ -306,5 +306,35 @@ public class Lib return output; } + /** Are all the arguments non-null? */ + @SafeVarargs + public static <X> boolean allNonNull(X ... objects) { + return countNonNull(objects) == objects.length; + } + + /** Is one and only one argument non-null? */ + @SafeVarargs + public static <X> boolean exactlyOneSet(X ... objects) { + return countNonNull(objects) == 1; + } + + /** One or more non-null */ + public static boolean isNonNull(Object... objs) { + int x = 0; + for ( Object obj : objs ) + if ( obj != null ) + return true; + return false; + } + /** Count non-nulls */ + @SafeVarargs + public static <X> int countNonNull(X ... objects) { + int x = 0; + for ( Object obj : objects ) { + if ( obj != null ) + x++; + } + return x; + } }
