query-f27a0e5c26c282f95408ec4bbbe79cf0
Erdos numberI've tried to build a query to find Erdos number of a person by definition
Use at
- https://query.wikidata.org/sparql
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 ?work1Label ?work2Label ?work3Label WHERE {
VALUES ?pers0 {wd:Q173746 wd:Q15873}
VALUES ?persx {wd:Q56812165 wd:Q52015163 wd:Q77342071}
?work1 wdt:P50 ?pers0;
wdt:P50 ?pers1.
?work2 wdt:P50 ?pers1;
wdt:P50 ?pers2.
?work3 wdt:P50 ?pers2;
wdt:P50 ?pers3.
?work4 wdt:P50 ?pers3; wdt:P50 ?persx.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v1("?pers0")
v4("?pers1")
v6("?pers2")
v8("?pers3")
v2("?persx")
v3("?work1")
v5("?work2")
v7("?work3")
v9("?work4")
c3(["bd:serviceParam"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
bind0[/VALUES ?pers0/]
bind0-->v1
bind00(["wd:Q173746"])
bind00 --> bind0
bind01(["wd:Q15873"])
bind01 --> bind0
bind1[/VALUES ?persx/]
bind1-->v2
bind10(["wd:Q56812165"])
bind10 --> bind1
bind11(["wd:Q52015163"])
bind11 --> bind1
bind12(["wd:Q77342071"])
bind12 --> bind1
v3 --"wdt:P50"--> v1
v3 --"wdt:P50"--> v4
v5 --"wdt:P50"--> v4
v5 --"wdt:P50"--> v6
v7 --"wdt:P50"--> v6
v7 --"wdt:P50"--> v8
v9 --"wdt:P50"--> v8
v9 --"wdt:P50"--> v2
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end