sparql-examples

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

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

157

rq turtle/ttl

Publisher aspect: editors

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

SELECT
  ?number_of_editorships
  ?editor ?editorLabel 
  ?example_venue ?example_venueLabel
WITH {
  SELECT
    (COUNT(?venue_) AS ?number_of_editorships)
    ?editor
    (SAMPLE(?venue_) AS ?example_venue)
    # (GROUP_CONCAT(?journal_label; separator=" // ") AS ?venues)
  WHERE {
    # Find editors for a work published by publisher
    ?venue_ wdt:P123 target: .
    ?venue_ wdt:P98 | wdt:P5769 ?editor .
    # ?venue_ rdfs:label ?venue_label . FILTER(LANG(?venue_label) = 'en')
  } 
  GROUP BY ?editor
} AS %result
WHERE {
  # Label the result
  INCLUDE %result 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" . } 
}

graph TD