You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by "Erich Bremer (Jira)" <ji...@apache.org> on 2020/09/30 12:36:00 UTC

[jira] [Commented] (JENA-1971) JSONLD compaction bug

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

Erich Bremer commented on JENA-1971:
------------------------------------

Further, use of opts.setUseNativeTypes(Boolean.TRUE); doesn't seem to do anything as all numbers are exported as strings.

> JSONLD compaction bug
> ---------------------
>
>                 Key: JENA-1971
>                 URL: https://issues.apache.org/jira/browse/JENA-1971
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 3.16.0
>         Environment: The code and data used can be found at:
>  
> https://github.com/ebremer/jenabug/blob/master/src/main/java/com/demo/JSONLDBUG.java
>            Reporter: Erich Bremer
>            Priority: Major
>
> Exporting this TTL from a Model:
>  <http://me.com>  <http://zam.com/ns/cheesey> "WOW" .
> #<http://me.com>  <http://zam.com/ns/cheesey>  ( "png" "jpg" "tif" "gif" ) .
> <http://notme.com> <http://zam.com/ns/cheesey>  ( "png" "jpg" "tif" "gif" ) .
> <http://www.twotowers.com/a>
>         <http://shadowfax.com/ns/height>
>                 "262144"^^<http://www.w3.org/2001/XMLSchema#int> ;
>         <http://shadowfax.com/ns/width>
>                 "262144"^^<http://www.w3.org/2001/XMLSchema#int> .
> Yields the expected JSONLD:
> {
>   "@graph" : [ {
>     "@id" : "http://me.com",
>     "cheesey" : "WOW"
>   }, {
>     "@id" : "http://notme.com",
>     "cheesey" : {
>       "@list" : [ "png", "jpg", "tif", "gif" ]
>     }
>   }, {
>     "@id" : "http://www.twotowers.com/a",
>     "height" : "262144",
>     "width" : "262144"
>   } ],
>   "@context" : {
>     "rest" : {
>       "@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",
>       "@type" : "@id"
>     },
>     "first" : {
>       "@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#first"
>     },
>     "cheesey" : {
>       "@id" : "http://zam.com/ns/cheesey"
>     },
>     "width" : {
>       "@id" : "http://shadowfax.com/ns/width",
>       "@type" : "http://www.w3.org/2001/XMLSchema#int"
>     },
>     "height" : {
>       "@id" : "http://shadowfax.com/ns/height",
>       "@type" : "http://www.w3.org/2001/XMLSchema#int"
>     }
>   }
> }
> However, removing the one comment in the TTL and adding an additional triple prevents the compaction of the property "cheesey" from being shortened:
> {
>   "@graph" : [ {
>     "@id" : "http://me.com",
>     "http://zam.com/ns/cheesey" : [ {
>       "@list" : [ "png", "jpg", "tif", "gif" ]
>     }, "WOW" ]
>   }, {
>     "@id" : "http://notme.com",
>     "http://zam.com/ns/cheesey" : {
>       "@list" : [ "png", "jpg", "tif", "gif" ]
>     }
>   }, {
>     "@id" : "http://www.twotowers.com/a",
>     "height" : "262144",
>     "width" : "262144"
>   } ],
>   "@context" : {
>     "rest" : {
>       "@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest",
>       "@type" : "@id"
>     },
>     "first" : {
>       "@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#first"
>     },
>     "cheesey" : {
>       "@id" : "http://zam.com/ns/cheesey",
>       "@type" : "@id"
>     },
>     "width" : {
>       "@id" : "http://shadowfax.com/ns/width",
>       "@type" : "http://www.w3.org/2001/XMLSchema#int"
>     },
>     "height" : {
>       "@id" : "http://shadowfax.com/ns/height",
>       "@type" : "http://www.w3.org/2001/XMLSchema#int"
>     }
>   }
> }



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