Page MenuHomePhabricator

Occupations of Q5603 does not all show in query result
Closed, InvalidPublic

Description

Problem:

  • The query does not return all the occupations of Q5603

List of steps to reproduce (step by step, including full links if applicable):

  • Run the following query in the query service
SELECT DISTINCT ?occupation ?occupationLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  { SELECT DISTINCT ?occupation WHERE { wd:Q5603 wdt:P106 ?occupation. } }
}

What happens?:

  • Only one occupation(wd:Q3391743 visual artist) is returned

What should have happened instead?:

  • Q5603 has more than 10 occupations shown on the wikidata page and they should all be shown in the query result.

Browser information, screenshots/mockups, other information, etc. (if applicable):

  • Wikidata page

image.png (910×434 px, 45 KB)

  • Query and result

image.png (610×794 px, 63 KB)

Related Objects

Event Timeline

Mahir256 closed this task as Invalid.EditedNov 7 2021, 9:25 PM
Mahir256 subscribed.

Per https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Truthy_statements, "Truthy statement predicates have prefix wdt: with the property name (e.g. wdt:P2)" and "[I]f there is a preferred statement for property P2, then only preferred statements for P2 will be considered truthy. Otherwise, all normal-rank statements for P2 are considered truthy." As your screenshot indicates, "visual artist" is a preferred occupation statement (the little shaded up arrow on the left) and the other occupations are normal-rank statements (the little shaded dot between the two blank arrows).

If you wanted to obtain the objects of *all* "occupation" statements, you might revise your query to

SELECT DISTINCT ?occupation ?occupationLabel WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  { SELECT DISTINCT ?occupation WHERE { wd:Q5603 p:P106/ps:P106 ?occupation. } }
}

Note the use of "p:P106/ps:P106", where "p:P106" links from an item to the P106 statement object (containing its rank, value, qualifiers, and references), and where "ps:P106" links from a P106 statement object to its value.