Thanks Andy, this does the trick.
________________________________
От: Andy Seaborne <a...@apache.org>
Изпратено: 31 август 2024 г. 22:28
До: dev@jena.apache.org <dev@jena.apache.org>
Тема: Re: Issue with Turtle serialization



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%7C4b6667e568d34186e54108dcc9fba672%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638607329864086169%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=nzLulIoo3lfxSqRp0rfzmX1ajKlSjxPqiMAgxAwzGCM%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%7C4b6667e568d34186e54108dcc9fba672%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638607329864096678%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2BkgQE3z3cz1dDndKVwbIdVgKk9vJ1bS15GGiGVFFxMo%3D&reserved=0<https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftest.eu%2Ftest&data=05%7C02%7C%7C4b6667e568d34186e54108dcc9fba672%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638607329864103768%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=8Q4mhts%2BbTg%2FvKiU47N7s%2FoammCugFkMwWH1YUxcgMQ%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