jsonld.js icon indicating copy to clipboard operation
jsonld.js copied to clipboard

Issue with compaction in playground

Open jaw111 opened this issue 5 years ago • 0 comments

When I compact this input document:

{
  "@id": "http://example.com/this",
  "http://purl.org/dc/terms/date": "abc123"
}

Against this context:

{
  "@context": {
    "http://purl.org/dc/terms/date": {
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  }
}

The result is:

{
  "@context": {
    "http://purl.org/dc/terms/date": {
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  },
  "@id": "http://example.com/this",
  "http://purl.org/dc/terms/date": "abc123"
}

Which is the following when converted to N-Quads:

<http://example.com/this> <http://purl.org/dc/terms/date> "abc123"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

In this case, one would expect the compacted result would be:

{
  "@context": {
    "http://purl.org/dc/terms/date": {
      "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
    }
  },
  "@id": "http://example.com/this",
  "http://purl.org/dc/terms/date": {
    "@value": "abc123"
  }
}

jaw111 avatar Dec 03 '20 22:12 jaw111