sparql-examples

A set of SPARQL examples that are used in different TGX resources

View the Project on GitHub BiGCAT-UM/sparql-examples

094

rq turtle/ttl

Event aspect: uses

Use at

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