Since T251008: Queries endpoint support for Property columns with qualifier, we have working drill-down queries for qualifier columns.
Qualifier columns (P1/P2 and P1/Q2/P3) currently use FILTER(EXISTS {...}) in the info query, which counts an entity as covered if at least one matching statement has the qualifier.
This is not quite correct for gapfinding purposes: if an entity has multiple matching statements and only some have the qualifier, the entity should be flagged as incomplete.
Use cases include political positions or award received. For example:
- with P166/Q187300/P585 (Prix Goncourt, point in time): if someone won the prize twice but only one statement has a date,
- with P39/P580 (position held, start time): if someone held three positions but only one has a start date
In both cases, they are currently counted as covered.
Current behaviour:
FILTER(EXISTS { ?entity p:P1 [ pq:P2 [] ] })
"At least one P1 statement has P2" → optimistic percentage.
Potential new behaviour:
FILTER NOT EXISTS { ?entity p:P1 ?stmt . FILTER NOT EXISTS { ?stmt pq:P2 [] } }
"Every P1 statement has P2" → entity only counts as covered if all relevant statements have the qualifier.
This applies to both P1/P2 and P1/Q2/P3 column syntax.
One thing to keep in mind is the consistency between the counts displayed in the table and the drill-down queries:
All three queries must use consistent semantics for the numbers to add up. If the cell displays "30% (3)" and the total is 10, the positive query should return 3 entities and the negative query 7.
- Info query (counting): entity is covered ↔ all relevant statements have the qualifier
- Positive query: show entities where all relevant statements have the qualifier
- Negative query: show entities where at least one relevant statement lacks the qualifier (already correct)
The positive query would change from "find a statement with the qualifier" to "entity has the property AND has no statement lacking the qualifier" − maybe something like
?entity p:P1 ?statement . { ?statement pq:P2 ?value . } UNION { ?statement a wdno:P2 . BIND("no value"@en AS ?valueLabel) } FILTER NOT EXISTS { ?entity p:P1 ?stmt2 . FILTER NOT EXISTS { ?stmt2 pq:P2 [] } }