sparql-examples

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

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

059

rq turtle/ttl

Country aspect: Co-organizations for a specific country

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#>
# title: Co-organizations for a specific country
PREFIX target: <http://www.wikidata.org/entity/Q35>

#defaultView:Map
SELECT ?coorganization ?coorganizationLabel ?geocoordinates ?example_coauthor ?example_coauthorLabel ?example_work ?example_workLabel
WITH {  
  SELECT
    ?coorganization
    (SAMPLE(?geocoordinates_) AS ?geocoordinates)
    (SAMPLE(?coauthor) AS ?example_coauthor)
    (SAMPLE(?work) AS ?example_work)
  WHERE {
    ?organization wdt:P17 target: .
    ?author wdt:P108 | wdt:P463 | wdt:P1416/wdt:P361* ?organization .
    ?work wdt:P50 ?author, ?coauthor .
    ?coauthor wdt:P108 | wdt:P463 | wdt:P1416/wdt:P361* ?coorganization .
    FILTER NOT EXISTS { ?coorganization wdt:P17 target: }
    ?coorganization wdt:P625 ?geocoordinates_ .
  }
  GROUP BY ?coorganization 
} AS %results
WHERE {
  INCLUDE %results
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
}
graph TD