Comments (13)
It doesn't match because the Frame Matching Algorithm doesn't match any of the nodes which are a part of "char".
Consider a simplified use case (playground link):
Input:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/vocab#",
"@version": 1.1
},
"characters": {
"@id": "m3",
"@type": "ContinuousCells",
"label": "Continuous characters",
"format": {
"char": [
{
"@id": "ContinuousCharacter1",
"label": "this is character 1"
},
{
"@id": "ContinuousCharacter2"
},
{
"@id": "ContinuousCharacter3"
},
{
"@id": "ContinuousCharacter4"
},
{
"@id": "ContinuousCharacter5"
}
]
}
}
}
Frame:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/vocab#",
"@version": 1.1
},
"characters": {
"format": {
"char": {
"states": {
"@default": {}
}
}
}
}
}
In this case, we have the sub-frame {"states": {"@default": {}}}
, with each of the inputs with id "ContinuousCharacter?".
The algorithm matches if it has no properties (it has properties, @id
), @type
matches (no @type
), or any property which isn't a keyword matches (only "ContinuousCharacter1" has a property, so it matches).
To get them to match you would need to add "@id": {}
to wildcard match each node having an @id
. With the updated frame it should work:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/vocab#",
"@version": 1.1
},
"characters": {
"format": {
"char": {
"@id": {},
"states": {
"@default": {}
}
}
}
}
}
It does work in my implementation, but doesn't in jsonld.js, which is a bug there.
The expected result is:
{
"@context": {
"@base": "http://example.org/",
"@vocab": "http://example.org/vocab#",
"@version": 1.1
},
"characters": {
"@id": "m3",
"@type": "ContinuousCells",
"label": "Continuous characters",
"format": {
"char": [{
"@id": "ContinuousCharacter1",
"label": "this is character 1",
"states": {}
}, {
"@id": "ContinuousCharacter2",
"states": {}
}, {
"@id": "ContinuousCharacter3",
"states": {}
}, {
"@id": "ContinuousCharacter4",
"states": {}
}, {
"@id": "ContinuousCharacter5",
"states": {}
}]
}
}
}
The matching behavior may be different to that before, but that was never standardized.
from json-ld-framing.
I think this is just a bug in the jsonld.js implementation:
I propose we close and fix it over there. If the fix results in any other tests breaking we can raise a new issue.
from json-ld-framing.
Thanks @gkellogg, that makes sense. The expected result as shown by your implementation looks good!
I had actually tried adding an "@id": {}
to char but as you note, no look on the jsonld.js implementation in playground (which is also what I'm using via R).
from json-ld-framing.
@gkellogg I'm still not getting the expected behavior you document in #58 (comment) when I try your example at https://json-ld.org/playground/ . What's the process for #62 to show up in the playground instance?
from json-ld-framing.
The playground is not up to date, and is being worked on to conform. You might try http://rdf.greggkellogg.net/distiller, which is more up to date.
from json-ld-framing.
@gkellogg Wow, thanks Gregg. Everything is work exactly as expected when I use your version! This resolves a good handful issues I have been having with framing elsewhere.
In my use cases I'm mostly calling against the R bindings @jeroen has written to the javascript library (e.g as linked above). I think we'll just need to point that to the latest version of the 1.1. jsonld.js library -- what's the canonical location for the up-to-date js source?
from json-ld-framing.
For R we need a single JS bundle transpiled to ES5 (many servers run an old version of V8).
from json-ld-framing.
@cboettig jsonld.js is at https://github.com/digitalbazaar/jsonld.js. It's in the process of being updated to latest 1.1 spec. We'll be rolling out releases, and updating the playground, as features get finished. You can check the test runner for skipped tests now. We'll get a test conformance report out soon, I think, so people can more easily follow progress.
@jeroen Feel free to bring up issues over on the jsonld.js project. Not sure if the default bundle goes back to pure ES5. Newer V8 performance is much much better. Benchmarking reports are a work in progress.
from json-ld-framing.
Thanks @davidlehn, really appreciate it! It's wonderful how supportive and helpful Gregg and the rest of your community has been with all this. (From what I can tell, the travis logs there do seem to be running the test added in #62; https://travis-ci.org/digitalbazaar/jsonld.js/jobs/585843847#L1412, so I take that as a good sign it's already got the fix!).
@jeroen Do you think you can bundle this into the R package? Guess we can continue the discussion over at ropensci/jsonld#17
from json-ld-framing.
I have opened a PR that upgrades the R bindings to to jsonld.js 1.8.0: ropensci/jsonld#18. Can you test if this works for you?
from json-ld-framing.
@dlongley @gkellogg Using the 1.8 release from https://cdnjs.com/libraries/jsonld, I still get the same bug documented above (which I also see on the Playground but is all resolved on Gregg's http://rdf.greggkellogg.net/distiller. Perhaps I've done something wrong, or are there any other pointers to where we can get the sources where this has been fixed? Or should we just sit tight and this'll work it's way into the pipes?
from json-ld-framing.
@cboettig The distiller is using a server side ruby library, https://github.com/ruby-rdf/json-ld, and the playground is using a client side javascript library, https://github.com/digitalbazaar/jsonld.js. Unless you want to help port over fixes, you may have to wait. @gkellogg is in the process of helping to port over the ruby fixes to js and py. We'll get them released as soon as we can.
from json-ld-framing.
@davidlehn Thanks for the explanation, that makes sense! We'll keep an eye out then and thanks again for all you folks are doing.
from json-ld-framing.
Related Issues (20)
- Should tests for `@embed`: `@last` be restricted to JSON-LD 1.0? HOT 4
- Framing and Arrays HOT 4
- Ex. 41 Playground doesn't contain `@omitGraph: false` + playground does not apply `@omitGraph` HOT 3
- Pattern Matching HOT 4
- Can frames produce id maps? HOT 2
- Possible typos HOT 2
- Use a property several time when framing HOT 1
- validation errors/warnings HOT 1
- Language map with global context HOT 1
- IANA profile should be `frame` not `framed` HOT 5
- how to use the `frame` and `framed` profiles? HOT 12
- Fix invalid WebIDL HOT 1
- Change "Lexicographical Order" (and related) to "Unicode code point order". HOT 1
- Possible bug with `@json` being treated as invalid `type` in frame HOT 24
- How to use specific value inside a frame to filter out credentials those do not contain that value
- Framing on nested graphs
- Add test for `@graph` keyword aliasing
- more JSON-LD framed examples for performance testing
- Framing to a default language for the entire doc HOT 5
- 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-framing.