query-b84e41e0d8fe31e93b5bebca4756cac6
==> rewrite logic with AND operator Listeria dont work in OrAs filter with the operator
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX dbpprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth ?WDBirth ?NobelDeath ?WDDeath
where
{
{SELECT ?NobelId ?item ?LaureateNobelUri ?NobelBirth ?NobelDeath ?WDBirth ?WDDeath{
SERVICE <http://data.nobelprize.org/sparql> {
SELECT distinct ?NobelId ?LaureateNobelUri ?NobelBirth ?NobelDeath ?NobelGender WHERE {
?LaureateNobelUri <http://data.nobelprize.org/terms/laureateAward> ?NobelAwardid.
BIND(REPLACE(str(?LaureateNobelUri),"http://data.nobelprize.org/resource/laureate/","") AS ?NobelId)
OPTIONAL{ ?LaureateNobelUri foaf:birthday ?NobelBirth}
OPTIONAL{ ?LaureateNobelUri dbpprop:dateOfDeath ?NobelDeath}
}
}
}
} ?item wdt:P2888 ?LaureateNobelUri .
OPTIONAL{ ?item wdt:P569 ?birthDate.}
OPTIONAL{ ?item wdt:P570 ?diedDate.}
BIND (SUBSTR(CONCAT("0",STR(DAY(?birthDate))),STRLEN(STR(DAY(?birthDate))),2) AS ?birthDay)
BIND (SUBSTR(CONCAT("0",STR(MONTH(?birthDate))),STRLEN(STR(MONTH(?birthDate))),2) AS ?birthMonth)
BIND (CONCAT(STR(YEAR(?birthDate)),"-",?birthMonth,"-",?birthDay) AS ?WDBirth)
BIND (SUBSTR(CONCAT("0",STR(DAY(?diedDate))),STRLEN(STR(DAY(?diedDate))),2) AS ?diedDay)
BIND (SUBSTR(CONCAT("0",STR(MONTH(?diedDate))),STRLEN(STR(MONTH(?diedDate))),2) AS ?diedMonth)
BIND (CONCAT(STR(YEAR(?diedDate)),"-",?diedMonth,"-",?diedDay) AS ?WDDeath)
FILTER (!(
(BOUND(?NobelBirth) = BOUND(?WDBirth))
&&
(BOUND(?NobelDeath) = BOUND(?WDDeath))
&&
(str(?WDBirth) = str(?NobelBirth))
&&
(str(?WDDeath) = str(?NobelDeath)))
)
}
order by desc(xsd:integer(?NobelId))
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?LaureateNobelUri"):::projected
v7("?NobelAwardid")
v2("?NobelBirth"):::projected
v4("?NobelDeath"):::projected
v8("?NobelId"):::projected
v13("?WDBirth"):::projected
v15("?WDDeath"):::projected
v9("?birthDate")
v11("?birthDay")
v12("?birthMonth")
v10("?diedDate")
v13("?diedDay")
v14("?diedMonth")
v8("?item"):::projected
f0[["not bound(?NobelBirth) = bound(?WDBirth)bound(?NobelDeath) = bound(?WDDeath)str(?WDBirth) = str(?NobelBirth)str(?WDDeath) = str(?NobelDeath)"]]
f0 --> v2
f0 --> v13
f0 --> v4
f0 --> v15
subgraph s1["http://data.nobelprize.org/sparql"]
style s1 stroke-width:4px;
v6 --http://data.nobelprize.org/terms/laureateAward--> v7
bind1[/"replace(str(?LaureateNobelUri),'http://data.nobelprize.org/resource/laureate/','')"/]
v6 --o bind1
bind1 --as--o v8
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -.http://xmlns.com/foaf/0.1/birthday.-> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v6 -.http://dbpedia.org/property/dateOfDeath.-> v4
end
end
v8 --"wdt:P2888"--> v6
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P569".-> v9
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v8 -."wdt:P570".-> v10
end
bind2[/"substring(concat('0',str(day-from-dateTime(?birthDate))),string-length(str(day-from-dateTime(?birthDate))),'2^^xsd:integer')"/]
v9 --o bind2
bind2 --as--o v11
bind3[/"substring(concat('0',str(month-from-dateTime(?birthDate))),string-length(str(month-from-dateTime(?birthDate))),'2^^xsd:integer')"/]
v9 --o bind3
bind3 --as--o v12
bind4[/"concat(str(year-from-dateTime(?birthDate)),'-',?birthMonth,'-',?birthDay)"/]
v9 --o bind4
v12 --o bind4
v11 --o bind4
bind4 --as--o v13
bind5[/"substring(concat('0',str(day-from-dateTime(?diedDate))),string-length(str(day-from-dateTime(?diedDate))),'2^^xsd:integer')"/]
v10 --o bind5
bind5 --as--o v13
bind6[/"substring(concat('0',str(month-from-dateTime(?diedDate))),string-length(str(month-from-dateTime(?diedDate))),'2^^xsd:integer')"/]
v10 --o bind6
bind6 --as--o v14
bind7[/"concat(str(year-from-dateTime(?diedDate)),'-',?diedMonth,'-',?diedDay)"/]
v10 --o bind7
v14 --o bind7
v13 --o bind7
bind7 --as--o v15