You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Mikael Pesonen <mi...@lingsoft.fi> on 2017/11/07 14:34:18 UTC

distinct in SPARQL group_concat

Hi,

in FOAF schema there are values

rdfs:label 
<https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label> 

	Agent
rdfs:label 
<https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23label> 

	Agent _en-US

When making query

SELECT (group_concat(distinct ?o_label_g; separator=", ") as ?o_label) WHERE
...
?o rdfs:label ?o_label_g
...

result for ?o_label is

"Agent, Agent"

and not "Agent". Is that how it should work, or should DISTINCT work 
with language labels stripped out of the values?

If this works how it should, is there an easy way to remove duplicates?

Br,
Mikael

-- 
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND


Re: distinct in SPARQL group_concat

Posted by Mikael Pesonen <mi...@lingsoft.fi>.
Thanks, that worked!

Br

On 7.11.2017 20:31, Andy Seaborne wrote:
> Try adding a STR:
>
> SELECT (group_concat(distinct STR(?o_label_g); separator=", ") as 
> ?o_label)
>
> On 07/11/17 14:55, Mikael Pesonen wrote:
>>
>> That is true, but since language tags are stripped from literals in 
>> group_concat, I'm not sure if distinct works before of after the 
>> stripping. Should definitely work after to be more useful.
>>
>> Br,
>>
>> On 7.11.2017 16:53, Martynas Jusevičius wrote:
>>> I think that literals with the same value but different language 
>>> tags ar
>>> not identical.
>>>
>>> On Tue, Nov 7, 2017 at 3:34 PM, Mikael Pesonen 
>>> <mi...@lingsoft.fi>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> in FOAF schema there are values
>>>>
>>>> rdfs:label 
>>>> <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>>>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>>>          Agent
>>>> rdfs:label 
>>>> <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>>>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>>>          Agent _en-US
>>>>
>>>> When making query
>>>>
>>>> SELECT (group_concat(distinct ?o_label_g; separator=", ") as ?o_label)
>>>> WHERE
>>>> ...
>>>> ?o rdfs:label ?o_label_g
>>>> ...
>>>>
>>>> result for ?o_label is
>>>>
>>>> "Agent, Agent"
>>>>
>>>> and not "Agent". Is that how it should work, or should DISTINCT 
>>>> work with
>>>> language labels stripped out of the values?
>>>>
>>>> If this works how it should, is there an easy way to remove 
>>>> duplicates?
>>>>
>>>> Br,
>>>> Mikael
>>>>
>>>> -- 
>>>> Lingsoft - 30 years of Leading Language Management
>>>>
>>>> www.lingsoft.fi
>>>>
>>>> Speech Applications - Language Management - Translation - Reader's and
>>>> Writer's Tools - Text Tools - E-books and M-books
>>>>
>>>> Mikael Pesonen
>>>> System Engineer
>>>>
>>>> e-mail: mikael.pesonen@lingsoft.fi
>>>> Tel. +358 2 279 3300
>>>>
>>>> Time zone: GMT+2
>>>>
>>>> Helsinki Office
>>>> Eteläranta 10
>>>> <https://maps.google.com/?q=Etel%C3%A4ranta+10&entry=gmail&source=g>
>>>> FI-00130 Helsinki
>>>> FINLAND
>>>>
>>>> Turku Office
>>>> Kauppiaskatu 5
>>>> <https://maps.google.com/?q=Kauppiaskatu+5&entry=gmail&source=g> A
>>>> FI-20100 Turku
>>>> FINLAND
>>>>
>>>>
>>

-- 
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND


Re: distinct in SPARQL group_concat

Posted by Andy Seaborne <an...@apache.org>.
Try adding a STR:

SELECT (group_concat(distinct STR(?o_label_g); separator=", ") as ?o_label)

On 07/11/17 14:55, Mikael Pesonen wrote:
> 
> That is true, but since language tags are stripped from literals in 
> group_concat, I'm not sure if distinct works before of after the 
> stripping. Should definitely work after to be more useful.
> 
> Br,
> 
> On 7.11.2017 16:53, Martynas Jusevičius wrote:
>> I think that literals with the same value but different language tags ar
>> not identical.
>>
>> On Tue, Nov 7, 2017 at 3:34 PM, Mikael Pesonen 
>> <mi...@lingsoft.fi>
>> wrote:
>>
>>> Hi,
>>>
>>> in FOAF schema there are values
>>>
>>> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>>          Agent
>>> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>>          Agent _en-US
>>>
>>> When making query
>>>
>>> SELECT (group_concat(distinct ?o_label_g; separator=", ") as ?o_label)
>>> WHERE
>>> ...
>>> ?o rdfs:label ?o_label_g
>>> ...
>>>
>>> result for ?o_label is
>>>
>>> "Agent, Agent"
>>>
>>> and not "Agent". Is that how it should work, or should DISTINCT work 
>>> with
>>> language labels stripped out of the values?
>>>
>>> If this works how it should, is there an easy way to remove duplicates?
>>>
>>> Br,
>>> Mikael
>>>
>>> -- 
>>> Lingsoft - 30 years of Leading Language Management
>>>
>>> www.lingsoft.fi
>>>
>>> Speech Applications - Language Management - Translation - Reader's and
>>> Writer's Tools - Text Tools - E-books and M-books
>>>
>>> Mikael Pesonen
>>> System Engineer
>>>
>>> e-mail: mikael.pesonen@lingsoft.fi
>>> Tel. +358 2 279 3300
>>>
>>> Time zone: GMT+2
>>>
>>> Helsinki Office
>>> Eteläranta 10
>>> <https://maps.google.com/?q=Etel%C3%A4ranta+10&entry=gmail&source=g>
>>> FI-00130 Helsinki
>>> FINLAND
>>>
>>> Turku Office
>>> Kauppiaskatu 5
>>> <https://maps.google.com/?q=Kauppiaskatu+5&entry=gmail&source=g> A
>>> FI-20100 Turku
>>> FINLAND
>>>
>>>
> 

