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

Framing does not respect constrains on embeded object

Open pchampin opened this issue 6 years ago • 1 comments

I augmented the "library" example with a second book, with a different author. I then tried the following frame:

{
  "@context": {
    "dc11": "http://purl.org/dc/elements/1.1/",
    "ex": "http://example.org/vocab#"
  },
  "@type": "ex:Library",
  "ex:contains": { "dc11:creator": "Homer" }
}

and the playground gives me this unexpected result:

{
  "@context": {
    "dc11": "http://purl.org/dc/elements/1.1/",
    "ex": "http://example.org/vocab#"
  },
  "@graph": [
    {
      "@id": "http://example.org/library",
      "@type": "ex:Library",
      "ex:contains": [
        {
          "@id": "http://example.org/library/the-republic",
          "@type": "ex:Book",
          "ex:contains": {
            "@id": "http://example.org/library/the-republic#introduction",
            "@type": "ex:Chapter",
            "dc11:description": "An introductory chapter on The Republic.",
            "dc11:title": "The Introduction"
          },
          "dc11:creator": null,
          "dc11:title": "The Republic"
        },
        {
          "@id": "http://example.org/library/the-odyssey",
          "@type": "ex:Book",
          "dc11:creator": "Homer",
          "dc11:title": "The Odyssey"
        }
      ]
    }
  ]
}

Note that the book from Homer correctly appears, but the book from Plato also appears, only with "dc11:creator": null... I would expect the following (which is the result given by @gkellogg 's Ruby distiller)

{
  "@context": {
    "dc11": "http://purl.org/dc/elements/1.1/",
    "ex": "http://example.org/vocab#"
  },
  "@graph": [
    {
      "@id": "http://example.org/library",
      "@type": "ex:Library",
      "ex:contains": {
        "@id": "http://example.org/library/the-odyssey",
        "@type": "ex:Book",
        "dc11:creator": "Homer",
        "dc11:title": "The Odyssey"
      }
    }
  ]
}

pchampin avatar Jun 07 '19 15:06 pchampin

Sounds like we should add another test.

gkellogg avatar Jun 07 '19 18:06 gkellogg