query-ec77ddd5793da5bfd570ab1bf80646f0

rq turtle/ttl

Qualifiers and references. You need to stare at this until it makes sense, no matter how long it takes :) data model diagramGetting qualifier or reference data for properties of items is a bit confusing until it clicks. The key to the whole thing (for me, at least) is the Getting a property value is easy. You ask the report service for the wdt: value. You can see that on the diagram - start in the item circle, follow the wdt: arrow line, and arrive at the simple value. You can also see from the same diagram that there's nowhere you can go from the simple value; you are at journey's end. If you want a Property Qualifier, you need to ask for a pq: value. To do that, you need to follow the path from the item circle to the statement circle using the p: path. From the statement circle you can then take a variety of paths, such as the ps: path (which will give you the same value as the wdt: path did) or the pq: path which will give you the simple value for the qualifier. The statement itself is just a long & unique URI cobbled together by wikidata, the only purpose of which is to allow things like qualifiers to be hung from it. items: YYYY Sweet Adelines International chorus competitionSo in report terms, it looks kinda like this (and here I'm reporting on the set of Wittylama. You need to stare at this until it makes sense, no matter how long it takes :) data model diagramGetting qualifier or reference data for properties of items is a bit confusing until it clicks. The key to the whole thing (for me, at least) is the Getting a property value is easy. You ask the report service for the wdt: value. You can see that on the diagram - start in the item circle, follow the wdt: arrow line, and arrive at the simple value. You can also see from the same diagram that there's nowhere you can go from the simple value; you are at journey's end. If you want a Property Qualifier, you need to ask for a pq: value. To do that, you need to follow the path from the item circle to the statement circle using the p: path. From the statement circle you can then take a variety of paths, such as the ps: path (which will give you the same value as the wdt: path did) or the pq: path which will give you the simple value for the qualifier. The statement itself is just a long & unique URI cobbled together by wikidata, the only purpose of which is to allow things like qualifiers to be hung from it. , but the principle is the same): Q7386689#P2522 items, rather than on items of winners such as YYYY Sweet Adelines International chorus competitionSo in report terms, it looks kinda like this (and here I'm reporting on the set of

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel (year(?when) as ?year) ?winnerLabel ?score
WHERE 
{
  ?item wdt:P31 wd:Q57776091.  # the item is an instance of a Sweet Adelines International chorus competition
  ?item wdt:P585 ?when.        # it has a when statement
  ?item p:P1346 ?statement.    # it has a p: value for P1346, which points to a statement - the unique URI
  ?statement ps:P1346 ?winner. # the statement has a ps: value i.e. the winner's identity
  ?statement pq:P1351 ?score.  # the statement has a pq:P1351 value, which is the score
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} order by desc(?year)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v6("?score"):::projected v4("?statement") v3("?when"):::projected v5("?winner") v7("?year") c2(["wd:Q57776091"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> c2 v2 --"p:direct/P585"--> v3 v2 --"p:P1346"--> v4 v4 --"p:statement/P1346"--> v5 v4 --"p:qualifier/P1351"--> v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end bind0[/"year-from-dateTime(?when)"/] v3 --o bind0 bind0 --as--o v7