Code Monkey home page Code Monkey logo

Comments (6)

gkellogg avatar gkellogg commented on June 17, 2024

The other thing complicating JSON-LD => RDF => JSON-LD round-tripping is array ordering. For example, an object with two values for rdf:type will have a random order when re-serialized to JSON-LD, as will any other cases where there are multiple values. This could possibly be addressed by a post-processing step when ordered all such values (being careful not to do this for lists), which would also require a valuator to provide to sort. While this might be important for test evaluation, it's of little value in the real world, and imposes a processing penalty that's probably not worth it.

Same thing for blank-node labels, and something like RDF Dataset Normalization, performed at the JSON-LD level, might be necessary to compare JSON-LD structures with each other.

One possible solution would be to largely abandon JSON to JSON comparisons and always compare the resulting RDF datasets. This would be a change from 1.0, and would not allow comparing non-RDF things such as @data values.

from json-ld-bp.

azaroth42 avatar azaroth42 commented on June 17, 2024

Which is related to this issue where changing the ordering will change the compaction, as different scoped contexts would be chosen.

from json-ld-bp.

iherman avatar iherman commented on June 17, 2024

Can we try to be precise? We have two different issues:

  1. Round tripping to and from an RDF graph
  2. Round tripping to and from a particular RDF syntax, most probably Turtle

On (1), I believe it is true that:

  • Every RDF graph can be put into JSON-LD
  • Some JSON-LD cannot be converted into (2), e.g., the blank node properties cited by @azaroth42.

The more problematic case is (2), also described in #13 (comment).

I think that, as far as the BP document goes, my take is that we should not use non-RDF features. We hardly had any use cases for literal-as-subject or bnode-as-predicates, and users should try to avoid that. I am not sure it is worth going way beyond that in the document.

As for (2), I am not sure what we can say.

from json-ld-bp.

ajs6f avatar ajs6f commented on June 17, 2024

Can we separate out some tasks here?

Provide test cases for each non-round-tripping scenario

is clearly not in-scope for a best practices document. On the other hand, it seems very reasonable to me to offer some advice about problematic constructions here in the BP doc.

Do we actually have any use cases for literal-as-subject or bnode-as-predicates? I'm not asking because I think we do not: I genuinely do not remember hearing any, but I had plenty of chances to miss them! šŸ˜¬

from json-ld-bp.

ajs6f avatar ajs6f commented on June 17, 2024

Given the evolution of the "bnodes-as-predicates" discussion, I'm not entirely sure what we want to say here now. Do we want to say anything about JSON-LD 1.0 that uses bnodes and predicates and what that means for roundtripping?

from json-ld-bp.

iherman avatar iherman commented on June 17, 2024

This issue was discussed in a meeting.

  • No actions or resolutions
View the transcript issue on RDF roundtripping
Benjamin Young: #13
Benjamin Young: 13 minutes left ā€¦
ā€¦ Lets look at 13, the round tripping one
ā€¦ take a minute to go through comments together and then as people have thoughts, chime in
Pierre-Antoine Champin: To be sure ā€¦ the original text of the issue mentions lists of lists which is out of date for lack of support
Benjamin Young: BP should call out when one is required to accomplish it, people can already have json-ld content
Ivan Herman: rob, I think you raised this ā€¦ what do we mean by round-tripping. Strictly rdf model level, or is it from a particular serialization and round trip back tot he closest one?
ā€¦ rdf has ā€œwonderfulā€ feature of a zillion different ways to express it
Rob Sanderson: I was thinking that if you have JSON-LD and you parse it into the abstract graph
ā€¦ then manipulate it and re-serialize it, that you end up at the same place.
ā€¦ does all of the information in the JSON-LD make it into the RDF graph and then back into the output JSON-LD
ā€¦ and then thereā€™s framing to make sure you get it exactly into the same tree structureā€¦or not
ā€¦ if youā€™re JSON-LD with blank nodes and go into RDF and back into JSON-LD then those blank nodes will vanish
ā€¦ so work to be done on this issue is still correct
ā€¦ find the things that are important to note in these scenarios
ā€¦ and document in the best practice: if you want to have your data round-tripable, hereā€™s what you should and shouldnā€™t do
ā€¦ and Greggā€™s comments that follow around array ordering is interestingā€¦especially if youā€™re thinking JSON
ā€¦ and thinking only JSON-LD then you get consistent blank node naming, but not if you go through RDF
Ivan Herman: CURIE in JSON-LD then into Turtle, does the CURIE stay the same? or are the rules different?
Rob Sanderson: I donā€™t know
Pierre-Antoine Champin: the way I read this was round trip between rdf abstract syntax and json-ld
ā€¦ I donā€™t know if I can round trip turtle to turtle
ā€¦ in fact I know that I canā€™t, e.g. the curies, as the implementations donā€™t have a notion of prefixes as theyā€™re not part of the abstract syntax
ā€¦ shouldnā€™t talk about other syntaxes, only abstract and json-ld
Rob Sanderson: +1 to pa
Pierre-Antoine Champin: Maybe itā€™s worth mentioning that ā€¦ other syntaxes have their own problems that we canā€™t address
Benjamin Young: Good points!
ā€¦ do we feel like we have a complete list on the issue?
ā€¦ or can we write in other issues to the issue
ā€¦ the things that weā€™re up against and whether we can solve them
Rob Sanderson: throw in whatever notes you can
Benjamin Young: consolidate and summarize from what youā€™ve read above would be good
ā€¦ or just take that on to make sure the end of the issue we have something to take forward
ā€¦ rather than rereading the whole time

from json-ld-bp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.