Project:SPARQL/examples: Difference between revisions
From Beyond Notability
Line 1: | Line 1: | ||
==Examples== | ==Examples== | ||
===Women in the wiki | ===Women in the wiki (excluding the project team) and their corresponding IDs - where they exist - on wikidata and the Archaeology Data Service=== | ||
<sparql tryit="1"> | <sparql tryit="1"> | ||
Line 11: | Line 11: | ||
PREFIX bnps: <http://beyond-notability.wiki.opencura.com/prop/statement/> | PREFIX bnps: <http://beyond-notability.wiki.opencura.com/prop/statement/> | ||
PREFIX bnpq: <http://beyond-notability.wiki.opencura.com/prop/qualifier/> | PREFIX bnpq: <http://beyond-notability.wiki.opencura.com/prop/qualifier/> | ||
PREFIX wdt: <http://www.wikidata.org/prop/direct/> | |||
PREFIX wd: <http://www.wikidata.org/entity/> | |||
SELECT ?person ?personLabel | SELECT ?person ?personLabel ?wikiurl ?ADSid ?ADSurl | ||
WHERE { | WHERE { | ||
?person bnwdt:P3 bnwd:Q3 . | ?person bnwdt:P3 bnwd:Q3 . #select women | ||
FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} | FILTER NOT EXISTS {?person bnwdt:P4 bnwd:Q12 .} #filter out project team | ||
OPTIONAL {?person bnwdt:P14 ?wikiurl . #look for wikidata URL on person page | |||
FILTER regex(?wikiurl, "wikidata", "i")} #filter just in case P14 used to point to non-wikidata service | |||
OPTIONAL {?person bnp:P34 ?ADSstatement . #look for Archaeology Data Service ID on person page | |||
?ADSstatement bnps:P34 ?ADSid . #return ADS id | |||
?ADSstatement bnpq:P14 ?ADSurl .} #return ADS url | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en-gb". } | ||
} | } | ||
ORDER BY ?personLabel | |||
</sparql> | </sparql> | ||