ruleset.rnc 6.15 KB
Newer Older
David Maus's avatar
David Maus committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# -*- mode: rnc; -*-
#
# RelaxNG Schema für Kitido.Production Regelsatz
#
# Author: David Maus <maus@hab.de>
#

namespace s = "http://purl.oclc.org/dsdl/schematron"

start = Preferences

Preferences =
   element Preferences {
      element debug { "0" | "1" }?,
15
      MetadataTypeDef*,
16
      StructTypeDef*,
17
      ImportExportDef
David Maus's avatar
David Maus committed
18
19
20
   }

MetadataTypeDef =
21
22
23
24
25
26
27
28
29
30
   [
      s:pattern [
         s:rule [
            context = "metadata[parent::DocStrctType]" s:assert [
               test = "/Preferences/METS/Metadata/InternalName = ."
               "Das Metadatum '" s:value-of [ select = "." ] "' wird nicht exportiert."
            ]
         ]
      ]
   ]
31
   element MetadataType {
David Maus's avatar
David Maus committed
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
      attribute type { "person" | "identifier" }?,
      (
         Name
       & NameTranslation*
      )
   }

Name =
   ## Interner Name des Metadaten- oder Strukturtyps. Der Name wird zur Referenzierung benutzt und muss daher dokumentweit eindeutig sein.
   element Name { xsd:NMTOKEN }

NameTranslation =
   ## Übersetzung eines Namens in die über das Attribut @name spezifizierte Sprache.
   element language {
      attribute name { xsd:language },
      text
   }

StructTypeDef =
   element DocStrctType {
      attribute anchor { "true" }?
    & Name
54
    & NameTranslation*
David Maus's avatar
David Maus committed
55
56
57
58
59
60
61
62
63
    & AllowedChildStruct*
    & AllowedMetadata*
   }

AllowedChildStruct =
   [
      s:pattern [
         s:rule [
            context = "allowedchildtype" s:assert [
David Maus's avatar
David Maus committed
64
               test = "/Preferences/DocStrctType/Name = ."
David Maus's avatar
David Maus committed
65
66
67
68
69
70
71
72
73
74
75
76
77
78
               "Der Strukturtyp '" s:value-of [ select = "." ] "' muss definiert werden."
            ]
         ]
      ]
   ]
   element allowedchildtype {
      xsd:NMTOKEN
   }

AllowedMetadata =
   [
      s:pattern [
         s:rule [
            context = "metadata[parent::DocStrctType]" s:assert [
David Maus's avatar
David Maus committed
79
               test = "/Preferences/MetadataType/Name = ."
David Maus's avatar
David Maus committed
80
81
82
83
84
85
               "Das Metadatum '" s:value-of [ select = "." ] "' muss definiert werden."
            ]
         ]
      ]
   ]
   element metadata {
David Maus's avatar
David Maus committed
86
      attribute num { "*" | "+" | "1o" | "1m" },
David Maus's avatar
David Maus committed
87
88
      attribute DefaultDisplay { text }?,
      xsd:NMTOKEN
89
90
91
92
   }

ImportExportDef =
   element Formats {
93
94
      PicaImport?,
      MetsModsSerialization?
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
   }

PicaImport =
   element PicaPlus {
      ( PicaPlusImportMetadata | PicaPlusImportDocStruct | PicaPlusImportPerson )*
   }

PicaPlusImportMetadata =
   [
      s:pattern [
         s:rule [
            context = "Metadata[parent::PicaPlus]" s:assert [
               test = "/Preferences/MetadataType/Name = current()/Name"
               "Das Metadatum '" s:value-of [ select = "Name" ] "' muss definiert werden."
            ]
         ]
      ]
   ]
   element Metadata {
      PicaPlusImportMappingElements
   }

