Q687075 Prime minister of Sweden
select ?person ?personLabel ?replaceLabel ?replacedbyLabel ?start ?end ?pic ?WikiTreeID{
{
?person wdt:P39 wd:Q687075;
p:P39 [
ps:P39 wd:Q687075;
pq:P580 ?start;
pq:P582 ?end;
pq:P1365 ?replace; #Replace
pq:P1366 ?replacedby #Replaced by
].
OPTIONAL { ?person wdt:P2949 ?WikiTreeID .} # If we have a WikiTree profile
OPTIONAL{ ?person wdt:P18 ?pic .} # If we have an illustration
BIND (URI(CONCAT("http://www.wikitree.com/wiki/",?WikiTreeID)) AS ?WikiTree)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}
Simple query
select ?person ?personLabel ?personDescription ?pic ?WikiTreeID{{
?person wdt:P39 wd:Q687075.
OPTIONAL { ?person wdt:P2949 ?WikiTreeID .} # If we have a WikiTree profile
OPTIONAL{ ?person wdt:P18 ?pic .} # If we have an illustration
BIND (URI(CONCAT("http://www.wikitree.com/wiki/",?WikiTreeID)) AS ?WikiTree)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}
Order by ?end
Simple query returning people in WikiTree
select ?person ?personLabel ?personDescription ?pic ?WikiTreeID{{
?person wdt:P39 wd:Q687075.
{ ?person wdt:P2949 ?WikiTreeID .} # If we have a WikiTree profile
OPTIONAL{ ?person wdt:P18 ?pic .} # If we have an illustration
BIND (URI(CONCAT("http://www.wikitree.com/wiki/",?WikiTreeID)) AS ?WikiTree)
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}
Order by ?end
Returning people not linked to WikiTree
# Query Find in WikiData people with position held P39 Swedish Prime minister Q687075#
#select ?person ?personLabel ?personDescription ?WikiTreeID ?WikiTree ?replaceLabel ?replacedbyLabel ?start ?end ?pic{
select ?person ?personLabel ?personSeacription ?pic ?WikiTreeID{
{
?person wdt:P39 wd:Q687075.
OPTIONAL{ ?person wdt:P18 ?pic .} # If we have an illustration
MINUS { ?person wdt:P2949 ?WikiTreeID .} # If we have a WikiTree profile
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en"}
}
Order by ?end
Inga kommentarer:
Skicka en kommentar