1

What I want to get is the labels including alt labels. Some of the strings has comma, which is used as a delimeter as well, So I'd like to find out how to get all the individual items properly.

    SELECT DISTINCT ?e ?eLabel ?eAltLabel ?eDescription 
    WHERE {
    { ?e rdfs:label "Apple"@en }
    UNION
    { ?e skos:altLabel "Apple"@en }

    SERVICE wikibase:label { bd:serviceParam wikibase:language "ko,en". }.
    }

The first result of the query is Apple (computer), and shows us eAltLabel like below.

Apple, Apple Computer, Apple Computer Inc, Apple Computer, Inc.

After getting the result, I split this string using , as a delimeter.

Apple
Apple Computer
Apple Computer Inc
Apple Computer
Inc.

which is different from what I expected. This is because I consider , on the right after Apple computer as delimeter. I want to get the last one like Apple Computer, Inc., the full phrase.

How can I disambiguate each label respectively when the labels entail , inside? How can I change the sparql?

Keanu Paik
  • 304
  • 2
  • 12
  • 1
    Possible duplicate of [Parsing returns from AltLabel in a SPARQL query](https://stackoverflow.com/questions/51520591/parsing-returns-from-altlabel-in-a-sparql-query) – Stanislav Kralin Oct 10 '19 at 17:32

0 Answers0