-
Notifications
You must be signed in to change notification settings - Fork 642
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
json-ld serialisation and URIs/predicate overlapping #1254
Comments
Hi @fatzh, Jena uses jsonld-java for reading JSON-LD 1.0 and uses titanium-json-ld to parse JSON-LD 1.1. Jena uses jsonld-java for writing JSON-LD (so JSON-LD 1.0). Note - your data does not have "@ version" (space added to not name a GH user!) When I parse the See a users@jena thread: Suggestion - could you add a prefix to the data for It looks like a difference between JSON-LD 1.0 and 1.1. |
hi @afs ! thanks, indeed it seems ok when parsing with
the data is what I get back from Jena, I guess I can live with it for now, but good to know. |
@gkellogg -- Hi Gregg, the 1.0 and 1.1 playgrounds confirm this difference in behaviour for the "book:YYY". If you have a moment, could you point to which of items in https://www.w3.org/TR/json-ld11/#changes-from-10 is causing this? Simplified version: {
"@id" : "http://example/collection",
"http://example/p" : [ "book:ZZZ" ],
"book" : [ "book:YYY" ],
"@context" : {
"book" : {
"@id" : "http://onbetween.ch/3ms/cms#",
"@type" : "@id"
}
}
} gives 1.0 playground:
or 1.1 playground:
|
Yes, this was intentional, as terms were used too liberally as prefixes, which caused unintended consequences. The note in the Changes since 1.0 Recommendation of 16 January 2014 says the following:
The operative step is Step 10 in the Create Term Definition Algorithm
And step 14.2.5:
The operative bit is that this is not a simple term. This can be changed by adding {
"@id" : "http://example/collection",
"http://example/p" : [ "book:ZZZ" ],
"book" : [ "book:YYY" ],
"@context" : {
"book" : {
"@id" : "http://onbetween.ch/3ms/cms#",
"@type" : "@id",
"@prefix": true
}
}
} |
@gkellogg -- thanks for the details. |
First off, thanks for the great software, we use it a lot and it's brilliant ;)
I stumbled upon something today while trying to parse a json-ld response from Jena/Fuseki. I have a test store with a few books, their URIs look like this:
<http://onbetween.ch/3ms/cms#book_1>
.If there's a custom predicate
<http://onbetween.ch/3ms/cms#book>
, there's an overlap with the book URIs and the JSON-LD serialisation is no longer valid :-/ as I get book URIs like this:book:_1
.Here's the very simple CONSTRUCT query that I send to Fuseki (version 4.4.0):
Which is correct, got a simple collection with 5 books.
Now if I request JSON-LD form Fuseki (just adding headers
Accept: application/ld+json
to the query)Fuseki serializes the books like this:
"book" : [ "book:_B", "book:_C", "book:_2", "book:_1", "book:_A" ],
I wasn't sure if that's actually correct json-ld serialisation, but trying on the json-ld playground here I get this interpretation:
Which is incorrect. Should be:
It's a bit of an edge case, but actually for us this may happen when working with organisation specific ontologies.
I'm more of a python dev nowadays but if I can help let me know. If you can confirm it's a bug, I can also look into it, but I'm actually not 100% sure if that's not a JSON-LD spec issue.
Also if the predicate serialisation would be using the prefixes, i.e.
cms:book
, this wouldn't happen, we would havecms:book_1
, something like:What do you think ?
The text was updated successfully, but these errors were encountered: