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/event-series_people.sparql
Event-series aspect: people
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX target: <http://www.wikidata.org/entity/Q47501052>
SELECT
?number_of_roles
# (?number_of_publications AS ?works)
?person ?personLabel ?personDescription
(CONCAT("/author/", SUBSTR(STR(?person), 32)) AS ?personUrl)
?roles
?example_work ?example_workLabel
WITH {
SELECT
(COUNT(?role) AS ?number_of_roles)
(GROUP_CONCAT(DISTINCT ?role; separator=", ") AS ?roles) ?person
WHERE {
{
# speaker
target: ^wdt:P179 / wdt:P823 ?person .
BIND("speaker" AS ?role)
}
UNION
{
# organizer
target: ^wdt:P179 / wdt:P664 ?person .
BIND("organizer" AS ?role)
}
UNION
{
# participant
?person (wdt:P1344 | ^wdt:P710) / wdt:P179 target: .
BIND("participant" AS ?role)
}
UNION
{
# editor
?person (^wdt:P98 / wdt:P4745) / wdt:P179 target: .
BIND("editor of proceedings" AS ?role)
}
UNION
{
# author
?person (^wdt:P50 / wdt:P1433 / wdt:P4745) / wdt:P179 target: .
BIND("author" AS ?role)
}
UNION
{
# program committee member
target: ^wdt:P179 / wdt:P5804 ?person .
BIND("program committee member" AS ?role)
}
}
GROUP BY ?person
} AS %people
WITH {
SELECT
?number_of_roles
# (COUNT(?work) AS ?number_of_publications)
?roles
?person (SAMPLE(?work) AS ?example_work)
WHERE {
INCLUDE %people .
OPTIONAL { ?work wdt:P50 ?person . }
}
GROUP BY ?number_of_roles ?roles ?person
} AS %results
WHERE {
INCLUDE %results
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en,da,de,es,fr,jp,no,ru,sv,zh". }
}
ORDER BY DESC(?number_of_roles)
LIMIT 500
graph TD