Page MenuHomePhabricator

Create WDQS service for snak / reference hashes
Closed, DeclinedPublic

Description

As I understand it the only way to query for a reference is to use the hash of said reference (example below)

SELECT ?s WHERE {?s prov:wasDerivedFrom wdref:7b7e7e8cce78cd60ee82a71ffa3dc6b063a9d37c}

Would it be possible to create a service that could create this hash from another query?
The creation of the hash can be found in the DataModel component https://github.com/wmde/WikibaseDataModel

My usecase for this is running the following query that lists all instance of language version of wikipedia

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>

SELECT ?wiki ?wikiLabel WHERE {
   ?wiki  wdt:P31 wd:Q10876391 . 

  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
   }
}

And then be able to get hashes from these and look for statements that are references using P143 -> (item id from the first query)

As I said I have no idea if this is possible so this ticket is a proposal / question as to if it can be done!

Event Timeline

Addshore raised the priority of this task from to Needs Triage.
Addshore updated the task description. (Show Details)
Addshore subscribed.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald Transcript

You can get reference hashes for objects using the http://www.wikidata.org/prop/reference/ predicate.

For example,

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX prov: <http://www.w3.org/ns/prov#>

SELECT (count(distinct(?s)) AS ?scount) WHERE {
  ?wds wdt:P31 wd:Q10876391 . 
  ?wdref <http://www.wikidata.org/prop/reference/P143> ?wds . 
  ?s prov:wasDerivedFrom ?wdref .
}

This returns a count of 16,266,065 statements with the "Imported From a Wikipedia" style reference (from http://wdm-rdf.wmflabs.org)

Addshore claimed this task.

Okay, closing as not needed.
I look like the queries with the ref hash and the thing about take the same time to execute too