Stefano
Stefano

Reputation: 301

Wikidata labels resolved in SPARQL query browser but not with GET request

I run this query in the Wikidata query browser:

SELECT ?child ?childLabel
WHERE
{
# ?child  father   Bach
  ?child wdt:P22 wd:Q1339.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

The results are as expected, a table with the names of Bach's children. However, if I use the URL provided by the Code facility I get unresolved Q codes for the children rather than their names. Also, if I ask for the description like this:

SELECT ?child ?childLabel ?childDescription
WHERE
{
# ?child  father   Bach
  ?child wdt:P22 wd:Q1339.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}

I get the description in the table produced by the query browser, but not if I use the URL provided but the Code service.

I have seen questions suggesting intricacies in the wikibase labeling service, but I don't understand the topic enough to make sense of the answer.

Any help greatly appreciated!

Upvotes: 2

Views: 155

Answers (1)

Stanislav Kralin
Stanislav Kralin

Reputation: 11459

From User Manual:

The Wikidata Query Service website auto-magically replaces [AUTO_LANGUAGE] with the language code of current user's interface. For example, if the user's UI is in French, the SPARQL's code bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" will be converted to bd:serviceParam wikibase:language "fr,en" before being sent to the query service.

The server doesn't know what is [AUTO_LANGUAGE]. Replace [AUTO_LANGUAGE] with en.

More info


And yes, The word "AUTO" is too broad and confusing.

Upvotes: 4

Related Questions