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 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 {
    { SELECT DISTINCT ?sitelinks WHERE { [] wikibase:sitelinks ?sitelinks. } }
    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((" "))
  f0[["string-length(?formula) > '2^^xsd:integer'"]]
  f0 --> v2
  f1[["?mass > '100^^xsd:integer'"]]
  f1 --> v3
  f2[["?sitelinks > '90^^xsd:integer'"]]
  f2 --> v1
  a1 --"wikibase:sitelinks"-->  v1
  v4 --"wikibase:sitelinks"-->  v1
  v4 --"p:P703"-->  a2
  v4 --"p:direct/P2067"-->  v3
  v4 --"p:direct/P274"-->  v2