query-7e7a5de541fa73cddc21b4da4acc7fdf
TODO To check
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT distinct ?item ?itemLabel ?taxon_name ?derived ?derivedLabel WHERE
{
{ SELECT ?item WHERE
{
{ SELECT ?cand ?tname ?label
WHERE
{
VALUES ?tname {"Antipathes hypnoides"} .
BIND(STRLANG(?tname,"en") as ?label)
{?cand wdt:P225 ?tname . }
UNION
{?cand rdfs:label ?label . }
} } ?cand wdt:P225 ?taxonname .
BIND(STRLANG(?taxonname,"en") as ?label2)
{?item wdt:P225 ?tname . }
UNION
{?item rdfs:label ?label . }
UNION
{?item wdt:P225 ?taxonname . }
UNION
{?item rdfs:label ?label2 . }
} } ?item p:P225 ?stat .
?stat prov:wasDerivedFrom/pr:P248 ?derived.
?stat ps:P225 ?taxon_name
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
- https://www.wikidata.org/wiki/User:Christian_Ferrer
- https://www.wikidata.org/wiki/Wikidata:Request_a_query/Archive/2021/11
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?cand")
v8("?derived"):::projected
v6("?item"):::projected
v2("?label")
v5("?label2")
v7("?stat")
v9("?taxon_name"):::projected
v4("?taxonname")
v1("?tname")
a1((" "))
c8(["bd:serviceParam"]):::iri
c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?tname/]
bind0-->v1
bind00(["Antipathes hypnoides"])
bind00 --> bind0
bind1[/"STRLANG(?tname,'en')"/]
v1 --o bind1
bind1 --as--o v2
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
v3 --"rdfs:label"--> v2
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v3 --"p:direct/P225"--> v1
end
union0r <== or ==> union0l
end
v3 --"p:direct/P225"--> v4
bind2[/"STRLANG(?taxonname,'en')"/]
v4 --o bind2
bind2 --as--o v5
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
subgraph union2[" Union "]
subgraph union2l[" "]
style union2l fill:#abf,stroke-dasharray: 3 3;
subgraph union3[" Union "]
subgraph union3l[" "]
style union3l fill:#abf,stroke-dasharray: 3 3;
v6 --"rdfs:label"--> v5
end
subgraph union3r[" "]
style union3r fill:#abf,stroke-dasharray: 3 3;
v6 --"p:direct/P225"--> v4
end
union3r <== or ==> union3l
end
end
subgraph union2r[" "]
style union2r fill:#abf,stroke-dasharray: 3 3;
v6 --"rdfs:label"--> v2
end
union2r <== or ==> union2l
end
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v6 --"p:direct/P225"--> v1
end
union1r <== or ==> union1l
end
v6 --"p:P225"--> v7
v7 --"prov:wasDerivedFrom"--> a1
a1 --"p:reference/P248"--> v8
v7 --"p:statement/P225"--> v9
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c8 --"wikibase:language"--> c10
end