query-430b40c38ddb3a18f86c3ea0b53a834a
Dipsacus fullonum
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX prov: <http://www.w3.org/ns/prov#>
SELECT ?item ?property ?value ?unit ?pq ?qualifier_value ?qualifier_unit ?ref ?pr ?rval
WHERE
{
VALUES ?item { wd:Q658 }
VALUES ?property { wd:P2054 }
?property wikibase:claim ?claim .
# Get amount and unit for the statement
?item ?claim ?statement .
{
?property wikibase:propertyType ?property_type .
FILTER (?property_type != wikibase:Quantity)
?property wikibase:statementProperty ?propertyStatement .
?statement ?propertyStatement ?value .
}
UNION
{
?property wikibase:statementValue ?statementValue .
?statement ?statementValue [wikibase:quantityAmount ?value; wikibase:quantityUnit ?unit] .
}
# Get qualifiers
OPTIONAL
{
{
# Get simple values for qualifiers which are not of type quantity
?statement ?propQualifier ?qualifier_value .
?pq wikibase:qualifier ?propQualifier .
?pq wikibase:propertyType ?qualifer_property_type .
FILTER (?qualifer_property_type != wikibase:Quantity)
}
UNION
{
# Get amount and unit for qualifiers of type quantity
?statement ?pqv [wikibase:quantityAmount ?qualifier_value; wikibase:quantityUnit ?qualifier_unit] .
?pq wikibase:qualifierValue ?pqv .
}
}
# get references
OPTIONAL {
?statement prov:wasDerivedFrom ?ref .
?ref ?pr ?rval .
[] wikibase:reference ?pr
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?claim")
v1("?item"):::projected
v13("?pq"):::projected
v15("?pqv")
v17("?pr"):::projected
v11("?propQualifier")
v2("?property"):::projected
v6("?propertyStatement")
v5("?property_type")
v10("?qualifer_property_type")
v14("?qualifier_unit"):::projected
v12("?qualifier_value"):::projected
v16("?ref"):::projected
v18("?rval"):::projected
v4("?statement")
v8("?statementValue")
v9("?unit"):::projected
v7("?value"):::projected
a3((" "))
a1((" "))
a2((" "))
bind0[/VALUES ?item/]
bind0-->v1
bind00(["wd:Q658"])
bind00 --> bind0
bind1[/VALUES ?property/]
bind1-->v2
bind10(["wd:P2054"])
bind10 --> bind1
v2 --"wikibase:claim"--> v3
v1 -->v3--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v2 --"wikibase:statementValue"--> v8
a1 --"wikibase:quantityAmount"--> v7
a1 --"wikibase:quantityUnit"--> v9
v4 -->v8--> a1
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f2[["?property_type != 'wikibase:Quantity'"]]
f2 --> v5
v2 --"wikibase:propertyType"--> v5
v2 --"wikibase:statementProperty"--> v6
v4 -->v6--> v7
end
union0r <== or ==> union0l
end
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
a2 -."wikibase:quantityAmount".-> v12
a2 --"wikibase:quantityUnit"--> v14
v4 -->v15--> a2
v13 --"wikibase:qualifierValue"--> v15
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
f3[["?qualifer_property_type != 'wikibase:Quantity'"]]
f3 --> v10
v4 -->v11--> v12
v13 --"wikibase:qualifier"--> v11
v13 --"wikibase:propertyType"--> v10
end
union1r <== or ==> union1l
end
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."prov:wasDerivedFrom".-> v16
v16 -->v17--> v18
a3 --"wikibase:reference"--> v17
end