[ 
https://issues.apache.org/jira/browse/JENA-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17059761#comment-17059761
 ] 

Andy Seaborne commented on JENA-1864:
-------------------------------------

Hi [~virresh] 
 
bq.    1.  "@base" directive is not printed when writing with the TURTLE_BLOCK 
and TURTLE_FLAT format in RDFWriter

This is a bug - when called as 
{code:java}
    RDFWriter.create()
        .base("http://base/";)
        .format(RDFFormat.TURTLE_......)
        .source(graph)
        .output(System.out);
{code}
they should use a base in output.
TURTLE_BLOCK and TURTLE_FLAT 

({{TurtleWriterBlocks}} using {{WriterStreamRDFBatched}} and 
{{TurtleWriterFlat}} using {{WriterStreamRDFFlat}} receive the base argument 
but do nothing with it. 

This is definitely worth a fix.

bq.     2. There is no way to provide "@base" inside the RDFDataMgr. Expected 
output was something like <#spiderman>

This is by-design.  RDFDataMgr isn't aiming to be all functionality of writing, 
and using RDFWriter is necessary for detailed control. RDFDataMgr aims to be 
one line calls for many common cases. Graphe don't carry around a "base" - it 
has to be supplied by the application to write. It is a balance between adding 
the "base" variants in RDFDataMgr and making RDFDataMgr even larger, getting in 
the way of the convenience aspect.

bq.     3. RDFDataMgr doesn't respect the prefix supplied, e.g I manually added 
prefix "@base", however, the output (C.ttl) still converts the relative 
entities into their absolute form, whereas I expected it to do something like 
base:#spiderman at the very least

This is a separate matter.

{{base:#spiderman}} isn't a way to write {{<http://base/#spioderman>}} because 
"#" is the comment character in Turtle. {{base:#spiderman}} is 
{{<http://base/>}}, i.e. {{base:}} and "#spiderman" is skipped because it is a 
comment.

It can be written: {noformat}base:\#spiderman{noformat} (and very hard to type 
into JIRA!)

Backslash allows a number for characters in the local name part of a prefixed 
name that can't be written directly because they have other meanings (e.g. % 
and also paths in SPARQL - the grammars share rules and restrictions).

Whether {{NodeFormatterTTL.formatURI}} ought to use the full range of escaped 
characters is something to consider.



> Inconsistent Turtle serializers
> -------------------------------
>
>                 Key: JENA-1864
>                 URL: https://issues.apache.org/jira/browse/JENA-1864
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: Jena 3.14.0
>         Environment: My Configuration:
> OS: Ubuntu 18.04
> java version "1.8.0_111"
> javac 1.8.0_242
> Jena Version: 3.14.0
>            Reporter: Viresh Gupta
>            Priority: Major
>
> The turtle serializers provided for default model in Jena don't work as 
> expected. Moreover, the docs lack on which methods to use in which case.
> I found the following methods that seem to work:
>  # model.write()  (A.ttl)
>  # RDFWriter   (B.ttl)
>  # RDFDataMgr  (C.ttl)
> I'm providing a minimum working example along with the outputs using a sample 
> turtle file from Turtle specifications (ggoblin.ttl – Example 1 from 
> [https://www.w3.org/TR/turtle/|https://www.w3.org/TR/turtle/#sec-examples]) 
> in a gist: [https://gist.github.com/virresh/5a28dc3adb1f40bf9070e2cb4ecfa90d]
>  
> The issue:
>  # "@base" directive is not printed when writing with the TURTLE_BLOCK and 
> TURTLE_FLAT format in RDFWriter
>  #  There is no way to provide "@base" inside the RDFDataMgr. Expected output 
> was something like <#spiderman>
>  # RDFDataMgr doesn't respect the prefix supplied, e.g I manually added 
> prefix "@base", however, the output (C.ttl) still converts the relative 
> entities into their absolute form, whereas I expected it to do something like 
> base:#spiderman at the very least
>  
> I'll be happy to help with the issue if it doesn't fall into the "wont-fix" 
> category.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to