sparql-examples

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

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

005

rq turtle/ttl

People with Mastodon that published in a PLOS journal.

Use at

PREFIX wd: <http://wikidata.org/entity/>
PREFIX wdt: <http://wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT DISTINCT ?author ?authorLabel ?mastodon (GROUP_CONCAT(DISTINCT ?journalLabel;separator=", ") AS ?journals) WHERE {
  VALUES ?PUBLISHER { wd:Q233358 }
  ?article wdt:P1433 ?journal ; wdt:P50 ?author .
  ?journal wdt:P123 ?PUBLISHER ; rdfs:label ?journalLabel . FILTER (lang(?journalLabel) = "en")
  ?author wdt:P4033 ?mastodon .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?author ?authorLabel ?mastodon
  ORDER BY ASC(?authorLabel)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?PUBLISHER")
  v4("?article")
  v6("?author"):::projected 
  v1("?authorLabel"):::projected 
  v5("?journal")
  v2("?journalLabel"):::projected 
  v8("?journals")
  v7("?mastodon"):::projected 
  c8(["bd:serviceParam"]):::iri 
  c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal 
  f0[["?journalLabel = 'en'"]]
  f0 --> v2
  bind1[/VALUES ?PUBLISHER/]
  bind1-->v3
  bind10(["wd:Q233358"])
  bind10 --> bind1
  v4 --"wdt:P1433"-->  v5
  v4 --"wdt:P50"-->  v6
  v5 --"wdt:P123"-->  v3
  v5 --"rdfs:label"-->  v2
  v6 --"wdt:P4033"-->  v7
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c8 --"wikibase:language"-->  c10
  end
  bind3[/"?journalLabel"/]
  v2 --o bind3
  bind3 --as--o v8