579
edits
(→Dates) |
|||
Line 1,683: | Line 1,683: | ||
</sparql> | </sparql> | ||
=== | === Compare uses of item v free text === | ||
<sparql tryit="1"> | <sparql tryit="1"> | ||
Line 1,728: | Line 1,728: | ||
} | } | ||
order by ?qual_label ?prop_label ?itemLabel | order by ?qual_label ?prop_label ?itemLabel | ||
</sparql> | |||
=== Missing language labels === | |||
<sparql tryit="1"> | |||
# query to find small number of items/properties which don't have en-gb labels | |||
# this causes problems when needing to get labels without using SERVICE, or can't rely on AUTO_LANGUAGE | |||
PREFIX bnwd: <https://beyond-notability.wikibase.cloud/entity/> | |||
PREFIX bnwds: <https://beyond-notability.wikibase.cloud/entity/statement/> | |||
PREFIX bnwdv: <https://beyond-notability.wikibase.cloud/value/> | |||
PREFIX bnwdt: <https://beyond-notability.wikibase.cloud/prop/direct/> | |||
PREFIX bnp: <https://beyond-notability.wikibase.cloud/prop/> | |||
PREFIX bnps: <https://beyond-notability.wikibase.cloud/prop/statement/> | |||
PREFIX bnpq: <https://beyond-notability.wikibase.cloud/prop/qualifier/> | |||
PREFIX bnpsv: <https://beyond-notability.wikibase.cloud/prop/statement/value/> | |||
PREFIX bnpqv: <https://beyond-notability.wikibase.cloud/prop/qualifier/value/> | |||
SELECT | |||
?item ?engb ?itemLabel | |||
(group_concat(distinct ?language) as ?languages) | |||
(count(distinct ?rdfs_label) as ?count) # TIL: where you put distinct matters! | |||
WHERE { | |||
?item bnwdt:P12 ?s. # limit to items with instance of. speeds up the query a lot cf. fetching anything. | |||
#?item ?p ?s. # anything. takes a while, adds ~20 not found in the instance of version | |||
#filter not exists { ?item bnwdt:P12 ?s . } # errrm why doesn't this do anything? | |||
?item rdfs:label ?rdfs_label . # rdfs item label (1 per language). | |||
BIND(LANG(?rdfs_label) as ?language) . # get 2 letter language codes | |||
# optional to fetch en-gb (and/or) en separately | |||
optional { ?item rdfs:label ?engb . filter(lang(?engb)="en-gb"). } # blank if item only has en label | |||
#optional { ?item rdfs:label ?en . filter(lang(?en)="en"). } | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb,en". } | |||
} | |||
group by ?item ?engb ?itemLabel | |||
HAVING (?count<2) | |||
order by ?item | |||
</sparql> | </sparql> |
edits