[ 
https://issues.apache.org/jira/browse/JENA-1856?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17054918#comment-17054918
 ] 

Andy Seaborne commented on JENA-1856:
-------------------------------------

Hi [~benjamingeer]

If GROUP_CONCAT has an unbound value in the list of values to concat, the 
overall result is "error".

This is because {{CONCAT(unbound "foo")}} is error.

Try:

{noformat}
SELECT 
   (GROUP_CONCAT(if(bound(?decimal),str(?decimal),"UNDEF1"); SEPARATOR=';') AS 
?decimal__Concat)
   (GROUP_CONCAT(if(bound(?boolean),str(?boolean),"UNDEF2"); SEPARATOR=';') AS 
?boolean__Concat)
{noformat}

If you don't want unbounds, even using "" (which will add the ";") then remove 
them in the WHERE clause.

> Unexpected results with GROUP_BY and GROUP_CONCAT
> -------------------------------------------------
>
>                 Key: JENA-1856
>                 URL: https://issues.apache.org/jira/browse/JENA-1856
>             Project: Apache Jena
>          Issue Type: Question
>          Components: Jena
>    Affects Versions: Jena 3.14.0
>            Reporter: Benjamin Geer
>            Priority: Major
>         Attachments: query-with-group-concat.txt, 
> query-without-group-concat.txt, test-data.txt
>
>
> Attached is:
>  * some example data
>  * a query that works as I expected, without {{GROUP BY}}
>  * the same query with {{GROUP BY}} and {{GROUP_CONCAT}} added, which doesn't 
> work as I expected
> Am I doing something wrong, or is this a bug?
> Using the query without {{GROUP BY}}, I get these results as expected:
>  
> ||thing||decimal||boolean||
> |<http://example.org/data/a>| |<http://example.org/data/a/values/2>|
> |<http://example.org/data/b>| |<http://example.org/data/b/values/2>|
> |<http://example.org/data/b>|<http://example.org/data/b/values/1>| |
>  
> Using the query with {{GROUP BY}} and {{GROUP_CONCAT}}, I expected to get:
> ||thing||decimal__Concat||boolean__Concat||
> |<http://example.org/data/a>| |<http://example.org/data/a/values/2>|
> |<http://example.org/data/b>|<http://example.org/data/b/values/1>|<http://example.org/data/b/values/2>|
>  
> But instead I get:
> ||thing||decimal__Concat||boolean__Concat||
> |<http://example.org/data/a>| |<http://example.org/data/a/values/2>|
> |<http://example.org/data/b>| | |
>  
> Should I be doing something different to get the results I expected? 
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to