Comments (5)
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 [ "book:_B", "book:_C", "book:_2", "book:_1", "book:_A" ]
I get different RDF between JSON-LD 1.0 and 1.1 across json-ld-java and titanium. Same for the JSON-LD playground does the same for JSON-LD 1.0 vs 1.1.
See a users@jena thread:
https://lists.apache.org/thread/zl0c6jgxnc9ckmc5pvhcoy72ypyr41fp
Suggestion - could you add a prefix to the data for book:
? The writer tries to use the prefixes to build the context.
It looks like a difference between JSON-LD 1.0 and 1.1.
from jena.
hi @afs ! thanks, indeed it seems ok when parsing with @version: 1.0
. I guess at some point jsonld-java will support 1.1, they seem to be on it.
Note - your data does not have "@ version"
the data is what I get back from Jena, I guess I can live with it for now, but good to know.
from jena.
@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:
<http://example/collection> <http://example/p> "book:ZZZ" .
<http://example/collection> <http://onbetween.ch/3ms/cms#> <http://onbetween.ch/3ms/cms#YYY> .
or 1.1 playground:
<http://example/collection> <http://example/p> "book:ZZZ" .
<http://example/collection> <http://onbetween.ch/3ms/cms#> <book:YYY> .
from jena.
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:
In JSON-LD 1.1, terms will be used as compact IRI prefixes when compacting only if a simple term definition is used where the value ends with a URI gen-delim character, or if their expanded term definition contains an @Prefix entry with the value true. The 1.0 algorithm has been updated to only consider terms that map to a value that ends with a URI gen-delim character.
The operative step is Step 10 in the Create Term Definition Algorithm
Create a new term definition, definition, initializing prefix flag to false, protected to protected, and reverse property to false.
And step 14.2.5:
If term contains neither a colon (:) nor a slash (/), simple term is true, and if the IRI mapping of definition is either an IRI ending with a gen-delim character, or a blank node identifier, set the prefix flag in definition to true.
The operative bit is that this is not a simple term.
This can be changed by adding "@prefix": true
to the term definition (playground link):
{
"@id" : "http://example/collection",
"http://example/p" : [ "book:ZZZ" ],
"book" : [ "book:YYY" ],
"@context" : {
"book" : {
"@id" : "http://onbetween.ch/3ms/cms#",
"@type" : "@id",
"@prefix": true
}
}
}
from jena.
@gkellogg -- thanks for the details.
from jena.
Related Issues (20)
- Why does a query that works in Jena 3.16 but throw an error in Jena 4.10? HOT 4
- MurmurHash3 NoSuchMethodError HOT 3
- Implement RDF Dataset Canonicalization and provide EARL report HOT 1
- 4.10: FesukiAutoModule not loading when running as standalone service HOT 3
- Fuseki File Upload Status Indicator Visibility
- fuseki.Fuseki: jetty.servlet.ServletContextHandler$Context does not implement the requested interface javax.servlet.ServletContext HOT 5
- Standardize the case of language tags HOT 1
- Clearer naming in NodeFactory for string literal creation
- /$/compact/ with deleteOld=true does not remove the old folder (on Windows) HOT 6
- Better support for JSON-LD Titanium development? HOT 3
- ShaclParseException: No sh:path on a property shape HOT 3
- `rdfdiff` with quad support HOT 1
- Forcing usage of caffeine 2.x HOT 2
- Upgrade Apache Lucene library to 9.9.x for jena-text HOT 3
- How to package apache-jena-libs for maven project? Reader not found: TTL HOT 1
- reasoners should support owl:AllDisjointClasses HOT 4
- ARQInternalErrorException during query execution in Jena 4.10.0 HOT 2
- QueryBuilder should generate query syntax trees that correspond to parser output.
- SHACL: Implement ?currentShape and ?shapesGraph for SPARQL validators
- SHACL: Apply imports during cmd validation
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 jena.