RE: Use of full URI for rdf:type instead of @type

Hi Markus,
 
I get the same error.
 
For example JSON-LD input like this:

{
  "@context": {
    "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "@type"
  },
  "@graph": [
    {
      "@id": "http://example.com/conceptSchemes/myTree",
      "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
        "@id": "http://www.w3.org/2004/02/skos/core#ConceptScheme"
      }
    },
    {
      "@id": "http://example.com/conceptSchemes/myTree",
      "http://www.w3.org/2004/02/skos/core#hasTopConcept": {
        "@id": "http://example.com/concepts/1"
      }
    },
    {
      "@id": "http://example.com/conceptSchemes/myTree",
      "http://www.w3.org/2004/02/skos/core#hasTopConcept": {
        "@id": "http://example.com/concepts/2"
      }
    }
  ]
}

Gives the error:
{ "name": "jsonld.SyntaxError", "message": "Invalid JSON-LD syntax; \"@type\"
value must a string, an array of strings, or an empty object.", "details": {
"code": "invalid type value", "value": { "@id":
"http://www.w3.org/2004/02/skos/core#ConceptScheme" } } }
 
So the triple:
 
{
  "@id": "http://example.com/conceptSchemes/myTree",
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": {
    "@id": "http://www.w3.org/2004/02/skos/core#ConceptScheme"
  }
}
 
would need to be:
{
  "@id": "http://example.com/conceptSchemes/myTree",
  "http://www.w3.org/1999/02/22-rdf-syntax-ns#type":
"http://www.w3.org/2004/02/skos/core#ConceptScheme"
}

As mentioned the simplest approach seems to be to ensure "@type" is used in the
JSON-LD input document.

John

> On May 10, 2014 at 1:26 PM Markus Lanthaler <markus.lanthaler@gmx.net> wrote:
>
>
> On Friday, May 09, 2014 10:45 PM, Dave Longley wrote:
> > > Alternatively, I think you could also specify
> > > "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" as an alias for @type
> > > to get the desired effect:
> > >
> > > {
> > > "@context": {
> > > "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "@type"
> > > }
> > > }
>
> That's what I would have proposed as well.
>
>
> > Actually, when I tried this on the playground it threw an error because
> > we don't accept expanded "@id" values for "@type". I have a vague memory
> > of us discussing this during standardization, hopefully we made the
> > right decision here.
>
> Really? What exactly are you doing? You have to add that declaration to the
> input document's context, not the frame. The playground doesn't expose it,
> but the API has an "expandContext" option [1] that you could use to pass
> this in without having to directly modify the input document.
>
> HTH,
> Markus
>
>
> [1] http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-expandContext
>
>
> --
> Markus Lanthaler
> @markuslanthaler
>
>

Received on Sunday, 11 May 2014 07:30:54 UTC