Skip to content

Commit fbc4813

Browse files
committed
TeiMetadata: use tagset as principle for sourcelayer
1 parent 6926321 commit fbc4813

3 files changed

Lines changed: 5 additions & 352 deletions

File tree

server/src/main/kotlin/org/ivdnt/galahad/formats/tei/TeiMetadata.kt

Lines changed: 0 additions & 351 deletions
This file was deleted.

server/src/main/kotlin/org/ivdnt/galahad/formats/tei/TeiMetadataWriter.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.ivdnt.galahad.formats.tei
22

3+
import org.ivdnt.galahad.annotations.SOURCE_LAYER_NAME
34
import org.ivdnt.galahad.documents.DocumentFormat
45
import org.ivdnt.galahad.export.DocumentExport
56
import org.ivdnt.galahad.formats.xml.PrettyXMLWriter
@@ -18,6 +19,7 @@ class TeiMetadataWriter(val writer: PrettyXMLWriter, val export: DocumentExport)
1819
val language = export.corpus.mutableMetadata.language.ifNullOrBlank { "!No language defined!" }
1920
val langCode = export.corpus.mutableMetadata.langCode
2021
val today = SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis())
22+
val annotationSet = if (export.tagger.id == SOURCE_LAYER_NAME) export.corpus.mutableMetadata.tagset.ifNullOrBlank { "!No tagset defined!" } else export.tagger.principles
2123

2224
fun write() {
2325
writer.wrapIn("teiHeader") {
@@ -219,7 +221,7 @@ class TeiMetadataWriter(val writer: PrettyXMLWriter, val export: DocumentExport)
219221
mapOf(
220222
"annotationStyle" to "inline",
221223
"Documentation" to "",
222-
"annotationSet" to export.tagger.principles,
224+
"annotationSet" to annotationSet,
223225
"annotationDescription" to "The file was automatically annotated within the platform GaLAHaD, which is a central hub for enriching historical Dutch.",
224226
"annotationFormat" to "TEI xml",
225227
)

server/src/test/kotlin/org/ivdnt/galahad/formats/ConverterTest.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.junit.jupiter.api.Assertions.assertEquals
1212
import org.junit.jupiter.api.BeforeEach
1313
import java.io.ByteArrayOutputStream
1414
import java.io.File
15+
import java.text.SimpleDateFormat
1516

1617
open class ConverterTest {
1718
private lateinit var corpus: Corpus
@@ -68,6 +69,7 @@ open class ConverterTest {
6869
Regex("""timestamp="[0-9]+""""),
6970
Regex("""filename="[^"]+""""),
7071
Regex("""filetype="[^"]+""""),
72+
Regex("""[0-9]{4}-[0-9]{2}-[0-9]{2}""""),
7173
)
7274
}
7375
}

0 commit comments

Comments
 (0)