-
Notifications
You must be signed in to change notification settings - Fork 1
/
docmaps-shapes.ttl
296 lines (277 loc) · 9.25 KB
/
docmaps-shapes.ttl
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
@prefix : <https://w3id.org/docmaps/v0/> .
@prefix ti: <http://www.ontologydesignpatterns.org/cp/owl/timeinterval.owl#> .
@prefix cnt: <http://www.w3.org/2011/content#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix pro: <http://purl.org/spar/pro/> .
@prefix pso: <http://purl.org/spar/pso/> .
@prefix pwo: <http://purl.org/spar/pwo/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix prov: <https://www.w3.org/TR/prov-o/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fabio: <http://purl.org/spar/fabio/> .
@prefix prism: <http://prismstandard.org/namespaces/basic/2.0/> .
@prefix taskex: <http://www.ontologydesignpatterns.org/cp/owl/taskexecution.owl#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@base <https://w3id.org/docmaps/v0/> .
#################################################################
# Shapes
#################################################################
:Docmap a owl:Class ;
rdfs:subClassOf pwo:Workflow ;
rdfs:label "Docmap" ;
rdfs:comment "A Docmap is a Workflow of publishing steps with additional metadata" ;
.
# TODO: investigate whether it makes sense to use specific OWL classes and SHACL shapes
# at the same time for all sub-elements.
:Thing a owl:Class ;
rdfs:subClassOf owl:Thing ;
rdfs:label "Any Research Object" ;
rdfs:comment "A docmaps:Thing is the generic holder for a research object" ;
.
:DocmapShape
a sh:NodeShape ;
sh:targetClass :Docmap ;
sh:nodeKind sh:IRI ;
sh:property [
sh:path dcterms:created ;
# TODO: specify it is an xsd:date string
sh:minCount 1 ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path dcterms:updated ;
# TODO: specify it is an xsd:date string
sh:maxCount 1 ;
] ;
sh:property [
sh:path pwo:hasFirstStep ;
# possibly redundant because it is a owl:subPropertyOf hasStep;
# specifying here may be useful however for generation.
sh:node :DocmapStepShape ;
sh:maxCount 1 ;
] ;
sh:property [
sh:path dcterms:publisher ;
sh:node :DocmapPublisherShape ;
sh:minCount 1 ;
] ;
sh:property [
sh:path pwo:hasStep ;
sh:node :DocmapStepShape ;
]
# TODO remove comments from these Closed lines for max constraint
# sh:closed true ;
.
# TODO: add constraints for required fields?
:DocmapPublisherShape
a sh:NodeShape ;
sh:ignoredProperties ( rdf:type ) ;
sh:property :DocmapHasLogo ;
sh:property :DocmapHasName ;
sh:property :DocmapHasHomepage ;
sh:property :DocmapHasURL ;
sh:property [
sh:path foaf:onlineAccount ;
sh:node :DocmapOnlineAccountShape ;
sh:maxCount 1 ;
] ;
# TODO ** note that embo is adding a peer_review_policy to
# publisher field that has no corresponding context key.
# That means the value is dropped on import to n3
sh:closed true ;
.
:DocmapHasLogo
a sh:PropertyShape ;
sh:path foaf:logo ;
sh:nodeKind sh:Literal ;
sh:datatype xsd:string ;
sh:maxCount 1;
.
:DocmapHasName
a sh:PropertyShape ;
sh:path foaf:name ;
sh:nodeKind sh:Literal ;
sh:datatype xsd:string ;
sh:maxCount 1 ;
.
:DocmapHasHomepage
a sh:PropertyShape ;
sh:path foaf:homepage ;
sh:nodeKind sh:Literal ;
sh:datatype xsd:string ;
sh:maxCount 1;
.
:DocmapHasURL
a sh:PropertyShape ;
sh:path fabio:hasURL ;
sh:nodeKind sh:Literal ;
sh:datatype xsd:anyURI ;
sh:maxCount 1;
.
:DocmapHasAccountHomepage
a sh:PropertyShape ;
sh:path foaf:accountServiceHomepage ;
sh:nodeKind sh:Literal ;
sh:maxCount 1;
.
:DocmapOnlineAccountShape
a sh:NodeShape ;
sh:nodeKind sh:IRI ;
sh:property :DocmapHasAccountHomepage ;
sh:closed true ;
.
:DocmapStepShape
a sh:NodeShape ;
sh:ignoredProperties ( rdf:type ) ;
sh:node :DocmapStepSequenceShape ;
sh:node :DocmapStepPropsShape ;
# TODO: closure may be impossible with these nested types.
# sh:closed true ;
.
:DocmapStepPropsShape
a sh:NodeShape ;
sh:property [
sh:path taskex:isExecutedIn ;
sh:node :DocmapActionShape ;
] ;
sh:property [
# "assertions:
sh:path pso:resultsInAcquiring
] ;
.
# DocMap Step is separated into two subclasses because SHACL parsers will hit
# a stack overflow when traversing a LinkedList that refers circularly.
# TODO: ensure that this is safe as-is even with long list.
:DocmapStepSequenceShape
a sh:NodeShape ;
sh:property [
sh:path pwo:hasNextStep ;
sh:node :DocmapStepShape ;
] ;
sh:property [
sh:path pwo:hasPreviousStep ;
# Note how in the backward case, we just assert that it has the Props,
# a weaker assertion.
sh:node :DocmapStepPropsShape ;
] ;
.
:DocmapActionShape
a sh:NodeShape ;
sh:ignoredProperties ( rdf:type ) ;
sh:property [
sh:path pwo:produces ;
sh:node :DocmapThingShape ;
] ;
sh:property [
sh:path pwo:needs ;
sh:node :DocmapThingShape ;
] ;
sh:property [
# "participants", in json-ld documents
sh:path pro:isDocumentContextFor ;
sh:node :DocmapRoleInTimeShape ;
] ;
# TODO: some examples fail on closure here, for surprising reasons.
# It appears that the eLife generated NT file contains a `step` that
# `produces` its `previousStep`. That may be an error in my converter.
# sh:closed true ;
.
:DocmapRoleInTimeShape
a sh:NodeShape ;
sh:closed true ;
sh:property [
sh:path pro:isHeldBy ;
# TODO: specify that this is an Agent
] ;
sh:property [
sh:path pro:withRole ;
# TODO: specify that this is an Agent
# in a more canonical way , such as
# sh:class pro:PublishingRole ; # or
# sh:property [
# sh:path rdf:type ;
# sh:hasValue pro:PublishingRole ;
# ] ;
sh:node :DocmapRoleAsPublishingRole ;
] ;
.
## DocmapRoleAsPublishingRole
#
# This is a shim to state what roles are
# subsets of publishing roles. This is a
# shim until TODO: i get `sh:class` working.
#
:DocmapRoleAsPublishingRole
a sh:PropertyShape ;
sh:in (
pro:archivist
pro:author
pro:authors-agent
pro:biographer
pro:blogger
pro:commissioning-editor
pro:compiler
pro:contributor
pro:copy-editor
pro:copyright-owner
pro:critic
pro:deputy-editor
pro:distributor
pro:editor
pro:editor-in-chief
pro:executive-editor
pro:ghost-writer
pro:guest-editor
pro:illustrator
pro:journalist
pro:librarian
pro:managing-editor
pro:peer-reviewer
pro:printer
pro:producer
pro:production-editor
pro:proof-reader
pro:publisher
pro:reader
pro:senior-editor
pro:series-editor
pro:translator
pro:reviewer
)
.
:DocmapThingShape
a sh:NodeShape ;
sh:targetClass :Thing ;
sh:property [
sh:path prism:publicationDate ;
sh:nodeKind sh:Literal ;
# TODO: specify it must be a date
] ;
sh:property [
sh:path fabio:hasManifestation ;
sh:node :DocmapManifestationShape ;
] ;
sh:property [
sh:path rdf:type ;
] ;
sh:property [
sh:path prism:doi ;
] ;
# TODO - -this could be wrong, we see only one example and it is URI not URL.
sh:property :DocmapHasURL ;
sh:closed true ;
.
:DocmapManifestationShape
a sh:NodeShape ;
sh:closed true ;
sh:property [
sh:path rdf:type ;
] ;
sh:property :DocmapHasAccountHomepage ;
sh:property :DocmapHasURL ;
.