W3C home > Mailing lists > Public > public-linked-json@w3.org > October 2014

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

From: Nicholas Bollweg <nick.bollweg@gmail.com>
Date: Sat, 25 Oct 2014 11:22:17 -0400
Message-ID: <CACejjWw-Jd35XuuAL1GaRxOKsdCfWdaVVrRSjMU=o=_Ra1HA9w@mail.gmail.com>
To: Zee <fortechie@gmail.com>
Cc: public-linked-json@w3.org
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

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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:18:42 UTC