sparql-examples

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

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

120

rq turtle/ttl

Organization 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#>
PREFIX target: <http://www.wikidata.org/entity/Q104785223>

SELECT
  ?researchers
  ?use ?useLabel (CONCAT("/use/", SUBSTR(STR(?use), 32)) AS ?useUrl)
  ("🔎" AS ?zoom)
  (CONCAT("Q104785223/use/", SUBSTR(STR(?use), 32)) AS ?zoomUrl)
  ?useDescription
  ?samplework ?sampleworkLabel (CONCAT("/work/", SUBSTR(STR(?samplework), 32)) AS ?sampleworkUrl)
WITH {
  SELECT DISTINCT ?researcher WHERE {
    ?researcher ( wdt:P108 | wdt:P463 | wdt:P1416 ) / wdt:P361* target: .
  } 
} AS %researchers
WITH {
  SELECT DISTINCT ?use
    (COUNT(DISTINCT ?researcher) AS ?researchers)
    (SAMPLE(?work) AS ?samplework)
  WHERE {
    INCLUDE %researchers
    ?work wdt:P50 ?researcher . 
    ?work wdt:P4510 ?use . 
  } 
  GROUP BY ?use
  ORDER BY DESC(?researchers)
  LIMIT 500
} AS %works_and_number_of_researchers
WHERE {
  INCLUDE %works_and_number_of_researchers
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . } 
}
GROUP BY ?researchers ?use ?useLabel ?useDescription ?samplework ?sampleworkLabel
ORDER BY DESC(?researchers)

graph TD