On 31/08/2024 10:59, Chavdar Ivanov wrote:
Yes, but the output is a single line and has the escape characters.
If we serialize with RDFXML this does not happen (the RDF XML source is a 
multi-line string literal and the RDF XML output looks exactly the same)

But RDF XML to Turtle and Turtle to Turtle keeps the parsed escape characters 
in the output


   .set(RIOT.multilineLiterals, true)

which isn't a good name for the symbol and ought to be migrated to one starting "symTurtle..."

It'll print the literal with 3-quotes form starting on the current line unlike Java multiline literals.

    Andy

________________________________
От: Martynas Jusevičius <marty...@atomgraph.com>
Изпратено: 31 август 2024 г. 11:29
До: dev@jena.apache.org <dev@jena.apache.org>
Тема: Re: Issue with Turtle serialization

I think the output is equivalent to the input - two different ways to
encode the same string.

On Sat, 31 Aug 2024 at 09.20, Chavdar Ivanov <ch.iva...@outlook.de> wrote:

Hello all,

I noticed something around the support for multiline literals

It seems it is possible to have this for RDFXML writers, but for the
Turtle I am getting single line

I looked in the spec RDF 1.1 Turtle 
(w3.org)<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2Fturtle%2F&data=05%7C02%7C%7C00663744f39f445c108b08dcc99f766f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638606933926329579%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=gxeYaBxwywgfe8I%2F34BLOhDhwYJ%2FqMRtdZ%2F1NnMEr4Q%3D&reserved=0>
under 2.5.1 we have this example


show:218 show:blurb '''This is a multi-line                        #
literal with embedded new lines and quotes
literal with many quotes (""""")
and up to two sequential apostrophes ('').''' .

I did a test

Input
l3igm:test
         a           sh:PropertyGroup ;
         rdfs:label  "test" ;
         sh:order    0 ;
l3igm:blurb '''This is a multi-line
literal with many quotes (""""")
and up to two sequential apostrophes ('').''' .


When this is read and then serialized back to ttl I get this

l3igm:test  rdf:type  sh:PropertyGroup;
         rdfs:label   "test";
         sh:order     0;
         l3igm:blurb  "This is a multi-line
  \r\nliteral with many quotes (\"\"\"\"\")\r\nand up to two sequential
apostrophes ('')." .


I am using this way of writer


RDFWriter.create()
         
.base("https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftest.eu%2Ftest&data=05%7C02%7C%7C00663744f39f445c108b08dcc99f766f%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638606933926340925%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=ZpAhUH%2BkvcBPnZ66MfQ15y5ksOuL5Zuv3tF2yn%2FwhPI%3D&reserved=0<https://test.eu/test>")
         .set(RIOT.symTurtleOmitBase, false)
         .set(RIOT.symTurtleIndentStyle, "wide")
         .set(RIOT.symTurtleDirectiveStyle, "rdf10")
         .lang(Lang.TURTLE)
         .source(model)
         .output(out);

Is there something I am doing wrong or this is a bug to be fixed? If a
bug, where the fix should be?

Best regards
Chavdar



Reply via email to