sparql-examples

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

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

015

rq turtle/ttl

Author aspect: review statistics

Use at

PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
# Venue statistics for a specific reviewer
PREFIX target: <http://www.wikidata.org/entity/Q97270>

SELECT
  ?count (SAMPLE(?short_name_) AS ?short_name)
  ?venue ?venueLabel
  ?topics ?topicsUrl
WITH {
  SELECT
    (COUNT(DISTINCT ?work) as ?count)
    ?venue
    (GROUP_CONCAT(DISTINCT ?topic_label; separator=", ") AS ?topics)
    (CONCAT("../topics/", GROUP_CONCAT(DISTINCT SUBSTR(STR(?topic), 32); separator=",")) AS ?topicsUrl)
  WHERE {
    {
      ?work wdt:P4032 target: ;
            wdt:P1433 ?venue .
    }
    UNION
    {
      # program committee member for event in a series (work is here the event)
      ?work wdt:P179 ?venue ;
            wdt:P5804 target: 
    }
    UNION
    {
      # program committee member for event not in a series
      ?venue wdt:P5804 target: .
      MINUS { ?venue wdt:P179 [] }
      BIND("dummy" AS ?work)
    }
    OPTIONAL {
      ?venue wdt:P921 ?topic .
      ?topic rdfs:label ?topic_label . FILTER(LANG(?topic_label) = 'en')
    }
  }
  GROUP BY ?venue
} AS %result
WHERE {
  INCLUDE %result
  OPTIONAL { ?venue wdt:P1813 ?short_name_ . }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . }  
} 
GROUP BY ?count ?venue ?venueLabel ?topics ?topicsUrl
ORDER BY DESC(?count)

graph TD