Re: Question related to JSON-LD

Didn't mean to hit send yet... Continued...

In the playground ( http://json-ld.org/playground/index.html ), I would
assume on the Compaction tab that this JSON-LD input:

{
  "@context": {
    "schema": "http://schema.org/",
    "name": "schema:name",
    "jobTitle": "schema:jobTitle",
    "telephone": "schema:telephone",
    "html": "schema:url"
  },
  "@type": "schema:Person",
  "name": "Jane Doe",
  "jobTitle": "Professor",
  "telephone": "(425) 123-4567",
  "resources": {
    "html": "http://www.janedoe.com"
  }
}

With this new context:

{
  "@context": "http://schema.org/"
}

Should result in:
{
  "@context": "http://schema.org/",
  "@type": "Person",
  "jobTitle": "Professor",
  "name": "Jane Doe",
  "telephone": "(425) 123-4567"
  "url" "http://www.janedoe.com"
}

But instead url is dropped and I get:
{
  "@context": "http://schema.org/",
  "@type": "Person",
  "jobTitle": "Professor",
  "name": "Jane Doe",
  "telephone": "(425) 123-4567"
}

Any ideas? Any help would be appreicated.

Thanks again,
- James



On Tue, May 19, 2015 at 8:15 PM, James Wright <balugajames@gmail.com> wrote:

> Hello Everyone,
>
> First let me say that I really appreciate all the work that was done on
> JSON-LD. Its really awesome.
>
> Now, I have a problem which I can't seem to figure out. Some of the APIs I
> interact with have this sort of pattern or similar:
>
> {
>    "id": "23",
>     "name": "Bob",
>     "resources": {
>        "self": {
>            "ref": "api/collection/23"
>        },
>        "html": {
>            "ref": "html/collection/bob"
>      }
> }
>
> So in this case, the @id of the object is located at the path:
> resources.self.ref
>
> I can't seem to figure out how to map a context so that this works. After
> expansion and compaction I would like this to become:
>
> {
>    "@id": "../api/collection/23",
>    "givenName": "Bob",
>    "webpage": "html/collection/bob"
> }
>
> Essentially, 'resources' is meaningless. I can't seem to find a way to
> represent this.
>
> I can say:
>
> resources: "@graph"
>
> but then I get the following which is not what I want
>
> {
>     "@graph": [ ... ]
> }
>
> Any ideas? Or is this a limitation? Basically it would be nice if there
> was a to say
> - James
>

Received on Friday, 22 May 2015 11:19:07 UTC