PicaPlusImportPerson =
   [
      s:pattern [
         s:rule [
            context = "Person[parent::PicaPlus]" s:assert [
               test = "/Preferences/MetadataType/Name = current()/Name"
               "Das Metadatum '" s:value-of [ select = "Name" ] "' muss definiert werden."
            ]
         ]
         s:rule [
            context = "Person[parent::PicaPlus]" s:assert [
               test = "/Preferences/MetadataType[Name = current()/Name]/@type = 'person'"
               "Das Metadatum '" s:value-of [ select = "Name" ] "' muss als Person gekennzeichnet sein."
            ]
         ]
      ]
   ]
   element Person {
      PicaPlusImportMappingElements
   }

PicaPlusImportDocStruct =
   [
      s:pattern [
         s:rule [
            context = "DocStruct[parent::PicaPlus]" s:assert [
               test = "/Preferences/DocStrctType/Name = current()/Name"
               "Der Strukturtyp '" s:value-of [ select = "Name" ] "' muss definiert werden."
            ]
         ]
      ]
   ]
   element DocStruct {
      PicaPlusImportMappingElements
    & element picaContent { text }
   }

PicaPlusImportMappingElements =
   element picaMainTag { text }
 & element picaSubTag {
    attribute type { "firstname" | "lastname" | "identifier" | "expansion" }?
  & text
 }*
 & element valueCondition { text }?
 & element valueRegExp { text }?
162
163
164
165
 & Name

MetsModsSerialization =
   element METS {
166
      MetsModsSerializationClass?
167
    & MetsModsSerializationNamespace*
168
169
170
    & MetsModsSerializationAnchorQuery?
    & MetsModsSerializationAnchorIdentifierMetadataType?
    & MetsModsSerializationValueRegExp?
171
    & MetsModsSerializationMetadataMapping*
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
    & MetsModsSerializationDocStructMapping+
   }

MetsModsSerializationClass =
   element class { "ugh.fileformats.mets.MetsModsImportExport" }

MetsModsSerializationNamespace =
   element NamespaceDefinition {
      element URI { xsd:anyURI },
      element prefix { xsd:NMTOKEN }
   }

MetsModsSerializationAnchorQuery =
   element XPathAnchorQuery { text }

MetsModsSerializationAnchorIdentifierMetadataType =
   [
      s:pattern [
         s:rule [
            context = "AnchorIdentifierMetadataType[parent::METS]" s:assert [
               test = "/Preferences/MetadataType/Name = ."
               "Das Metadatum '" s:value-of [ select = "." ] "' muss definiert werden."
            ]
         ]
      ]
   ]
   element AnchorIdentifierMetadataType { xsd:NMTOKEN }

MetsModsSerializationValueRegExp =
   element ValueRegExp { text }

MetsModsSerializationMetadataMapping =
204
   element Metadata {
205
      MetsModsSerializationInternalName
206
    & MetsModsSerializationPersonIndicator?
207
208
209
210
211
212
213
214
215
216
    & element WriteXPath { WriteXPathContent }
    & element FirstnameXPath { WriteXPathContent }
    & element DisplayNameXPath { WriteXPathContent }
    & element IdentifierXPath { WriteXPathContent }
    & element ValueRegExp { text }
    & element ValueCondition { text }
   }

WriteXPathContent = text

217
218
219
MetsModsSerializationPersonIndicator =
   element MODSName { "Person" }

220
221
222
223
224
MetsModsSerializationInternalName =
   [
      s:pattern [
         s:rule [
            context = "InternalName[ancestor::Formats/METS]" s:assert [
225
226
               test = "/Preferences/DocStrctType/Name = ."
               "Der Strukturtyp '" s:value-of [ select = "." ] "' muss definiert werden."
227
228
229
230
231
232
233
234
235
236
237
            ]
         ]
      ]
   ]
   element InternalName { xsd:NMTOKEN }

MetsModsSerializationDocStructMapping =
   element DocStruct {
      MetsModsSerializationInternalName
    & element MetsType { xsd:NMTOKEN }
   }