Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
memoriav
Memobase 2020
services
postprocessing
Import Process Bridge
Commits
44b9fa1e
Unverified
Commit
44b9fa1e
authored
Jan 21, 2021
by
Sebastian Schüpbach
Browse files
replace isPublished property with regex
parent
b84625fa
Pipeline
#20516
passed with stages
in 3 minutes and 38 seconds
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/main/kotlin/KafkaTopology.kt
View file @
44b9fa1e
...
...
@@ -90,8 +90,6 @@ class KafkaTopology(
private
fun
parseNtriples
(
input
:
Pair
<
String
,
HeaderMetadata
>):
ProcessResult
<
Model
>
{
val
model
=
MemobaseModel
()
model
.
setNsPrefix
(
"isPublished"
,
"https://memobase.ch/internal/isPublished"
)
try
{
RDFDataMgr
.
read
(
model
,
input
.
first
.
byteInputStream
(
StandardCharsets
.
UTF_8
),
Lang
.
NT
)
}
catch
(
ex
:
RiotException
)
{
...
...
src/main/kotlin/model/MemobaseModel.kt
View file @
44b9fa1e
package
org.memobase.model
import
java.io.StringWriter
import
org.apache.jena.graph.Factory
import
org.apache.jena.rdf.model.impl.ModelCom
import
org.apache.jena.riot.RDFDataMgr
import
org.apache.jena.riot.RDFFormat
import
java.io.StringWriter
class
MemobaseModel
:
ModelCom
(
Factory
.
createGraphMem
())
{
override
fun
toString
():
String
{
val
out
=
StringWriter
()
RDFDataMgr
.
write
(
out
,
this
,
RDFFormat
.
JSONLD_COMPACT_FLAT
)
return
out
.
toString
().
trim
()
return
out
.
toString
()
.
replace
(
"https://memobase.ch/internal/isPublished\":"
,
"isPublished\":"
)
.
trim
()
}
}
src/test/kotlin/KafkaTopologyTest.kt
0 → 100644
View file @
44b9fa1e
import
com.sun.xml.internal.messaging.saaj.util.ByteInputStream
import
org.apache.jena.riot.Lang
import
org.apache.jena.riot.RDFDataMgr
import
org.apache.jena.riot.RDFFormat
import
org.junit.jupiter.api.Assertions.*
import
org.junit.jupiter.api.Test
import
org.memobase.model.MemobaseModel
import
java.io.File
import
java.io.StringWriter
import
java.nio.charset.StandardCharsets
internal
class
KafkaTopologyTest
{
@Test
fun
testInternalMapping
()
{
val
model
=
MemobaseModel
()
val
input
=
File
(
"src/test/resources/input-value.nt"
).
inputStream
()
RDFDataMgr
.
read
(
model
,
input
,
Lang
.
NT
)
assert
(
model
.
toString
().
contains
(
"isPublished\":true"
))
}
}
\ No newline at end of file
src/test/resources/input-value.nt
0 → 100644
View file @
44b9fa1e
_:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@it .
_:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@fr .
_:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@de .
_:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Title> .
_:B19e21828X2Dc097X2D428dX2Db182X2D64b6948488ba <https://www.ica.org/standards/RiC/ontology#identifier> "Tanzarchiv-128" .
_:B19e21828X2Dc097X2D428dX2Db182X2D64b6948488ba <https://www.ica.org/standards/RiC/ontology#type> "oldMemobase" .
_:B19e21828X2Dc097X2D428dX2Db182X2D64b6948488ba <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#hasLanguage> _:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#hasTitle> _:B348f62b2X2D444eX2D4f49X2Db04fX2D32549770811a .
<https://memobase.ch/recordSet/sap-023> <http://rdaregistry.info/Elements/u/P60451> <https://memobase.ch/institution/mrv> .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@it .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@fr .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#title> "Videobestand Vertical danse"@de .
<https://memobase.ch/recordSet/sap-023> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#RecordSet> .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B19e21828X2Dc097X2D428dX2Db182X2D64b6948488ba .
<https://memobase.ch/recordSet/sap-023> <https://memobase.ch/internal/isPublished> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#identifiedBy> _:B60516c21X2D174cX2D4873X2D802aX2Df5c0b7a306a2 .
<https://memobase.ch/recordSet/sap-023> <https://www.ica.org/standards/RiC/ontology#heldBy> "https://memobase.ch/institution/sap" .
_:B60516c21X2D174cX2D4873X2D802aX2Df5c0b7a306a2 <https://www.ica.org/standards/RiC/ontology#identifier> "sap-023" .
_:B60516c21X2D174cX2D4873X2D802aX2Df5c0b7a306a2 <https://www.ica.org/standards/RiC/ontology#type> "main" .
_:B60516c21X2D174cX2D4873X2D802aX2Df5c0b7a306a2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Identifier> .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <http://schema.org/sameAs> "http://www.wikidata.org/entity/Q188" .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <https://www.ica.org/standards/RiC/ontology#name> "Tedesco"@it .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <https://www.ica.org/standards/RiC/ontology#name> "Allemand"@fr .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <https://www.ica.org/standards/RiC/ontology#name> "Deutsch"@de .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <https://www.ica.org/standards/RiC/ontology#type> "metadata" .
_:B2cc2fa4dX2Da2b7X2D4889X2D885dX2D8c591b96ad5d <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.ica.org/standards/RiC/ontology#Language> .
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment