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

aggressive re-embedding

Open cardinal27513 opened this issue 13 years ago • 3 comments

Also just tried Markus' version of playground and it works http://www.markus-lanthaler.com/jsonld/playground/

.... Just found that this is discussed in https://github.com/json-ld/json-ld.org/issues/119 So it is addressed?

..... If I've an object that will be referenced by multiple places, seems that only the 1st reference will be embedded and the rest wont be...

Here is my examples that I tried out in the playground... ID_0 object has two objects. ID_1 and ID_2.

Then both ID_1 and ID_2, will have one field shared, ID_SHARE_1... Then, if I've a frame as

---> Frame

{
"@context": {"C" : "http://c" },

"@type": "http://root",
"C:has_items" : {}
}

--> framed output... Shouldn't ID_SHARE_1 object should be embedded in both ID_1 and ID_2 objects???

{
  "@context": {
    "C": "http://c"
  },
  "@graph": [
  {
    "@id": "http://ID_0",
    "@type": "http://root",
    "C:has_items": [
    {
      "@id": "http://ID_1",
      "C:has_shared_item": {
        "@id": "http://ID_SHARE_1",
        "C:hasName": "I'm shared"
      }
    },
    {
      "@id": "http://ID_2",
      "C:has_shared_item": {
        "@id": "http://ID_SHARE_1"
      }
    }]
  }]
}

---->> Raw Input

{
"@context": {"C" : "http://c" },

"@graph": [

  {
  "@id" : "http://ID_SHARE_1",
  "C:hasName": "I'm shared"
  },

  {
   "@id": "http://ID_1",
   "C:has_shared_item" : 
    {
      "@id": "http://ID_SHARE_1"
    }
  },
  {
   "@id": "http://ID_2",
   "C:has_shared_item" : 
    {
      "@id": "http://ID_SHARE_1"
    }
  },

  { 
  "@id": "http://ID_0",
  "@type": "http://root",
   "C:has_items": [
      {"@id": "http://ID_1"},
      {"@id": "http://ID_2"}

    ]
  }
]
}

cardinal27513 avatar Dec 21 '12 04:12 cardinal27513

Dave - Will there be any chance that this will be added?

cardinal27513 avatar Jan 12 '13 15:01 cardinal27513

Sorry for the slow response! Yes, I expect it to be added, we just don't have a timeline yet. The library is currently being updated to pass more of the JSON-LD test suite.

dlongley avatar Jan 13 '13 01:01 dlongley

This has been implemented now with framing embed options of: '@last', '@always', '@never', and '@link'. More details can be found here: https://github.com/json-ld/json-ld.org/issues/377

dlongley avatar Feb 11 '15 02:02 dlongley