query-54effaf36120a60229ed7bb6b94c4639

rq turtle/ttl

Propertiesinstance of (P31)parent taxon (P171)taxon rank (P105)taxon name (P225)basionym (P566)taxon synonym (P1420)Index Fungorum taxon ID (P1391)Commons category (P373)image (P18)taxon author (P405)year of publication of scientific name for taxon (P574)

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX schema: <http://schema.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
SELECT
  ?taxon
  (GROUP_CONCAT(DISTINCT ?taxon_name; SEPARATOR = ", ") AS ?taxon_name_)
  (GROUP_CONCAT(DISTINCT ?taxon_author_label; SEPARATOR = ", ") AS ?taxon_author_label_)
  (GROUP_CONCAT(DISTINCT ?taxon_date; SEPARATOR = ", ") AS ?taxon_date_)
  (SAMPLE(?basionym) AS ?basionym_)
  (SAMPLE(?basionymOf) AS ?basionymOf_)
  (SAMPLE(?synonymOf) AS ?synonymOf_)
  (GROUP_CONCAT(DISTINCT ?indexFungorum; SEPARATOR = ", ") AS ?indexFungorum_)
  (SAMPLE(?article_de) AS ?article_de_)
  (SAMPLE(?article_en) AS ?article_en_)
  (SAMPLE(?cat) AS ?cat_)
  (SAMPLE(?image) AS ?image_)
WHERE {
  ?taxon wdt:P31 wd:Q16521.

  #?taxon wdt:P171 wd:Q578471.
  ?taxon wdt:P171* wd:Q1633488.
  #FILTER NOT EXISTS { ?taxon wdt:P105 wd:Q7432. }

  ?taxon wdt:P225 ?taxon_name.
  OPTIONAL {
    ?taxon p:P225 ?taxon_name_node.
    ?taxon_name_node pq:P405 ?taxon_author.
    ?taxon_author rdfs:label ?taxon_author_label.
    FILTER((LANG(?taxon_author_label)) = "en")
  }
  OPTIONAL {
    ?taxon p:P225 ?taxon_name_node.
    ?taxon_name_node pq:P574 ?taxon_date.
  }
  OPTIONAL { ?taxon wdt:P566 ?basionym. }
  OPTIONAL { ?basionymOf wdt:P566 ?taxon. }
  OPTIONAL { ?synonymOf wdt:P1420 ?taxon. }
  OPTIONAL { ?taxon wdt:P1391 ?indexFungorum. }
  OPTIONAL { ?taxon wdt:P373 ?p373. }
  BIND (URI(CONCAT("https://commons.wikimedia.org/wiki/Category:", ENCODE_FOR_URI(REPLACE(?p373, " ", "_")))) AS ?cat)
  OPTIONAL { ?article_de schema:about ?taxon. ?article_de schema:isPartOf <https://de.wikipedia.org/>. }
  OPTIONAL { ?article_en schema:about ?taxon. ?article_en schema:isPartOf <https://en.wikipedia.org/>. }
  OPTIONAL { ?taxon wdt:P18 ?image. }
}
GROUP BY ?taxon
ORDER BY ?taxon
#LIMIT 300

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v13("?article_de"):::projected v23("?article_de_") v14("?article_en"):::projected v24("?article_en_") v7("?basionym"):::projected v8("?basionymOf"):::projected v20("?basionymOf_") v19("?basionym_") v12("?cat"):::projected v25("?cat_") v15("?image"):::projected v26("?image_") v10("?indexFungorum"):::projected v22("?indexFungorum_") v11("?p373") v9("?synonymOf"):::projected v21("?synonymOf_") v1("?taxon"):::projected v5("?taxon_author") v2("?taxon_author_label"):::projected v17("?taxon_author_label_") v6("?taxon_date"):::projected v18("?taxon_date_") v3("?taxon_name"):::projected v16("?taxon_name_") v4("?taxon_name_node") c17([https://de.wikipedia.org/]):::iri c18([https://en.wikipedia.org/]):::iri c5(["wd:Q1633488"]):::iri c3(["wd:Q16521"]):::iri v1 --"p:direct/P31"--> c3 v1 --"p:direct/P171"--> c5 v1 --"p:direct/P225"--> v3 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v4 v4 --"p:qualifier/P405"--> v5 v5 --"rdfs:label"--> v2 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P225".-> v4 v4 --"p:qualifier/P574"--> v6 end subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P566".-> v7 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:direct/P566".-> v1 end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v9 -."p:direct/P1420".-> v1 end subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P1391".-> v10 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P373".-> v11 end bind0[/"concat('https://commons.wikimedia.org/wiki/Category:',encode-for-uri(replace(?p373,' ','_')))"/] v11 --o bind0 bind0 --as--o v12 subgraph optional7["(optional)"] style optional7 fill:#bbf,stroke-dasharray: 5 5; v13 -."schema:about".-> v1 v13 --"schema:isPartOf"--> c17 end subgraph optional8["(optional)"] style optional8 fill:#bbf,stroke-dasharray: 5 5; v14 -."schema:about".-> v1 v14 --"schema:isPartOf"--> c18 end subgraph optional9["(optional)"] style optional9 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:direct/P18".-> v15 end bind12[/"?taxon_name"/] v3 --o bind12 bind12 --as--o v16 bind13[/"?taxon_author_label"/] v2 --o bind13 bind13 --as--o v17 bind14[/"?taxon_date"/] v6 --o bind14 bind14 --as--o v18 bind15[/"sample(?basionym)"/] v7 --o bind15 bind15 --as--o v19 bind16[/"sample(?basionymOf)"/] v8 --o bind16 bind16 --as--o v20 bind17[/"sample(?synonymOf)"/] v9 --o bind17 bind17 --as--o v21 bind18[/"?indexFungorum"/] v10 --o bind18 bind18 --as--o v22 bind19[/"sample(?article_de)"/] v13 --o bind19 bind19 --as--o v23 bind20[/"sample(?article_en)"/] v14 --o bind20 bind20 --as--o v24 bind21[/"sample(?cat)"/] v12 --o bind21 bind21 --as--o v25 bind22[/"sample(?image)"/] v15 --o bind22 bind22 --as--o v26