A set of SPARQL examples that are used in different TGX resources
License: https://www.gnu.org/licenses/gpl-3.0
Uses method in: https://github.com/WDscholia/scholia/tree/master/scholia/app/templates/complex_participants.sparql
Complex aspect: participants
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q90012272>
SELECT ?quantity ?part ?partLabel ?partDescription ?type
WITH {
SELECT ?part ?quantity (GROUP_CONCAT(DISTINCT ?type_label; separator=", ") AS ?type)
WHERE {
VALUES ?complex { target: }
?complex p:P527 ?partStatement .
?partStatement ps:P527 ?part .
OPTIONAL { ?partStatement pq:P1114 ?quantity }
OPTIONAL {
?part wdt:P31 ?type_ .
?type_ rdfs:label ?type_label .
FILTER (LANG(?type_label) = 'en')
}
} GROUP BY ?part ?quantity
} AS %result
WHERE {
INCLUDE %result
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
} ORDER BY ASC(?partLabel)
graph TD