Comments (6)
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.
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.
Can we try to be precise? We have two different issues:
- Round tripping to and from an RDF graph
- 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.
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.
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.
This issue was discussed in a meeting.
- No actions or resolutions
View the transcript
issue on RDF roundtrippingBenjamin 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)
- Add example on order impact on @protected HOT 8
- Add note on streaming HOT 10
- Recommend using absolute URIs when possible
- Unexpected typed value experience HOT 8
- Proposed renaming and sectioning HOT 5
- Semantic lifting tutorial
- Avoid CURIEs in the data HOT 6
- Best practices for maintaining list order w/o collections. HOT 10
- References to other documents HOT 4
- Name in the example HOT 2
- Example 5? HOT 2
- Example for cache control (Ā§6.1)
- Describe Lists and Compaction HOT 2
- Expand section on "Serializing Large Datasets"
- Extra framing and validation information for extension HOT 2
- Recommendation for included objects? HOT 3
- Update spec status and/or publish? HOT 6
- examples HOT 3
- outdated URL in reference
- test GH action
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from json-ld-bp.