[ 
https://issues.apache.org/jira/browse/JENA-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne updated JENA-1971:
--------------------------------
    Description: 
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}

  was:
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";
    }
  }
}



> 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.3.4#803005)

Reply via email to