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_uses.sparql
Event aspect: uses
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#>
# Use by people associated with an event
PREFIX target: <http://www.wikidata.org/entity/Q133457282>
SELECT
?number_of_persons
?use ?useLabel (CONCAT("/use/", SUBSTR(STR(?use), 32)) AS ?useUrl) ?useDescription
?example_person ?example_personLabel (CONCAT("/author/", SUBSTR(STR(?example_person), 32)) AS ?example_personUrl)
WITH {
SELECT
DISTINCT ?person
WHERE {
{
# speaker, organizer, program committee member
target: wdt:P823 | wdt:P664 | wdt:P5804 ?person .
}
UNION
{
# participant
?person wdt:P1344 | ^wdt:P710 target: .
}
UNION
{
# author
?person ^wdt:P50 / wdt:P1433 / wdt:P4745 target: .
}
}
} AS %people
WITH {
SELECT
(COUNT(DISTINCT ?person) AS ?number_of_persons)
?use
(SAMPLE(?person) AS ?example_person)
WHERE {
INCLUDE %people
?person ^wdt:P50 / wdt:P4510 ?use .
}
GROUP BY ?use
} 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_persons)
LIMIT 200
graph TD