sparql-examples

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

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

222

rq turtle/ttl

Venue aspect: retractions

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

SELECT DISTINCT ?work ?workLabel ?doi (COUNT(DISTINCT ?citing) AS ?citations) WHERE {
  { ?work wdt:P31 wd:Q45182324 . }
  UNION
  { ?work wdt:P793 wd:Q7316896 . }
  UNION
  { ?work wdt:P5824 [] . }
  OPTIONAL { ?citing wdt:P2860 ?work . }
  ?work wdt:P1433 target: ; wdt:P356 ?doi .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?work ?workLabel ?doi
  ORDER BY DESC(?citations)
  LIMIT 100

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?citations")
  v3("?citing"):::projected 
  v4("?doi"):::projected 
  v2("?work"):::projected 
  a1((" "))
  c8(["wd:Q6294930"]):::iri 
  c4([http://wikidata.org/entity/Q7316896]):::iri 
  c2([http://wikidata.org/entity/Q45182324]):::iri 
  c13(["#91;AUTO_LANGUAGE#93;,mul,en"]):::literal 
  c11([http://www.bigdata.com/rdf#serviceParam]):::iri 
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      v2 --"p:direct/P5824"-->  a1
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v2 --"p:direct/P793"-->  c4
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v2 --"p:direct/P31"-->  c2
  end
  union0r <== or ==> union0l
  end
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."p:direct/P2860".->  v2
  end
  v2 --"p:direct/P1433"-->  c8
  v2 --"p:direct/P356"-->  v4
  subgraph s1["http://wikiba.se/ontology#label"]
    style s1 stroke-width:4px;
    c11 --"wikibase:language"-->  c13
  end
  bind1[/"count(?citing)"/]
  v3 --o bind1
  bind1 --as--o v5