@@ -8,6 +8,7 @@ import eu.neverblink.jelly.core.proto.v1.{LogicalStreamType, PhysicalStreamType,
88import eu .neverblink .jelly .core .JellyOptions
99import eu .neverblink .jelly .core .proto .google .v1 as google
1010import eu .neverblink .jelly .core .utils .IoUtils
11+ import org .apache .jena .irix .IRIs
1112import org .apache .jena .rdf .model .{Model , ModelFactory }
1213import org .apache .jena .riot .{RDFLanguages , RDFParser }
1314import org .apache .jena .sparql .core .DatasetGraphFactory
@@ -934,5 +935,26 @@ class RdfToJellySpec extends AnyWordSpec with TestFixtureHelper with Matchers:
934935 stmts.head.getPredicate.getURI should be(" http://example.org/p" )
935936 stmts.head.getObject.asResource().getURI should be(" b" )
936937 }
938+
939+ " IRI resolution enabled (default), input RDF/XML stream with relative IRIs" in
940+ withEmptyJellyFile { j =>
941+ val input =
942+ """ <?xml version="1.0" encoding="utf-8"?>
943+ |<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
944+ | <rdf:Description rdf:about="#relative">
945+ | <__g0:test.org xmlns:__g0="http://">test</__g0:test.org>
946+ | </rdf:Description>
947+ |</rdf:RDF>""" .stripMargin
948+ RdfToJelly .setStdIn(ByteArrayInputStream (input.getBytes))
949+ RdfToJelly .runTestCommand(
950+ List (" rdf" , " to-jelly" , " --in-format" , RdfFormat .RdfXml .cliOptions.head, " --to" , j),
951+ )
952+ val content = translateJellyBack(new FileInputStream (j))
953+ val stmts = content.listStatements().asScala.toSeq
954+ stmts.size should be(1 )
955+ stmts.head.getSubject.getURI should be(s " ${IRIs .getBaseStr}#relative " )
956+ stmts.head.getPredicate.getURI should be(" http://test.org" )
957+ stmts.head.getObject.asLiteral().getString should be(" test" )
958+ }
937959 }
938960 }
0 commit comments