query-5fdbf1d66802e5570f562f8c61cd9f44
Dump value node(s) given a Q-item and optionally a property. SELECT ?statement ?valnode ?predicate ?value ?valueLabel WHERE { VALUES (?item ?itempredicate) { (wd:Q42 UNDEF) } #VALUES (?item ?itempredicate) { (wd:Q42 p:P2048) } ?item ?itempredicate ?statement . [] wikibase:claim ?itempredicate .
?statement ?stpredicate ?valnode . [] wikibase:qualifierValue|wikibase:statementValue ?stpredicate . ?valnode ?predicate ?value .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } } ORDER BY ?statement ?valnode ?predicate
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Dump value node(s) given a Q-item and optionally a property.
SELECT ?statement ?valnode ?predicate ?value ?valueLabel
WHERE {
VALUES (?item ?itempredicate) { (wd:Q42 UNDEF) }
#VALUES (?item ?itempredicate) { (wd:Q42 p:P2048) }
?item ?itempredicate ?statement .
[] wikibase:claim ?itempredicate .
?statement ?stpredicate ?valnode .
[] wikibase:qualifierValue|wikibase:statementValue ?stpredicate .
?valnode ?predicate ?value .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
ORDER BY ?statement ?valnode ?predicate
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v4("?item")
v5("?itempredicate")
v3("?predicate"):::projected
v1("?statement"):::projected
v6("?stpredicate")
v2("?valnode"):::projected
v7("?value"):::projected
a1((" "))
a2((" "))
c5(["bd:serviceParam"]):::iri
c7(["en"]):::literal
bind0[/VALUES ?item ?itempredicate/]
bind0-->v4
bind0-->v5
bind00(["wd:Q42"])
bind00 --> bind0
bind01([ERROR: Bad value])
bind01 --> bind0
v4 -->v5--> v1
a1 --"wikibase:claim"--> v5
v1 -->v6--> v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
a2 --"wikibase:statementValue"--> v6
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
a2 --"wikibase:qualifierValue"--> v6
end
union0r <== or ==> union0l
end
v2 -->v3--> v7
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end