forked from netwerk-digitaal-erfgoed/lod-aggregator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecc-ucfix2edm.rq
146 lines (138 loc) · 5.43 KB
/
ecc-ucfix2edm.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
140
141
142
143
144
145
146
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 void: <http://rdfs.org/ns/void#>
PREFIX schema: <http://schema.org/>
PREFIX edm: <http://www.europeana.eu/schemas/edm/>
PREFIX ore: <http://www.openarchives.org/ore/terms/>
CONSTRUCT {
?uri_cho a edm:ProvidedCHO ;
edm:type ?edm_type ;
dc:creator ?creator ;
dc:description ?description ;
dc:type ?genre ;
dc:subject ?subject ;
dc:title ?name ;
dcterms:alternative ?altName ;
dc:publisher ?publisher ;
owl:sameAs ?sameAs ;
dcterms:spatial ?spatial ;
dcterms:temporal ?temporal ;
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 .
?uri_pl a edm:Place ;
skos:prefLabel ?pl_name ;
skos:altLabel ?pl_additionalName ;
owl:sameAs ?pl_sameAs .
}
WHERE {
{
{
?uri_cho a ?type .
VALUES ?type { schema:Sculpture schema:VisualArtwork schema:Painting schema:Photograph }
BIND(("IMAGE") as ?edm_type)
}
UNION
{
?uri_cho a schema:Book .
BIND(("TEXT") 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 schema:creator ?creator }
OPTIONAL { ?uri_cho schema:description ?description }
OPTIONAL { ?uri_cho schema:genre ?genre .
FILTER (lang( ?genre) = "en")
BIND(str(?genre) as ?dc_genre)
}
OPTIONAL { ?uri_cho schema:keywords ?subject }
OPTIONAL { ?uri_cho schema:about ?subject }
OPTIONAL { ?uri_cho schema:license ?cho_license }
OPTIONAL { ?uri_cho schema:name ?name }
OPTIONAL { ?uri_cho schema:alternateName ?altName }
OPTIONAL {
# use a default the provider mentioned in the dataset description, if any...
?dataset void:rootResource ?uri_cho .
?dataset schema:provider ?dataProvider .
}
OPTIONAL {
# use as default the license statement mentioned in the dataset description, if any...
?dataset void:rootResource ?uri_cho .
?dataset schema:license ?dataset_license .
}
OPTIONAL {
# use the provider from the resource description
?uri_cho schema:provider ?dataProvider
}
OPTIONAL { ?uri_cho schema:publisher ?publisher }
OPTIONAL { ?uri_cho schema:sameAs ?sameAs }
OPTIONAL { ?uri_cho schema:spatial ?spatial }
OPTIONAL { ?uri_cho schema:temporal ?temporal }
OPTIONAL { ?uri_cho schema:material ?material }
OPTIONAL {
# Europeana requires valid URI for edm:isShownAt
#
# Below an extremly dirty hack to fix some invalid Unicode URIs in the input data
# for example: "https://www.averoffmuseum.gr/%cf%80%cf%81.....
# "%" encoded Unicode characters should be in UPPERCASE according to the standards
# the jena sparql throws an error on this but appears to process it anyway?
# so we split the url and force uppercase on the location part
#
# Normaly the input data should be fixed by the provider of course!!
#
?uri_cho schema:url ?raw_url
BIND(STRAFTER(STRAFTER(?raw_url,"//"),"/") as ?adr)
BIND(STRBEFORE(?raw_url,?adr) as ?dn)
BIND(IF(CONTAINS(?adr,"%"),CONCAT(?dn,UCASE(?adr)),?raw_url) as ?url )
BIND(IRI(?url) as ?isShownAt)
}
OPTIONAL {
# Europeana requires valid URI for edm:isShownBy
?uri_cho schema:image ?image
BIND(IRI(?image) as ?isShownBy)
}
BIND(COALESCE(IRI(?cho_license),IRI(?dataset_license),"no license info") as ?license)
}
UNION
{
?uri_org a schema:Organization .
OPTIONAL { ?uri_org schema:name ?org_name }
OPTIONAL { ?uri_org schema:description ?org_desc }
}
UNION
{
?uri_pers a schema:Person .
OPTIONAL { ?uri_pers schema:name ?pers_name }
OPTIONAL { ?uri_pers schema:additionalName ?pers_additionalName }
OPTIONAL { ?uri_pers schema:birthDate ?pers_birthDate }
OPTIONAL { ?uri_pers schema:deathDate ?pers_deathDate }
OPTIONAL { ?uri_pers schema:description ?pers_desc }
}
UNION
{
?uri_pl a schema:Place .
OPTIONAL { ?uri_pl schema:name ?pl_name }
OPTIONAL { ?uri_pl schema:alternateName ?pl_alternateName }
OPTIONAL { ?uri_pl schema:sameAs ?pl_sameAs }
}
}