SPARQL Examples: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 4: | Line 4: | ||
PREFIX rlwdt: <https://riga-literata.wikibase.cloud/prop/direct/> | PREFIX rlwdt: <https://riga-literata.wikibase.cloud/prop/direct/> | ||
SELECT ?person ?personLabel ?genderLabel ?birthdate ?birthplaceLabel ?deathdate ?deathplaceLabel ?worklocationLabel ? | SELECT ?person ?personLabel | ||
WHERE | (GROUP_CONCAT(DISTINCT ?genderLabel; SEPARATOR="; ") AS ?gender) | ||
(GROUP_CONCAT(DISTINCT ?birthdate; SEPARATOR="; ") AS ?birthdates) | |||
?person rlwdt:P1 rlwd:Q6 | (GROUP_CONCAT(DISTINCT ?birthplaceLabel; SEPARATOR="; ") AS ?birthplace) | ||
(GROUP_CONCAT(DISTINCT ?deathdate; SEPARATOR="; ") AS ?deathdates) | |||
(GROUP_CONCAT(DISTINCT ?deathplaceLabel; SEPARATOR="; ") AS ?deathplace) | |||
(GROUP_CONCAT(DISTINCT ?worklocationLabel; SEPARATOR="; ") AS ?worklocation) | |||
(GROUP_CONCAT(DISTINCT ?wdq; SEPARATOR="; ") AS ?wdq_id) | |||
(GROUP_CONCAT(DISTINCT ?viaf; SEPARATOR="; ") AS ?viaf_id) | |||
(GROUP_CONCAT(DISTINCT ?lnc10; SEPARATOR="; ") AS ?lnc10_id) | |||
WHERE { | |||
?person rlwdt:P1 rlwd:Q6 ; | |||
OPTIONAL { ?person rlwdt:P15 ?gender.} | OPTIONAL { ?person rlwdt:P15 ?gender.} | ||
OPTIONAL { ?person rlwdt:P18 ?birthdate.} | OPTIONAL { ?person rlwdt:P18 ?birthdate.} | ||
Line 14: | Line 23: | ||
OPTIONAL { ?person rlwdt:P21 ?deathplace.} | OPTIONAL { ?person rlwdt:P21 ?deathplace.} | ||
OPTIONAL { ?person rlwdt:P31 ?worklocation.} | OPTIONAL { ?person rlwdt:P31 ?worklocation.} | ||
OPTIONAL { ?person rlwdt:P6 ? | OPTIONAL { ?person rlwdt:P6 ?wdq.} | ||
OPTIONAL { ?person rlwdt:P30 ?viaf.} | OPTIONAL { ?person rlwdt:P30 ?viaf.} | ||
OPTIONAL { ?person rlwdt:P4 ?lnc10.} | OPTIONAL { ?person rlwdt:P4 ?lnc10.} | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]". } | SERVICE wikibase:label { | ||
} | bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]" . | ||
?person rdfs:label ?personLabel . | |||
?gender rdfs:label ?genderLabel . | |||
?birthplace rdfs:label ?birthplaceLabel . | |||
?deathplace rdfs:label ?deathplaceLabel . | |||
?worklocation rdfs:label ?worklocationLabel . | |||
} | |||
} | |||
GROUP BY ?person ?personLabel | |||
ORDER BY ?personLabel | |||
</sparql> | </sparql> |
Latest revision as of 08:29, 9 February 2023
All persons with all properties
PREFIX rlwd: <https://riga-literata.wikibase.cloud/entity/>
PREFIX rlwdt: <https://riga-literata.wikibase.cloud/prop/direct/>
SELECT ?person ?personLabel
(GROUP_CONCAT(DISTINCT ?genderLabel; SEPARATOR="; ") AS ?gender)
(GROUP_CONCAT(DISTINCT ?birthdate; SEPARATOR="; ") AS ?birthdates)
(GROUP_CONCAT(DISTINCT ?birthplaceLabel; SEPARATOR="; ") AS ?birthplace)
(GROUP_CONCAT(DISTINCT ?deathdate; SEPARATOR="; ") AS ?deathdates)
(GROUP_CONCAT(DISTINCT ?deathplaceLabel; SEPARATOR="; ") AS ?deathplace)
(GROUP_CONCAT(DISTINCT ?worklocationLabel; SEPARATOR="; ") AS ?worklocation)
(GROUP_CONCAT(DISTINCT ?wdq; SEPARATOR="; ") AS ?wdq_id)
(GROUP_CONCAT(DISTINCT ?viaf; SEPARATOR="; ") AS ?viaf_id)
(GROUP_CONCAT(DISTINCT ?lnc10; SEPARATOR="; ") AS ?lnc10_id)
WHERE {
?person rlwdt:P1 rlwd:Q6 ;
OPTIONAL { ?person rlwdt:P15 ?gender.}
OPTIONAL { ?person rlwdt:P18 ?birthdate.}
OPTIONAL { ?person rlwdt:P20 ?birthplace.}
OPTIONAL { ?person rlwdt:P19 ?deathdate.}
OPTIONAL { ?person rlwdt:P21 ?deathplace.}
OPTIONAL { ?person rlwdt:P31 ?worklocation.}
OPTIONAL { ?person rlwdt:P6 ?wdq.}
OPTIONAL { ?person rlwdt:P30 ?viaf.}
OPTIONAL { ?person rlwdt:P4 ?lnc10.}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en,[AUTO_LANGUAGE]" .
?person rdfs:label ?personLabel .
?gender rdfs:label ?genderLabel .
?birthplace rdfs:label ?birthplaceLabel .
?deathplace rdfs:label ?deathplaceLabel .
?worklocation rdfs:label ?worklocationLabel .
}
}
GROUP BY ?person ?personLabel
ORDER BY ?personLabel