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

Andy Seaborne commented on JENA-1971:
-------------------------------------

Jena 4.5.0 switches from JSON-LD 1.0 (jsonld-java) to JSON-LD 1.1 
(titanium-json-ld).

Output in JSON-LD 1.1 is only moderately "pretty". It only uses prefixes 
defined in the graph or dataset being printed. If there is a prefix for 
http://zam.com/ns/, it does use the prefix name form in both examples.

> JSONLD property compaction bug
> ------------------------------
>
>                 Key: JENA-1971
>                 URL: https://issues.apache.org/jira/browse/JENA-1971
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: JSON-LD
>    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:
> {noformat}
>  <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> .
> {noformat}
> Yields the expected JSONLD:
> {noformat}
> {
>   "@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";
>     }
>   }
> }
> {noformat}
> However, removing the one comment in the TTL and adding an additional triple 
> prevents the compaction of the property "cheesey" from being shortened:
> {noformat}
> {
>   "@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";
>     }
>   }
> }
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to