You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Yev Bronshteyn (JIRA)" <ji...@apache.org> on 2016/10/31 04:05:58 UTC

[jira] [Created] (JENA-1254) Inconsistent and incorrect GROUP_CONCAT query execution depending on order

Yev Bronshteyn created JENA-1254:
------------------------------------

             Summary: Inconsistent and incorrect GROUP_CONCAT query execution depending on order
                 Key: JENA-1254
                 URL: https://issues.apache.org/jira/browse/JENA-1254
             Project: Apache Jena
          Issue Type: Bug
          Components: ARQ
    Affects Versions: Jena 3.1.0
            Reporter: Yev Bronshteyn


The following two queries have the same triples in their {{where}} clauses in different order. While it is expected that the first query will return only one solution and the second query - multiple (per https://wiki.blazegraph.com/wiki/index.php/SPARQL_Order_Matters), it is *not* expected that the optional {{copyrightTexts}} value will appear in the result of the first query, but not in the corresponding solution in the result of the second query.

{code}
prefix spdx: <http://spdx.org/rdf/terms#>
prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix doap:<http://usefulinc.com/ns/doap#>
 
select
	(group_concat(distinct(?licText);separator="\n\n") as ?licTexts)
    (group_concat(?copyrightText;separator="\n\n") as ?copyrightTexts)
	?name
where {
        optional  {
            ?elem spdx:copyrightText ?copyrightText .
            filter (isLiteral(?copyrightText))
        } .
        {
            # And the name
            {?elem spdx:name ?name}
            union
            {
                ?elem spdx:artifactOf ?artifact .
                ?artifact doap:name ?name
            }
        }.
}
group by ?name
{code}
And
{code}
prefix spdx: <http://spdx.org/rdf/terms#>
prefix rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix doap:<http://usefulinc.com/ns/doap#>
 
select
	(group_concat(distinct(?licText);separator="\n\n") as ?licTexts)
        (group_concat(?copyrightText;separator="\n\n") as ?copyrightTexts)
	?name
where {
        {
            # And the name
            {?elem spdx:name ?name}
            union
            {
                ?elem spdx:artifactOf ?artifact .
                ?artifact doap:name ?name
            }
        }.
        optional  {
            ?elem spdx:copyrightText ?copyrightText .
            filter (isLiteral(?copyrightText))
        } .
}
group by ?name
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)