Some degree of fuzzyness cannot be avoided because concepts change over time and have slightly different meanings in different contexts and Wikipedia editions. To summarize the example, we have three kinds of items plus the most common superclass of all identifiers:
How to query all individual identifiers?
?individualID wdt:P31 ?idSystem
How to query all postal code systems?
?idSystem wdt:P279 wd:Q37447 ; wdt:P31 "identifier system"
How to query all identifier systems?
?idSystem wdt:P279* wd:6545185 ; wdt:P31 "identifier system"
How to query all types of identifiers?
?idType wdt:P279* wd:6545185 FILTER NOT EXISTS { ?idSystem wdt:P31 "identifier system" }
I find this solution more difficult to apply and to make use of. As far as I now, the FILTER NOT EXISTS
clause cannot be used in Lua Templates. With my current approach this is easier:
How to query all individual identifiers?
?individualID wdt:P361 ?idSystem
(part-of)
How to query all postal code systems?
?idSystem wdt:P31 wd:Q37447
(instance)
How to query all identifier systems?
?idSystem wdt:P31/wd:P279* wd:6545185
How to query all types of identifiers?
?idType wdt:P279* wd:6545185
<nowiki>Maybe adding another property can help? Checking for the (non-)existence of two statements is too fragile to get reliable results. We could create a sub-property of P31 or P279 to use, this is also applied for taxon data (taxon rank (P105), parent taxon (P171)...).
tl;dr: we cannot have both of the follwing statements, one must be changed or there is no easy way to tell that ZIP code (Q136208) is a concrete identifier system instead of a general class of multiple systems with possibly overlapping or identifier-values: