You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For certain types of IRIs / prefix declarations, the declarations are not preserved during a round trip.
When I parse this
prefix server-news: <news:comp.infosystems.www.servers.> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
server-news:unix rdfs:label "News on Unix" .
server-news:windows rdfs:label "News on Windows" .
and serialize it out again, it comes out as this
@prefix server-news: <news:comp.infosystems.www.servers.> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<news:comp.infosystems.www.servers.unix> rdfs:label "News on Unix" .
<news:comp.infosystems.www.servers.windows> rdfs:label "News on Windows" .
That seems to be because the AbstractRDFParser fails to consider the namespace declarations from the Turtle when generating the IRI instances.
Expected Behavior
The parse should consider the prefix declarations when parsing and create the namespaces and IRIs accordingly in the model. When serializing, these declarations should be respected (cf. #4921).
Steps To Reproduce
@Test
public void testUnusualIrisAndPrefixesParseWriteCompare() throws Exception {
String data = "@prefix server-news: <news:comp.infosystems.www.servers.> .\n" +
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n" +
"server-news:unix rdfs:label \"News on Unix\" .\n" +
"server-news:windows rdfs:label \"News on Windows\" .\n";
var expected = Rio.parse(new StringReader(data), "", RDFFormat.TURTLE);
var stringWriter = new StringWriter();
var config = new WriterConfig();
config.set(BasicWriterSettings.INLINE_BLANK_NODES, false);
config.set(BasicWriterSettings.PRETTY_PRINT, false);
Rio.write(expected, stringWriter, RDFFormat.TURTLE, config);
var actual = Rio.parse(new StringReader(stringWriter.toString()), "", RDFFormat.TURTLE);
assertThat(Models.isomorphic(expected, actual)).as("isomorphic").isTrue();
assertThat(stringWriter.toString()).isEqualTo(data);
}
Version
4.3.10
Are you interested in contributing a solution yourself?
No
Anything else?
No response
The text was updated successfully, but these errors were encountered:
Current Behavior
For certain types of IRIs / prefix declarations, the declarations are not preserved during a round trip.
When I parse this
and serialize it out again, it comes out as this
That seems to be because the
AbstractRDFParser
fails to consider the namespace declarations from the Turtle when generating the IRI instances.Expected Behavior
The parse should consider the prefix declarations when parsing and create the namespaces and IRIs accordingly in the model. When serializing, these declarations should be respected (cf. #4921).
Steps To Reproduce
Version
4.3.10
Are you interested in contributing a solution yourself?
No
Anything else?
No response
The text was updated successfully, but these errors were encountered: