sparql-examples

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

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

139

rq turtle/ttl

Project aspect: citations per budget

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
SELECT
  ?cites_per_million
  ?citations 
  ?budget ?currency ?currencyLabel
  ?short_name
  ?project ?projectLabel
WITH {
  SELECT
    (COUNT(?citing_work) / ?budget * 1000000 AS ?cites_per_million)
    (COUNT(?citing_work) AS ?citations)
    ?budget ?currency
    ?project
  WHERE {
    ?project p:P2769 / psv:P2769 ?budget_value .
    ?budget_value wikibase:quantityAmount ?budget .
    ?budget_value wikibase:quantityUnit ?currency .
    ?work wdt:P859 ?project .
    ?citing_work wdt:P2860 ?work .
  } 
  GROUP BY ?project ?budget ?currency
} AS %results
WHERE {
  INCLUDE %results
  OPTIONAL { ?project wdt:P1813 ?short_name }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }
}
ORDER BY DESC(?cites_per_million)

graph TD