Thanks Richard, it works. But the SPARQL(with CONCAT) fails to return
expected preferred labels, when a language is specified in SPARQL and the
concept(s) doesn't have that language's preferred label in the vocabulary.
*Example:*
BIND(CONCAT( search:nestedObjectsList(?result, skos:prefLabel, "result",
?none, "en") , search:nestedObjectsList(?result, skos:prefLabel, "result",
?none, "*ko*")) AS ?preferredlabel)
In this example English and Korean Languages are specified. What is
expected here is to return the English language preferred label and/or
Korean language preferred label, based on the those languages preferred
labels availability in the vocabulary. But zero/empty results are returned
for the preferred language column for all the concepts (please check the
below screen shot). This might be because that the concepts doesn't have
Korean language preferred labels in the Geography vocabulary.
Why am I trying this is, in our actual vocabulary all concepts don't have
the same number of languages for preferred labels. For example, some
concepts have only English language preferred labels and other concepts
have different languages preferred labels also. In this case, the
SPARQL(with CONCAT) returns zero/empty results for the preferred language
column for the concept(s), which doesn't have the preferred label for
language, which is specified in the SPARQL(with CONCAT).
So, I just want to check, in this scenario, what could be the best way
write the SPARQL to fetch preferred labels?
Thanks,
sanjeev
On Tuesday, August 22, 2017 at 5:08:51 PM UTC+5:30, Richard Cyganiak wrote:
>
> Hi Sanjeev,
>
> search:nestedObjectsList has an extra undocumented fifth argument that
> specifies a language. So you can do something like:
>
> *BIND* (search:nestedObjectsList(?result, skos:prefLabel, "result",
> ?none, "en") *AS* ?preferredlabel) .
>
> This would only return English results. The argument is just a single
> language tag. To get English and French, you could get both separately, and
> string-concatenate the results.
>
> Hope that helps,
> Richard
>
>
> On 22 Aug 2017, at 11:11, sanjeev devireddy <[email protected]
> <javascript:>> wrote:
>
> Hi,
> The below SPARQL returns preferred labels of all languages available in
> the vocabulary by default(please check the below SPARQL). When I try FILTER
> to get only specific languages preferred labels then it doesn't
> return/place all those resulted preferred labels of a concept in a single
> row. Could some one please help?
>
>
>
>
> *SPARQL*SELECT DISTINCT ?result ?label ?latitude ?preferredlabel
> WHERE {
> GRAPH <urn:x-evn-master:geo> {
> {
> ?result a <http://topquadrant.com/ns/examples/geography#Continent>
> .
> } .
> BIND (search:nestedObjectsList(?result, geo:lat, "result") AS
> ?latitude) .
> BIND (search:nestedObjectsList(?result, skos:prefLabel, "result") AS
> ?preferredlabel) .
> BIND (ui:label(?result) AS ?label) .
> }
> }
> ORDER BY (LCASE(?label))
>
>
>
> *FYI..*
>
> <Auto Generated Inline Image 1.png>
>
>
>
>
>
> *Using FILTER (FILTER(lang(?preferredlabel) = "en" ||
> lang(?preferredlabel) = "fr"))<Auto Generated Inline Image 2.png>*
>
> Thanks,
> sanjeev
>
> --
> You received this message because you are subscribed to the Google Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
> <Auto Generated Inline Image 1.png><Auto Generated Inline Image 2.png>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.