query-454d105608e2ba9661c49318a849043d
Tool: wbi_fastrun _query_data SELECT ?sid ?item ?v ?unit ?pq ?qval ?qunit WHERE { ?item http://www.wikidata.org/prop/direct/P699 ?zzP699 .
# Get statement ID and the simple value for the statements ?item http://www.wikidata.org/prop/P31 ?sid . ?sid http://www.wikidata.org/prop/statement/P31 ?v .
# Get the optional unit for statements with a quantity value OPTIONAL { ?sid http://www.wikidata.org/prop/statement/value/P31 / wikibase:quantityUnit ?unit . }
# Get qualifiers OPTIONAL { { # Get simple values for qualifiers which are not of type quantity ?sid ?propQualifier ?qval . ?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 ?sid ?pqv [wikibase:quantityAmount ?qval; wikibase:quantityUnit ?qunit] . ?pq wikibase:qualifierValue ?pqv . } } } ORDER BY ?sid OFFSET 0 LIMIT 10000
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
#Tool: wbi_fastrun _query_data
SELECT ?sid ?item ?v ?unit ?pq ?qval ?qunit
WHERE
{
?item <http://www.wikidata.org/prop/direct/P699> ?zzP699 .
# Get statement ID and the simple value for the statements
?item <http://www.wikidata.org/prop/P31> ?sid .
?sid <http://www.wikidata.org/prop/statement/P31> ?v .
# Get the optional unit for statements with a quantity value
OPTIONAL
{
?sid <http://www.wikidata.org/prop/statement/value/P31> / wikibase:quantityUnit ?unit .
}
# Get qualifiers
OPTIONAL
{
{
# Get simple values for qualifiers which are not of type quantity
?sid ?propQualifier ?qval .
?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
?sid ?pqv [wikibase:quantityAmount ?qval; wikibase:quantityUnit ?qunit] .
?pq wikibase:qualifierValue ?pqv .
}
}
} ORDER BY ?sid OFFSET 0 LIMIT 10000