Skip to content
Snippets Groups Projects
Commit 77ace6bb authored by David Maus's avatar David Maus
Browse files

Regel für Import von Pica+ definiert

parent 207538e6
No related branches found
No related tags found
No related merge requests found
...@@ -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
...@@ -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>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment