[jira] [Commented] (JENA-1864) Inconsistent Turtle serializers

2020-04-01 Thread Viresh Gupta (Jira)


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

Viresh Gupta commented on JENA-1864:


Great

> 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
>Assignee: Andy Seaborne
>Priority: Major
> Fix For: Jena 3.15.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (JENA-1864) Inconsistent Turtle serializers

2020-03-31 Thread Viresh Gupta (Jira)


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

Viresh Gupta commented on JENA-1864:


{{> WriterStreamRDFBase}} can acquire a {{Context}} - I've done that my copy 
(small change, but quite a files altered! The wonders of Eclipse signature 
change!) and I can PR that after PR #179 is merged

 

Is there a issue that I can track so that I know when to move forward with the 
custom base printing options?

> 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
>Assignee: Andy Seaborne
>Priority: Major
> Fix For: Jena 3.15.0
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)


[jira] [Commented] (JENA-1864) Inconsistent Turtle serializers

2020-03-29 Thread Viresh Gupta (Jira)


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

Viresh Gupta commented on JENA-1864:


Sure. Works for me.

> 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)


[jira] [Commented] (JENA-1864) Inconsistent Turtle serializers

2020-03-28 Thread Viresh Gupta (Jira)


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

Viresh Gupta commented on JENA-1864:


Thanks for the directions, I've made a WIP PR, 
[https://github.com/apache/jena/pull/719] and it works with both TURTLE_BLOCKS 
and TURTLE_FLAT.

However, I think we need to change the StreamRDF interface to incorporate 
something like `StreamRDF::base(String base, boolean hide_base)`. This is 
already present for prefixes and triples inside StreamRDF.

>From my understanding, calls to prefix() actually emit a prefix to stream, 
>whereas base() wasn't emitting it previously and just setting the 
>NodeFormatter.  Since we don't have any context inside StreamRDFOps, we will 
>have to design StreamRDFOps.sendBaseToStream() which will use 
>StreamRDF::base(base, hide_base) to pass the information from context to 
>writer (via hide_base). 

I'm not yet sure if this is the solution you intended. Mostly concerned about 
changing the definition of the interface. Let me know if this looks right?

 

> 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)


[jira] [Commented] (JENA-1864) Inconsistent Turtle serializers

2020-03-16 Thread Viresh Gupta (Jira)


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

Viresh Gupta commented on JENA-1864:


I see. Thanks for clarifying 2 and pointers on 1. 

And for 3, Indeed removing the `\#` character gets the output in the expected 
format. Also, I didn't find any specifications on when to use the full range of 
escaped characters and when to use the other. Out of curiosity – Is it possible 
to tell NodeFormatterTTL about using escape characters or not? Probably 
unlikely that using absolute IRIs would be an issue to someone, although it 
would save some precious space while serializing to disk.

I'll try to get a patch for 1 up sometime soon. Just to ensure stream writing 
isn't using some complicated and different mechanism:

Patch should add a function `writeBase()` in 
`[writerStreamRDFBase|[https://github.com/apache/jena/blob/bfce1741cb12f9cf544235d32fba6598bc7341b5/jena-arq/src/main/java/org/apache/jena/riot/writer/WriterStreamRDFBase.java#L43]]`
 similar to 
`[TurtleShell|[https://github.com/apache/jena/blob/34cc2b30b1a913da5704e4518387cf014f89ffec/jena-arq/src/main/java/org/apache/jena/riot/writer/TurtleShell.java#L91]]`
 and call it in TurtleWriterBlocks, and similarly new functions for the 
FlatWriter(s)?

> 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)


[jira] [Created] (JENA-1864) Inconsistent Turtle serializers

2020-03-14 Thread Viresh Gupta (Jira)
Viresh Gupta created JENA-1864:
--

 Summary: 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


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)