Yes, the property is linked to all its predicates, e. g. wikibase:directClaim for the wdt: version or wikibase:claim for the p: version. In this query I’m using wikibase:claim instead of wikibase:directClaim to ensure that all statements are counted, not just best-rank ones:
SELECT ?property (COUNT(?statement) AS ?count) WHERE { ?property p:P2302/ps:P2302 wd:Q52712340; wikibase:claim ?p. ?entity ?p ?statement. } GROUP BY ?property ORDER BY DESC(?count)
mw:Wikibase/Indexing/RDF_Dump_Format has longer lists of these predicates, in the Properties [1] and Predicates [2] sections.
Cheers, Lucas
[1]: https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Properties [2]: https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Predicates
On 9/3/18 7:54 PM, Adrian Bielefeldt wrote:
Hello everyone,
I have the following pattern in a SPARQL query:
?s ps:P2302 wd:Q52712340. ?item p:P2302 ?s.
It should give me all properties constrained by a specific constraint, which works. Based on this I would like to find out how many statements have these properties. However, ?item has the wd-prefix. To use it in
?subject ?item ?object,
I would need to "transform" it into the same ID but with the wdt-prefix. Is this possible in any way?
Greetings
Adrian
Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata