Sorry I forgot to also say we are using Jena 4.2.0

On 2022-08-03 2:54 p.m., Jared Whiklo wrote:
Hi Andy,

This problem is being encountered in https://github.com/fcrepo-exts/migration-utils

The code we are using is reading in an RDF-XML file and then serializing to N-Triples. So an example input is

<rdf:RDF xmlns:METS="http://www.loc.gov/METS/"; xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <rdf:Description rdf:about="info:fedora/example:11">
    <cc:useGuidelines xmlns:cc="http://web.resource.org/cc/"; xml:lang="en">This resource is free of copyright restrictions and is published under the Public Domain Mark 1.0.</cc:useGuidelines>
  </rdf:Description>
</rdf:RDF>

And the output of the above is

<info:fedora/example:11> <http://web.resource.org/cc/useGuidelines> "This resource is free of copyright restrictions and is published under the Public Domain Mark 1.0."@en^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> .

We read in the rdfXml here: https://github.com/fcrepo-exts/migration-utils/blob/3a794b504ca04016e0ee91b0f17e88d152b0bfd5/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java#L873-L883

And serialize it out here: https://github.com/fcrepo-exts/migration-utils/blob/3a794b504ca04016e0ee91b0f17e88d152b0bfd5/src/main/java/org/fcrepo/migration/handlers/ocfl/ArchiveGroupHandler.java#L947-L961

I realize that is fair from transparent.

From what I can discern I think the problem is here https://github.com/apache/jena/blob/31dc0d328c4858401e5d3fa99702c97eba0383a0/jena-core/src/main/java/org/apache/jena/rdf/model/impl/NTripleWriter.java#L198-L203

It seems like it should print either the "@lang" OR the "^^<datatypeURI>" but not both.

If it would help I could try and make a much smaller proof-of-concept code.

cheers,
jared

On 2022-08-03 2:11 p.m., Andy Seaborne wrote:
Hi Jared,

On 03/08/2022 18:35, Jared Whiklo wrote:
Hi,

We are experiencing an issue where N-Triples produced by Jena cannot be parsed by Jena. The issue seems to be how the Model outputs a literal like

example:123 @cc:useGuidelines "This is some text."@en;

Model.toString isn't supposed to be RDF syntax.

Which version of Jena are you using?
Do you have an an example N-Triples file? Or short code that creates the statement?

    Andy

It stores this triple properly (or seems to in the graph) but when serialized as N-Triples it has both a datatypeUri and a langString and so prints out.

<example:123> <http://web.resource.org/cc/useGuidelines> "This is some text."@en^^<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString> .

My understanding is that you can _either_ have a language or a datatype but not both. We'd like to retain the language as that seems more important that "langString".

I am unable to see how to alter the LiteralImpl to get a plain literal output instead of a typed one?

Any help is appreciated.

cheers,
jared

--
Jared Whiklo
[email protected]

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to