Skip to content

Instantly share code, notes, and snippets.

@ivikash
Last active December 20, 2015 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivikash/6041987 to your computer and use it in GitHub Desktop.
Save ivikash/6041987 to your computer and use it in GitHub Desktop.
Person.jsonld -> Context for Person using schema.org as Vocab and XSD types
{
"@context" : {
"@vocab": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"image" : {
"@type" : "@id"
},
"about": {
"@type": "@id"
},
"address": {
"@type": "@id"
},
"alumni": {
"@type": "@id"
},
"alumniOf": {
"@type": "@id"
},
"birthDate": {
"@type": "xsd:date"
},
"nationality": {
"@type": "@id"
},
"spouse": {
"@type": "@id"
},
"workLocation": {
"@type": "@id"
},
"worksFor": {
"@type": "@id"
}
}
}
@lanthaler
Copy link

All the prefixes that you use need to be defined somewhere. In this case, the declaration for xsd is missing.

@dlongley
Copy link

dlongley commented Aug 6, 2013

I would expect that any property with a range that uses a complex type should be coerced to an @id. For instance, looking at the Person description, I see that address is a PostalAddress, affiliation is an Organization, spouse is a Person, parent is a Person, etc. Things of these types would all be identified by a URL (an @id). You would want to be able to get the values of these properties and "follow" them (and you can because they are URLs) to get more information about them. This is a major part of Linked Data.

So the general rule is probably: if the type for a property value on the schema.org page is a link to a complex type, you should be indicating in the @context that the expected value for the property is an @id (by using "@type": "@id").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment