json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
857 stars 152 forks source link

infinite recursion in @reverse properties #653

Closed eroux closed 6 years ago

eroux commented 6 years ago

It would be nice to have the same possiblity of infinite recursion in the @reverse properties as there are in non-reverse ones (example), currently recursion only works as many times as the frame defines it (example).

Copy/pasting the examples (and removing @contexts):

in the working case, I have

{
  "@graph": [
    {
      "@id": "bdr:O9TAXTBRC201605",
      "@type": "Taxonomy",
      "taxHasSubClass": [
        {
          "@id": "bdr:O9TAXTBRC201605_0001"
        },
        {
          "@id": "bdr:O9TAXTBRC201605_0010"
        }
      ]
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0001",
      "@type": "Taxonomy",
      "taxHasSubClass": {
        "@id": "bdr:O9TAXTBRC201605_0002"
      }
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0002",
      "@type": "Taxonomy"
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0010",
      "@type": "Taxonomy"
    }
  ]
}

and frame

{ 
  "@id" : "bdr:O9TAXTBRC201605",
  "@context" : {
    "children": { "@reverse": "http://purl.bdrc.io/ontology/core/taxSubclassOf" }, 
    "taxSubclassOf" : {
      "@id" : "http://purl.bdrc.io/ontology/core/taxSubclassOf",
      "@type" : "@id"
    },
    "@vocab" : "http://purl.bdrc.io/ontology/core/",
    "bdr" : "http://purl.bdrc.io/resource/"
  }
}

that produces the nice

{
  "@graph": [
    {
      "@id": "bdr:O9TAXTBRC201605",
      "@type": "Taxonomy",
      "taxHasSubClass": [
        {
          "@id": "bdr:O9TAXTBRC201605_0001",
          "@type": "Taxonomy",
          "taxHasSubClass": {
            "@id": "bdr:O9TAXTBRC201605_0002",
            "@type": "Taxonomy"
          }
        },
        {
          "@id": "bdr:O9TAXTBRC201605_0010",
          "@type": "Taxonomy"
        }
      ]
    }
  ]
}

but for the opposite:

{
  "@graph": [
    {
      "@id": "bdr:O9TAXTBRC201605",
      "@type": "Taxonomy"
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0001",
      "@type": "Taxonomy",
      "taxSubclassOf": "bdr:O9TAXTBRC201605"
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0002",
      "@type": "Taxonomy",
      "taxSubclassOf": "bdr:O9TAXTBRC201605_0001"
    },
    {
      "@id": "bdr:O9TAXTBRC201605_0010",
      "@type": "Taxonomy",
      "taxSubclassOf": "bdr:O9TAXTBRC201605"
    }
  ]
}

and the frame

{
  "@id": "bdr:O9TAXTBRC201605",
  "@context": {
    "children": {
      "@reverse": "http://purl.bdrc.io/ontology/core/taxSubclassOf"
    },
    "taxSubclassOf": {
      "@id": "http://purl.bdrc.io/ontology/core/taxSubclassOf",
      "@type": "@id"
    },
    "@vocab": "http://purl.bdrc.io/ontology/core/",
    "bdr": "http://purl.bdrc.io/resource/"
  },
  "children": {}
}

I'm not getting all the recursion, only

{
  "@graph": [
    {
      "@id": "bdr:O9TAXTBRC201605",
      "children": [
        {
          "@id": "bdr:O9TAXTBRC201605_0001",
          "@type": "Taxonomy",
          "taxSubclassOf": "bdr:O9TAXTBRC201605"
        },
        {
          "@id": "bdr:O9TAXTBRC201605_0010",
          "@type": "Taxonomy",
          "taxSubclassOf": "bdr:O9TAXTBRC201605"
        }
      ],
      "@type": "Taxonomy"
    }
  ]
}
gkellogg commented 6 years ago

Moved to w3c/json-ld-framing#5.