You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Andy Seaborne (JIRA)" <ji...@apache.org> on 2016/11/08 11:11:58 UTC

[jira] [Closed] (JENA-1254) GROUP_CONCAT returns nothing when concatenating unbound and bound values.

     [ https://issues.apache.org/jira/browse/JENA-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andy Seaborne closed JENA-1254.
-------------------------------
    Resolution: Fixed

Closed after a week.

> GROUP_CONCAT returns nothing when concatenating unbound and bound values.
> -------------------------------------------------------------------------
>
>                 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
>         Attachments: c_spdxtest_5530.rdf
>
>
> 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}
> The issue seems to be that with the second query, GROUP_CONCAT has to concatenate the bound value of ?copyrightText with unbound values. Changing the second query to unconditionally bind a value to ?copyrightText eliminates the behavior.



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