query-f4d8240a6c6472908a19147bdcb343bb
P: Properties for a set of itemsI'm wanting to get a report of all properties (but ideally not sitelinks, labels, etc ... just P: type properties) for a set of ?items. Clearly the report below doesn't cut it, and nor does my SPARQL... 17:09, 18 April 2018 (UTC)) talk (TagishsimonIn fact, two main improvements I'm after: 1) limit results to P: and 2) provide a property label (e.g. "School"). thx --
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?property ?propertyLabel ?value ?valueLabel WHERE {
VALUES ?item { wd:Q13392468 wd:Q13551426 }
?property wikibase:directClaim ?wdt . # for each ?property=wd:Pxxx there is ?wdt=wdt:Pxxx; see https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Predicates for other interesting predicates than wikibase:directClaim
?item ?wdt ?value .
SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?item"):::projected
v2("?property"):::projected
v4("?value"):::projected
v3("?wdt")
c3(["bd:serviceParam"]):::iri
c5(["en"]):::literal
bind0[/VALUES ?item/]
bind0-->v1
bind00(["wd:Q13392468"])
bind00 --> bind0
bind01(["wd:Q13551426"])
bind01 --> bind0
v2 --"wikibase:directClaim"--> v3
v1 -->v3--> v4
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end