Skip to content
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

Creating Linked Data from JSON is harder then expected #271

Closed
gcarothers opened this issue Jun 28, 2013 · 7 comments
Closed

Creating Linked Data from JSON is harder then expected #271

gcarothers opened this issue Jun 28, 2013 · 7 comments

Comments

@gcarothers
Copy link

The hardest part of creating Linked Data from JSON is assigning URIs to specific parts of the JSON. In examples this is done by adding @id to specific parts of the JSON. In real world JSON there are often already IDs, however these IDs are NOT URIs, some method for turning them into URIs is required. Happily @id combined with @base works. HOWEVER, it only works as long as there is only a single kind of Resource that needs an URI. Some method of assigning URIs to Resources that are nested with, or coincident with the Resources of the other types. See comments for concrete examples.

@gcarothers
Copy link
Author

https://gist.github.com/gcarothers/5888777 is an example JSON file WITH @ids created based on per-existing fields. However the @ids can't be created via the @context, instead https://gist.github.com/gcarothers/5888789 is used to modify the object tree and create contextual URIs for the Resources.

@gcarothers
Copy link
Author

https://gist.github.com/gcarothers/5888533 is an example of trying to create URIs via a @context that works! ... except judges are happily conflated with cases.

@davidlehn
Copy link
Member

The scoped context idea might also be useful in this use case. See #247 and #262. It might let you have a @context with a different @base for particular properties. In theory perhaps even scoped just on property.id so a global @base could be used elsewhere.

@gkellogg
Copy link
Member

This is somewhat related to issue #262, which may be addressed in a future JSON-LD spec, or in a CG extension. Basically, having the ability to define context elements within term definitions can be used to define a single context, but have things vary for nodes under a given property. This might be used, for example, to set a separate @base for values of "judge", for example.

@lanthaler
Copy link
Member

Probably you should have a look at https://github.com/antoniogarrote/json-ld-macros It allows you to declaratively transform JSON to JSON-LD and is quite flexible

@gkellogg
Copy link
Member

Also see #426.

@gkellogg
Copy link
Member

gkellogg commented Apr 8, 2017

I propose closing this with no change; please 👍 or 👎 to close.

@gkellogg gkellogg closed this as completed May 4, 2017
@gkellogg gkellogg removed this from the JSON-LD 1.1 milestone May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants