Page MenuHomePhabricator

(MS 6) Filter by references
Closed, ResolvedPublic8 Estimated Story Points

Description

As an editor I want to query for data based on existence of references.

Problem:
We currently don't allow querying for statements with references or without references.

Example:

  • All items that are instance of human and have date of birth statement without the reference.

mockup

image.png (590×1 px, 69 KB)

BDD
GIVEN a visual query
WHEN restricting your condition to statements without references
THEN the output only contains results with statements lacking references for that statement

GIVEN a visual query
WHEN restricting your condition to statements with references
THEN the output only contains results with statements having references for that statement

Acceptance criteria:

  • Filter for statements with/without references is applied when selected
  • Default to "with and without references"

SPARQL example for only with references:

SELECT DISTINCT ?item ?itemLabel ?reference WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
  {
    SELECT DISTINCT ?item WHERE { ?item p:P31 ?statement.
                                ?statement ps:P31/wdt:P279* wd:Q482994. 
                                 FILTER EXISTS { ?statement prov:wasDerivedFrom ?reference. }
    }
    LIMIT 100
  }
}

Open questions:

Event Timeline

Lydia_Pintscher set the point value for this task to 8.
Lydia_Pintscher moved this task from Backlog to Ready to pick up on the Wikidata Query Builder board.
amy_rc claimed this task.

🌸 Tested querying with references only and without references only 🎉 \o/