forked from EnnoMeijers/lod-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ksamsok2edm.rq
139 lines (131 loc) · 5.15 KB
/
ksamsok2edm.rq
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX ksamsok: <http://kulturarvsdata.se/ksamsok#>
PREFIX restype: <http://kulturarvsdata.se/resurser/EntityType#>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
PREFIX cidoc: <http://www.cidoc-crm.org/rdfs/cidoc-crm#>
CONSTRUCT {
?uri_cho a edm:ProvidedCHO ;
edm:type ?edm_type ;
dc:creator ?creator ;
dc:description ?description ;
dc:type ?mediaType ;
dc:subject ?subject ;
dc:title ?name ;
dcterms:alternative ?altName ;
dcterms:extent ?extent ;
dcterms:medium ?material .
?uri_ore a ore:Aggregation ;
edm:aggregatedCHO ?uri_cho ;
edm:provider ?provider ;
edm:dataProvider ?dataProvider ;
edm:rights ?license ;
edm:isShownBy ?isShownBy ;
edm:isShownAt ?isShownAt .
?uri_org a edm:Agent ;
skos:prefLabel ?org_name ;
skos:note ?org_description .
?uri_pers a edm:Agent ;
skos:prefLabel ?pers_name ;
skos:altLabel ?pers_additionalName ;
edm:begin ?pers_birthDate ;
edm:end ?pers_deathDate .
}
WHERE {
select
?uri_cho ?edm_type ?creator ?description ?mediaType ?subject ?name ?altName ?extent ?material
?uri_ore ?provider ?dataProvider ?license ?isShownAt
(SAMPLE(?all_isShownBy) as ?isShownBy)
?uri_org ?org_name ?org_description
?uri_pers ?pers_name ?pers_additionalName ?pers_birthDate ?pers_deathDate {
{
?uri_cho a ksamsok:Entity .
?uri_cho ksamsok:itemType restype:object .
?uri_cho ksamsok:serviceName "objects"
BIND(("IMAGE") as ?edm_type)
# Generate an "URI_CHO#agg" URI pointing to a ore:Aggregation resource.
BIND( URI(CONCAT(STR(?uri_cho),"#agg")) as ?uri_ore)
# NOTE: The VAR_PROVIDER will be replaced during runtime by the starter.sh script.
# Europeana requires the provider value to be specified through the aggregation process.
BIND( STR('VAR_PROVIDER') as ?provider)
OPTIONAL { ?uri_cho ksamsok:context ?bn_context .
?bn_context cidoc:P94B.was_created_by ?creator
}
OPTIONAL {
?uri_cho ksamsok:itemDescription ?bn_itemDescription .
?bn_itemDescription ksamsok:desc ?description
FILTER(STRLEN(STR(?description))>0)
}
OPTIONAL { ?uri_cho ksamsok:itemKeyWord ?subject }
OPTIONAL { ?uri_cho ksamsok:itemClassName ?subject }
OPTIONAL { ?uri_cho ksamsok:mediaType ?mediaType }
OPTIONAL { ?uri_cho ksamsok:itemLicenseUrl ?license }
OPTIONAL {
?uri_cho ksamsok:itemLabel ?name
FILTER(STRLEN(STR(?name))>0)
}
OPTIONAL {
?uri_cho ksamsok:itemName ?bn_itemName .
?bn_itemName ksamsok:name ?altName
}
OPTIONAL { ?uri_cho ksamsok:serviceOrganization ?dataProvider }
OPTIONAL {
?uri_cho ksamsok:itemMaterial ?bn_itemMaterial .
?bn_itemMaterial ksamsok:material ?material
}
OPTIONAL {
?uri_cho ksamsok:itemMeasurement ?bn_itemMeasurement .
?bn_itemMeasurement ksamsok:unit ?ext_unit ;
ksamsok:value ?ext_val ;
ksamsok:type ?ext_type .
BIND(CONCAT(str(?ext_type),": ",str(?ext_val)," ",str(?ext_unit)) as ?extent)
}
OPTIONAL {
# Europeana requires valid URI for edm:isShownAt
?uri_cho ksamsok:url ?url
BIND(IRI(?url) as ?isShownAt)
}
OPTIONAL {
# Europeana requires valid URI for edm:isShownBy
?uri_cho ksamsok:image ?bn_image .
?bn_image ksamsok:highresSource ?image
BIND(IRI(?image) as ?all_isShownBy)
}
}
UNION
{
?uri_org a ksamsok:Entity .
?uri_org ksamsok:serviceName "agents" .
?uri_org ksamsok:itemType ?agent_type .
VALUES ?agent_type { restype:organization restype:group }
OPTIONAL { ?uri_org ksamsok:itemLabel ?org_name }
OPTIONAL { ?uri_org foaf:title ?org_desc }
}
UNION
{
?uri_pers a ksamsok:Entity .
?uri_pers ksamsok:serviceName "agents" .
?uri_pers ksamsok:itemType restype:person .
OPTIONAL { ?uri_pers ksamsok:itemLabel ?pers_name }
OPTIONAL {
?uri_pers ksamsok:context ?bn_context .
?bn_context ksamsok:fromTime ?pers_birthDate
}
OPTIONAL {
?uri_pers ksamsok:context ?bn_context .
?bn_context ksamsok:toTime ?pers_deathDate
}
OPTIONAL { ?uri_pers foaf:title ?pers_desc }
}
} group by
?uri_cho ?edm_type ?creator ?description ?mediaType ?subject ?name ?altName ?extent ?material
?uri_ore ?provider ?dataProvider ?license ?isShownAt
?uri_org ?org_name ?org_description
?uri_pers ?pers_name ?pers_additionalName ?pers_birthDate ?pers_deathDate
}