Re: distinct in SPARQL group_concat

Posted by Mikael Pesonen <mi...@lingsoft.fi>.
That is true, but since language tags are stripped from literals in 
group_concat, I'm not sure if distinct works before of after the 
stripping. Should definitely work after to be more useful.

Br,

On 7.11.2017 16:53, Martynas Jusevičius wrote:
> I think that literals with the same value but different language tags ar
> not identical.
>
> On Tue, Nov 7, 2017 at 3:34 PM, Mikael Pesonen <mi...@lingsoft.fi>
> wrote:
>
>> Hi,
>>
>> in FOAF schema there are values
>>
>> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>          Agent
>> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
>> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>>          Agent _en-US
>>
>> When making query
>>
>> SELECT (group_concat(distinct ?o_label_g; separator=", ") as ?o_label)
>> WHERE
>> ...
>> ?o rdfs:label ?o_label_g
>> ...
>>
>> result for ?o_label is
>>
>> "Agent, Agent"
>>
>> and not "Agent". Is that how it should work, or should DISTINCT work with
>> language labels stripped out of the values?
>>
>> If this works how it should, is there an easy way to remove duplicates?
>>
>> Br,
>> Mikael
>>
>> --
>> Lingsoft - 30 years of Leading Language Management
>>
>> www.lingsoft.fi
>>
>> Speech Applications - Language Management - Translation - Reader's and
>> Writer's Tools - Text Tools - E-books and M-books
>>
>> Mikael Pesonen
>> System Engineer
>>
>> e-mail: mikael.pesonen@lingsoft.fi
>> Tel. +358 2 279 3300
>>
>> Time zone: GMT+2
>>
>> Helsinki Office
>> Eteläranta 10
>> <https://maps.google.com/?q=Etel%C3%A4ranta+10&entry=gmail&source=g>
>> FI-00130 Helsinki
>> FINLAND
>>
>> Turku Office
>> Kauppiaskatu 5
>> <https://maps.google.com/?q=Kauppiaskatu+5&entry=gmail&source=g> A
>> FI-20100 Turku
>> FINLAND
>>
>>

-- 
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND


Re: distinct in SPARQL group_concat

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
I think that literals with the same value but different language tags ar
not identical.

On Tue, Nov 7, 2017 at 3:34 PM, Mikael Pesonen <mi...@lingsoft.fi>
wrote:

>
> Hi,
>
> in FOAF schema there are values
>
> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>         Agent
> rdfs:label <https://insight-dev.lingsoft.fi/browse.php?s=http%3A%2F%2Fw
> ww.w3.org%2F2000%2F01%2Frdf-schema%23label>
>         Agent _en-US
>
> When making query
>
> SELECT (group_concat(distinct ?o_label_g; separator=", ") as ?o_label)
> WHERE
> ...
> ?o rdfs:label ?o_label_g
> ...
>
> result for ?o_label is
>
> "Agent, Agent"
>
> and not "Agent". Is that how it should work, or should DISTINCT work with
> language labels stripped out of the values?
>
> If this works how it should, is there an easy way to remove duplicates?
>
> Br,
> Mikael
>
> --
> Lingsoft - 30 years of Leading Language Management
>
> www.lingsoft.fi
>
> Speech Applications - Language Management - Translation - Reader's and
> Writer's Tools - Text Tools - E-books and M-books
>
> Mikael Pesonen
> System Engineer
>
> e-mail: mikael.pesonen@lingsoft.fi
> Tel. +358 2 279 3300
>
> Time zone: GMT+2
>
> Helsinki Office
> Eteläranta 10
> <https://maps.google.com/?q=Etel%C3%A4ranta+10&entry=gmail&source=g>
> FI-00130 Helsinki
> FINLAND
>
> Turku Office
> Kauppiaskatu 5
> <https://maps.google.com/?q=Kauppiaskatu+5&entry=gmail&source=g> A
> FI-20100 Turku
> FINLAND
>
>