sparql-examples

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

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

109

rq turtle/ttl

Organization aspect: advisor graph

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 wd: <http://wikidata.org/entity/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#defaultView:Graph

PREFIX target: <http://www.wikidata.org/entity/Q104785223>

SELECT ?author1 ?author1Label ?rgb ?author2 ?author2Label 
WITH {
  SELECT DISTINCT ?author1 ?author2 ?rgb WHERE {
    VALUES ?organisation { target: }
    { ?author1 wdt:P108 ?organisation . } union { ?author1 wdt:P1416 [ wdt:P361* ?organisation ] .  }
    { ?author2 wdt:P108 ?organisation . } union { ?author2 wdt:P1416 [ wdt:P361* ?organisation ] .  }
    {?author1 wdt:P184 ?author2 }
    UNION
    {?author2 wdt:P185 ?author1 }
    OPTIONAL { ?author1 wdt:P21 ?gender1 }.
    BIND ( IF(?gender1 = wd:Q6581097, "3182BD", "E6550D") AS ?rgb)
  }
} AS %result
WHERE {
  INCLUDE %result
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en" .
  }
}

graph TD