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

Generate JSON-LD Context Based on Property Names #65

Open
no-reply opened this issue Oct 24, 2014 · 4 comments
Open

Generate JSON-LD Context Based on Property Names #65

no-reply opened this issue Oct 24, 2014 · 4 comments
Assignees

Comments

@no-reply
Copy link
Member

There is already a capability to a default context to #dump :jsonld by having #jsonld_context return it. A default method (or maybe a mixin?) that generates a context (& framing doc?) from property definitions would be valuable.

@no-reply no-reply self-assigned this Oct 24, 2014
@no-reply no-reply added this to the 1.0 milestone Oct 24, 2014
@gkellogg
Copy link

Presuming that ActiveTriples implements RDF::Enumerable, you should be able to call #dump(:jsonld, standard_prefixes: true), which will create a context based on vocabularies built in to RDF.rb. You can also pass specific prefix mappings.

@no-reply
Copy link
Member Author

Thanks @gkellogg, I always appreciate when you chime in on this project.

We've had good experiences with standard_prefixes: true, with output like this: https://gist.github.com/no-reply/8872f9672a4b31f60fcc

What we're thinking about adding is capacity to do something more like this: https://gist.github.com/no-reply/f425057a660ae910a239 output simply by calling agg.dump :jsonld.

Most of the info needed to setup a default context like the one above is already hiding in AT's properties. So this is about building that out, and maybe adding some optional property configuration to do the rest.

@gkellogg
Copy link

You might look at JSON::LD::Context#from_vocabulary which generates a good context from an RDFS vocabulary, it might help get you closer to something like this.

@dchandekstark
Copy link
Contributor

FWIW, it would also be great to be able to load a JSON-LD context when fetching. So, if http://example.com/foo/bar resolves to a JSON-LD doc, then:

res = ActiveTriples::Resource.new "http://example.com/foo/bar"
res.fetch

would create the properties as used in the doc with the predicates from the context.

Or, maybe you need a class generator for this ...

@no-reply no-reply removed this from the 1.0 milestone Jul 31, 2016
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

3 participants