lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

View the Project on GitHub lotusnprod/lotus-sparql-examples

wd_nps_popularity_sitelinks

rq turtle/ttl

Most popular natural products by number of sitelinks.

Use at


PREFIX p: <http://www.wikidata.org/prop/>
PREFIX hint: <http://www.bigdata.com/queryHints#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#title: Most popular natural products by number of sitelinks.
SELECT DISTINCT ?np ?sitelinks WHERE {
    hint:Query hint:optimizer "None".
    { SELECT DISTINCT ?sitelinks WHERE { [] wikibase:sitelinks ?sitelinks. } }
    hint:Prior hint:runFirst FALSE.
    FILTER(?sitelinks > 90 )
    ?np wikibase:sitelinks ?sitelinks;
    p:P703 [];
    wdt:P2067 ?mass;
    wdt:P274 ?formula.
    FILTER(?mass > 100 )
    FILTER((STRLEN(?formula)) > 2 )
}
ORDER BY DESC (?sitelinks)

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?formula")
  v3("?mass")
  v4("?np"):::projected 
  v1("?sitelinks"):::projected 
  a1((" "))
  a2((" "))
  c8([http://www.bigdata.com/queryHints#Prior]):::iri 
  c10(["false^^xsd:boolean"]):::literal 
  c4([http://www.bigdata.com/queryHints#Query]):::iri 
  c6(["None"]):::literal 
  f0[["string-length(?formula) > '2^^xsd:integer'"]]
  f0 --> v2
  f1[["?mass > '100^^xsd:integer'"]]
  f1 --> v3
  f2[["?sitelinks > '90^^xsd:integer'"]]
  f2 --> v1
  c4 --http://www.bigdata.com/queryHints#optimizer-->  c6
  a1 --"wikibase:sitelinks"-->  v1
  c8 --http://www.bigdata.com/queryHints#runFirst-->  c10
  v4 --"wikibase:sitelinks"-->  v1
  v4 --"p:P703"-->  a2
  v4 --"p:direct/P2067"-->  v3
  v4 --"p:direct/P274"-->  v2