query-77d66290a8274bf3af914ef38470c3d7
PropertiesSurvey of Scottish Witchcraft - Accused witch ID (P4478)cause of death (P509)date of death (P570)place of death (P20)residence (P551)historic county (P7959)coordinate location (P625)country (P17)significant event (P793)head of state (P35)point in time (P585)start time (P580)end time (P582)
Use at
- https://query.wikidata.org/sparql
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
#defaultView:ScatterChart
SELECT DISTINCT ?locCounty ?locCountyLabel ?rgb
?deadBand (CONCAT(STR(YEAR(?rulest))," ", ?deadBandLab) AS ?deadBandLabel)
(COUNT(?accperLabel) AS ?count)
WHERE {
## Inner query for basic case/person data
{
SELECT DISTINCT ?accper ?accperLabel ?accused ?causeDied ?accwhen ?accstart ?dateDied ?placeDiedQ ?res ?locator ?locCounty ?locCountyLabel ?deadBand ?deadBandLab ?rulest ?rgb WHERE
{
{ ?accper wdt:P4478 ?accused.}
?accper rdfs:label ?accperLabel. FILTER((LANG(?accperLabel)) = "en").
##temp filter down to only Youngs
## FILTER (CONTAINS(?accperLabel, "Young")).
##
#OPTIONAL { ?accper wdt:P509 ?causeDiedQ. ?causeDiedQ rdfs:label ?causeDied. FILTER((LANG(?causeDied)) = "en"). }
### Date ###
OPTIONAL {?accper wdt:P570 ?dateDied }.
OPTIONAL {?accper p:P793 / pq:P585 ?accdate. BIND (?accdate AS ?dateDied).}.
OPTIONAL {?accper p:P793 / pq:P580 ?accdate2. BIND (?accdate2 AS ?dateDied).}.
#FILTER (BOUND(?dateDied1)). ##Optional filter for known death (though some died during so process never concluded)
### Location ###
OPTIONAL {?accper wdt:P20 ?placeDiedQ. }
OPTIONAL {?accper wdt:P551 ?res}.
BIND(COALESCE(?res, ?placeDiedQ, wd:Q22) AS ?locator).
OPTIONAL {?locator wdt:P7959 ?locCounty. ?locCounty wdt:P625 ?loc. ?locCounty rdfs:label ?locCountyLabel. FILTER((LANG(?locCountyLabel)) = "en").}
##Time period
?ruler wdt:P17 wd:Q230791.
?ruler p:P35 ?ruleper. ?ruleper ps:P35 ?deadBand. ?ruleper pq:P580 ?rulest. ?ruleper pq:P582 ?rulestop. FILTER (?dateDied > ?rulest && ?dateDied < ?rulestop ).
?deadBand rdfs:label ?deadBandLab. FILTER((LANG(?deadBandLab)) = "en").
## Add colour when generating Graph only
## BIND("3CB0FD" AS ?rgb).
} LIMIT 6000
}
}
GROUP BY ?locCounty ?locCountyLabel ?rgb ?deadBand ?rulest ?deadBandLab ?accperLabel
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?accdate")
v10("?accdate2")
v7("?accper")
v6("?accperLabel"):::projected
v8("?accused")
v20("?count")
v11("?dateDied")
v18("?deadBand"):::projected
v1("?deadBandLab"):::projected
v19("?deadBandLabel")
v15("?loc")
v14("?locCounty"):::projected
v5("?locCountyLabel"):::projected
v13("?locator")
v11("?placeDiedQ")
v12("?res")
v17("?ruleper")
v16("?ruler")
v3("?rulest"):::projected
v4("?rulestop")
a1((" "))
a2((" "))
c13(["wd:Q230791"]):::iri
f0[["?deadBandLab = 'en'"]]
f0 --> v1
f1[["?dateDied > ?rulest?dateDied < ?rulestop"]]
f1 --> v11
f1 --> v3
f1 --> v4
f2[["?accperLabel = 'en'"]]
f2 --> v6
v7 --"p:direct/P4478"--> v8
v7 --"rdfs:label"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P570".-> v11
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:P793".-> a1
a1 --"p:qualifier/P585"--> v9
bind3[/"?accdate"/]
v9 --o bind3
bind3 --as--o v11
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:P793".-> a2
a2 --"p:qualifier/P580"--> v10
bind4[/"?accdate2"/]
v10 --o bind4
bind4 --as--o v11
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P20".-> v11
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P551".-> v12
end
bind5[/"?res?placeDiedQ'wd:Q22'"/]
v12 --o bind5
v11 --o bind5
bind5 --as--o v13
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v13 -."p:direct/P7959".-> v14
v14 --"p:direct/P625"--> v15
v14 --"rdfs:label"--> v5
end
v16 --"p:direct/P17"--> c13
v16 --"p:P35"--> v17
v17 --"p:statement/P35"--> v18
v17 --"p:qualifier/P580"--> v3
v17 --"p:qualifier/P582"--> v4
v18 --"rdfs:label"--> v1
bind7[/"concat(str(year-from-dateTime(?rulest)),' ',?deadBandLab)"/]
v3 --o bind7
v1 --o bind7
bind7 --as--o v19
bind8[/"count(?accperLabel)"/]
v6 --o bind8
bind8 --as--o v20