Re: How to define context for new (custom) properties of JSON document

Looks like some interesting stuff. Unfortunately, I'm not sure if
ontologies can be all three of simple, specific, and standards-compliant,
at the same time.

I created json-ld playground link..
>
I didn't know that gists worked as remote docs! That's great!

 how to define context for properties (keys) that doesn't have a standard
> ontology
>
Congratulations, you probably have to make a new ontology!

If you want simple and specific, the easiest way to blanket capture
otherwise-unmodeled things is with @vocab, take a look at the spec
<http://www.w3.org/TR/json-ld/#default-vocabulary>.

Adding this to your context:

> "@vocab": "http://myapp.com/",
>>
> and removing all your null pairs, as you can read there, will expand:

> "twitterUserId": "x"
>>
> as

> "http://myapp.com/twitterUserId": {"@value": "x"}
>>
>
The issue now is that you have created a new vocabulary, that doesn't map
to any other vocabularies. So how about specific and standards-compliant?


> I lose that the image is gravatarImage not just any image
>
Ah, but that is what you said in your context! The above vocab thing will
make it into a myapp:gravatarimage. If you really need it to be
myapp:gravatarImage and sdo:image, you need to provide an additional
mapping from myapp:gravatarImage to sdo:image...

> "@context": {
> ...
>   "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
>   "gravatarImage": {"@id": "http://myapp.com/gravatarImage",
> "rdf:subPropertyOf": "sdo:image"}
> ...
> }
>

The user of your data would then need to support the RDF class inheritance
stuff, which, while powerful, is not really a thing one should have to
expect to use JSON-LD.

Another way, which is simpler, but not as pretty, would just be to include
it twice:

> "gravatarImage": <url>,
> "imgage": <url>
>

Not sure if this helps, but maybe some look into!

Received on Saturday, 25 October 2014 15:22:45 UTC