Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Framing and @reverse #588

Closed
azaroth42 opened this issue Feb 6, 2018 · 12 comments
Closed

Framing and @reverse #588

azaroth42 opened this issue Feb 6, 2018 · 12 comments

Comments

@azaroth42
Copy link
Contributor

Further to #311, should the predicate that triggered the use of an @reverse property in a frame be removed from its resource to avoid a necessarily circular reference?

For example, if the data shape is:

X includes Y
Z is Y
Z in X

And there's a @reverse of "in" called "proxies" which is then @embed always via a Frame, should the Z resources also have in back to X?

I would have expected:

{
  "id": "X",
  "includes":  ["Y"],
  "uses": [{"id": "Z", "is": "Y"}]
}

But instead the in property is still present in Z.

Use Case: http://openarchives.org/ore/0.9/jsonld#proxies

@gkellogg
Copy link
Member

gkellogg commented Feb 7, 2018

@azaroth42 could you come up with a specific, minimal example which illustrates the issue? You might use my distiller as a way of expressing the actual behavior, at least until the last bits of framing support are in the playground.

@azaroth42
Copy link
Contributor Author

azaroth42 commented Feb 7, 2018

Input JSON-LD:

{
  "@context": {
    "eg": "https://example.org/ns/",
    "reversed": {"@reverse": "eg:forwards", "@type": "@id"},
    "forwards": {"@id": "eg:forwards", "@type": "@id"},
    "Thing": {"@id": "eg:Thing"}
  },
  "@graph": [
    {
      "@id": "http://example.com/1",
      "@type": "Thing"
     },
    {
      "@id": "http://example.com/2",
      "@type": "Thing",
      "forwards": "http://example.com/1"
    }
  ]
}

Input Frame:

{
  "@context": {
    "eg": "https://example.org/ns/",
    "reversed": {"@reverse": "eg:forwards", "@type": "@id"},
    "forwards": {"@id": "eg:forwards", "@type": "@id"},
    "Thing": {"@id": "eg:Thing"}
  },
  "@id": "http://example.com/1",
  "reversed": {"@embed": "@always"}
}

Output JSON-LD:

{
  "@context": {
    "eg": "https://example.org/ns/",
    "reversed": {
      "@reverse": "eg:forwards",
      "@type": "@id"
    },
    "forwards": {
      "@id": "eg:forwards",
      "@type": "@id"
    },
    "Thing": {
      "@id": "eg:Thing"
    }
  },
  "@graph": [
    {
      "@id": "http://example.com/1",
      "@type": "Thing",
      "reversed": {
        "@id": "http://example.com/2",
        "@type": "Thing",
        "forwards": "http://example.com/1"
      }
    }
  ]
}

Note the presence of both reversed and forwards, which is encoding the same triple (2 forwards 1) twice.

@gkellogg gkellogg added this to the JSON-LD 1.1 CG milestone Apr 9, 2018
@gkellogg gkellogg added this to Framing in JSON-LD 1.1 CG Apr 9, 2018
@gkellogg
Copy link
Member

@azaroth42 doesn't look like this was ever resolved or put into the framing spec, do you want to replicate it over there?

@tanuja3088
Copy link

Yes I am also facing an issue regarding the same, About
attached sample input and frame
sample.zip

@gkellogg
Copy link
Member

It's not an error to include this triple, but you can construct a frame which will eliminate it (playground):

{
  "@context": {
    "eg": "https://example.org/ns/",
    "reversed": {"@reverse": "eg:forwards", "@type": "@id"},
    "forwards": {"@id": "eg:forwards", "@type": "@id"},
    "Thing": {"@id": "eg:Thing"}
  },
  "@id": "http://example.com/1",
  "reversed": {
    "@embed": "@always",
    "@explicit": true
  }
}

@tanuja3088
Copy link

tanuja3088 commented May 12, 2020

Hi, I quite a dint understand what changes I need to do in the frame as per my sample example?

@gkellogg
Copy link
Member

I added "@explicit": true to the "reversed" property, so that it only emits those properties explicitly listed.

@tanuja3088
Copy link

tanuja3088 commented May 12, 2020

òk..I tried doing it but still get the same response there is no part info test:hasPart in the output

@gkellogg
Copy link
Member

I can't parse your example, as there may be encoding issues. Can you send a (shortened) link to the playground with your example loaded?

@tanuja3088
Copy link

Here is the URL, the output I get of Playground is not that I get from the jsonld-java

https://tinyurl.com/yd55h8d3

@gkellogg
Copy link
Member

jsonld-java may not support @reverse in frames yet. It's a new feature in 1.1.

@tanuja3088
Copy link

ahh ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants