query-9a32bba612fb7cc7700541dc19096dec
Persecuted witches in ScotlandCurrently based on using the Survey of Scottish Witchcraft ID
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:Map
SELECT DISTINCT (CONCAT(STR(YEAR(?rulest))," ", ?deadBandLab) AS ?layer) ?loc ?accper ?accperLabel ?dateDied ?placeDied ?causeDied ?locatorLabel ?accusedURI WHERE {
## Inner query for basic case/person data
{
SELECT DISTINCT ?accper ?accperLabel ?accused ?dateDied ?loc ?locator ?locatorLabel ?deadBand ?deadBandLab ?rulest ?rgb ?accusedURI WHERE
{
{ ?accper wdt:P4478 ?accused.}
?accper rdfs:label ?accperLabel. FILTER((LANG(?accperLabel)) = "en").
BIND(URI (CONCAT ("https://witches.shca.ed.ac.uk/index.cfm?fuseaction=home.accusedrecord&accusedref=", ?accused, "&search_string=lastname") ) AS ?accusedURI).
##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:P625 ?loc. ?locator rdfs:label ?locatorLabel. FILTER((LANG(?locatorLabel)) = "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
}
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v10("?accdate")
v11("?accdate2")
v7("?accper"):::projected
v6("?accperLabel"):::projected
v8("?accused")
v9("?accusedURI"):::projected
v12("?dateDied"):::projected
v18("?deadBand")
v1("?deadBandLab"):::projected
v19("?layer")
v15("?loc"):::projected
v14("?locator")
v5("?locatorLabel"):::projected
v12("?placeDiedQ")
v13("?res")
v17("?ruleper")
v16("?ruler")
v3("?rulest"):::projected
v4("?rulestop")
a1((" "))
a2((" "))
c12(["wd:Q230791"]):::iri
f0[["?deadBandLab = 'en'"]]
f0 --> v1
f1[["?dateDied > ?rulest?dateDied < ?rulestop"]]
f1 --> v12
f1 --> v3
f1 --> v4
f2[["?accperLabel = 'en'"]]
f2 --> v6
v7 --"p:direct/P4478"--> v8
v7 --"rdfs:label"--> v6
bind3[/"concat('https://witches.shca.ed.ac.uk/index.cfm?fuseaction=home.accusedrecord&accusedref=',?accused,'&search_string=lastname')"/]
v8 --o bind3
bind3 --as--o v9
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P570".-> v12
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:P793".-> a1
a1 --"p:qualifier/P585"--> v10
bind4[/"?accdate"/]
v10 --o bind4
bind4 --as--o v12
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:P793".-> a2
a2 --"p:qualifier/P580"--> v11
bind5[/"?accdate2"/]
v11 --o bind5
bind5 --as--o v12
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P20".-> v12
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v7 -."p:direct/P551".-> v13
end
bind6[/"?res?placeDiedQ'wd:Q22'"/]
v13 --o bind6
v12 --o bind6
bind6 --as--o v14
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v14 -."p:direct/P625".-> v15
v14 --"rdfs:label"--> v5
end
v16 --"p:direct/P17"--> c12
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