User:Iwan.Aucamp/Ops
Jump to navigation
Jump to search
Try it!
000
[edit]SELECT DISTINCT ?item ?itemLabel ?guid ?ref ?refProp ?refValue {
?item wdt:P31 wd:Q171947.
?item p:P31 ?guid.
?guid ps:P31 wd:Q171947.
OPTIONAL {
?guid prov:wasDerivedFrom ?ref .
?ref ?refProp ?refValue.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
wd sparql --json <(echo 'SELECT DISTINCT ?item ?guid ?ref ?refProp ?refValue { ?item wdt:P31 wd:Q171947 . ?item p:P31 ?guid . ?guid ps:P31 wd:Q171947 OPTIONAL { ?guid prov:wasDerivedFrom ?ref . ?ref ?refProp ?refValue. } }') | jq -r '.[] | [.item, .guid, .ref.prop, .ref.value] | @tsv'
wd sparql --json <(echo 'SELECT DISTINCT ?item ?guid ?ref ?refProp ?refValue { ?item wdt:P31 wd:Q171947 . ?item p:P31 ?guid . ?guid ps:P31 wd:Q171947 OPTIONAL { ?guid prov:wasDerivedFrom ?ref . ?ref ?refProp ?refValue. } }') | jq -r '.[] | [.item, .ref.prop, .ref.value] | @tsv' | sed -E -e 's:\S+/(entity|reference)/::g'