Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kitodo-schema
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dmj
kitodo-schema
Commits
77ace6bb
Commit
77ace6bb
authored
7 years ago
by
David Maus
Browse files
Options
Downloads
Patches
Plain Diff
Regel für Import von Pica+ definiert
parent
207538e6
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ruleset.rnc
+75
-2
75 additions, 2 deletions
src/ruleset.rnc
test/ruleset.xspec
+98
-0
98 additions, 0 deletions
test/ruleset.xspec
with
173 additions
and
2 deletions
src/ruleset.rnc
+
75
−
2
View file @
77ace6bb
...
@@ -12,7 +12,8 @@ start = Preferences
...
@@ -12,7 +12,8 @@ start = Preferences
Preferences =
Preferences =
element Preferences {
element Preferences {
element debug { "0" | "1" }?,
element debug { "0" | "1" }?,
MetadataTypeDef*
MetadataTypeDef*,
ImportExportDef
}
}
MetadataTypeDef =
MetadataTypeDef =
...
@@ -74,4 +75,76 @@ AllowedMetadata =
...
@@ -74,4 +75,76 @@ AllowedMetadata =
attribute num { "*" | "+" | "1o" | "1m" }?,
attribute num { "*" | "+" | "1o" | "1m" }?,
attribute DefaultDisplay { text }?,
attribute DefaultDisplay { text }?,
xsd:NMTOKEN
xsd:NMTOKEN
}
}
\ No newline at end of file
ImportExportDef =
element Formats {
PicaImport?
}
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 }?
& Name
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test/ruleset.xspec
+
98
−
0
View file @
77ace6bb
...
@@ -47,4 +47,102 @@
...
@@ -47,4 +47,102 @@
<expect-assert/>
<expect-assert/>
</scenario>
</scenario>
</scenario>
</scenario>
<scenario label="Import von Pica+">
<scenario label="Metadatum ist definiert">
<context>
<Preferences xmlns="">
<MetadataType>
<Name>is-defined</Name>
</MetadataType>
<PicaPlus>
<Metadata>
<Name>is-defined</Name>
</Metadata>
</PicaPlus>
</Preferences>
</context>
<expect-not-assert/>
</scenario>
<scenario label="Metadatum ist nicht definiert">
<context>
<Preferences xmlns="">
<PicaPlus>
<Metadata>
<Name>is-not-defined</Name>
</Metadata>
</PicaPlus>
</Preferences>
</context>
<expect-assert/>
</scenario>
<scenario label="Person ist definiert">
<context>
<Preferences xmlns="">
<MetadataType type="person">
<Name>is-defined</Name>
</MetadataType>
<PicaPlus>
<Person>
<Name>is-defined</Name>
</Person>
</PicaPlus>
</Preferences>
</context>
<expect-not-assert/>
</scenario>
<scenario label="Person ist nicht definiert">
<context>
<Preferences xmlns="">
<PicaPlus>
<Person>
<Name>is-not-defined</Name>
</Person>
</PicaPlus>
</Preferences>
</context>
<expect-assert/>
</scenario>
<scenario label="Metadatum ist definiert aber keine Person">
<context>
<Preferences xmlns="">
<MetadataType>
<Name>is-defined</Name>
</MetadataType>
<PicaPlus>
<Person>
<Name>is-not-defined</Name>
</Person>
</PicaPlus>
</Preferences>
</context>
<expect-assert/>
</scenario>
<scenario label="Strukturtyp ist definiert">
<context>
<Preferences xmlns="">
<DocStrctType>
<Name>is-defined</Name>
</DocStrctType>
<PicaPlus>
<DocStruct>
<Name>is-defined</Name>
</DocStruct>
</PicaPlus>
</Preferences>
</context>
<expect-not-assert/>
</scenario>
<scenario label="Strukturtyp ist nicht definiert">
<context>
<Preferences xmlns="">
<PicaPlus>
<DocStruct>
<Name>is-not-defined</Name>
</DocStruct>
</PicaPlus>
</Preferences>
</context>
<expect-assert/>
</scenario>
</scenario>
</description>
</description>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment