Commit 3c187e09 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Fix resource writer

parent cfa40351
......@@ -38,7 +38,7 @@ class ResourceBuilder(
private var digitalObject: DigitalObject? = null
private var recordId = ""
private var recordTypeValue = ""
private var errorMessage = ""
var errorMessage = ""
fun extractRecordId(): ResourceBuilder {
if (source.containsKey(config.uri)) {
......@@ -130,10 +130,10 @@ class ResourceBuilder(
private fun hasDigitalObject(): Boolean = digitalObject != null
fun writeRecord(builder: ResourceBuilder): Pair<String, String> {
fun writeRecord(): Pair<String, String> {
return StringWriter().use { writer ->
RDFDataMgr.write(writer, builder.record!!.model, RDFFormat.NTRIPLES_UTF8)
if (builder.hasPhysicalObject()) {
RDFDataMgr.write(writer, record!!.model, RDFFormat.NTRIPLES_UTF8)
if (hasPhysicalObject()) {
RDFDataMgr.write(writer, physicalObject!!.model, RDFFormat.NTRIPLES_UTF8)
}
if (hasDigitalObject()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment