query-d0581ad74cee82713eb16209f2b4b049

rq turtle/ttl

Rank or cultivarname

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?taxonName ?taxonRankLabel WHERE {
  {
    ?item wdt:P31 wd:Q4886 .
    OPTIONAL {?item wdt:P225 ?taxonName}
  } 
  UNION {
     VALUES ?ranks {wd:Q4886 wd:Q4150646} . # cultivar, cultivar-group
     ?item wdt:P105 ?ranks.
     ?item wdt:P225 ?taxonName .
  }
  OPTIONAL {?item wdt:P105 ?taxonRank}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }  
  #FILTER(!sameTerm(?taxonRank, wd:Q4886) && !sameTerm(?taxonRank, wd:Q4150646))
  FILTER(!BOUND(?taxonName))
}
ORDER BY ASC(?taxonName)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?item"):::projected v3("?ranks") v1("?taxonName"):::projected v4("?taxonRank") c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;"]):::literal c2(["wd:Q4886"]):::iri f0[["not bound(?taxonName)"]] f0 --> v1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; bind1[/VALUES ?ranks/] bind1-->v3 bind10(["wd:Q4886"]) bind10 --> bind1 bind11(["wd:Q4150646"]) bind11 --> bind1 v2 --"wdt:P105"--> v3 v2 --"wdt:P225"--> v1 end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"wdt:P31"--> c2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P225".-> v1 end end union0r <== or ==> union0l end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."wdt:P105".-> v4 end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end