Mapping Schema.org vocabulary to JSON Objects

From getSchema

Revision as of 10:16, 7 December 2012 by Admin66 (Talk | contribs)
(diff) ? Older revision | Latest revision (diff) | Newer revision ? (diff)

Jump to: navigation, search

This Page Semantic Annotations

This page or paragraph requires more examples. You can help us by adding it

The Schema.org Vocabulary has the following design principles:

  • The names of the types are unique, e.g., there is exactly one type with the name Person and this class is identified by the URI http://schema.org/Person.
  • The property names are unique i.e. three is exactly one property with the name description.
  • The types are part of a multiple inheritance hierarchy and all properties defined by the ancestors are inherited by the children. There is no inheritance conflict as the names of the properties are unique no matter by which type they are first defined.

For example, a LocalBusiness is a more specific type of Place and a more specific type of Organization, therefore it inherits properties from both parent types (e.g., address from Place and founder from Organization).

JSON is a data format very much used on the Web because of its flexibility of data representation, simple navigability and it is easy for machines to parse and generate it.

JSON is built on two structures[1]:

  • A collection of key/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
    • The key must be unique in the scope of keys and is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. Such a string is very similar with C or Java strings and allows URI/IRI representation.
    • The value is a string in double quotes, or a number, or true or false or null, or a JSON object or an array. These structures can be nested.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

Encoding Rules

Recall any property is encoded as a JSON key. Schema.org does not require ANY cardinality on properties therefore a property may be instantiated none, once or for many times.

  • If the property is not instantiated then it does not occur in the JSON representation
  • If the property is only once instantiated then it will appear as:
    • If the value is a datatype such as Text, Boolean, Date, DateTime, Number, then its lexical representation will be considered as value
  "propertyName":"text"
    • If the value is an object type Country then
  "propertyName":{Country}

where the value is a JSON representation of the corresponding Country instance.

    • When the property is many times instantiated and because JSON keys must be unique in the scope of the object we use an array structure (e.g., when a Person may have many phone numbers of many affiliations and so on).
  "propertyName":[value1, value2,...]

Encoding Person using JSON

{  "additionalType":"URL",  "description":"Text",   "name":Text,   "image":"URL",   "url":"URL",  "awards":"Text",   "interactionCount":"Text",   "jobTitle":"Text",   "affiliation":[{Organization},...],   "worksFor":{Organization},   "alumniOf":{EducationalOrganization},   "memberOf":{Organization},   "contactPoint":{ContactPoint},   "workLocation":{(Place or ContactPoint)},   "homeLocation":{(Place or ContactPoint)},   "gender":"Text",   "email":"Text",   "birthDate":"Date",   "deathDate":"Date",   "nationality":"Country",   "relatedTo":{Person},   "spouse":{Person},   "parents":[{Person}, ...],   "children":[{Person},...],   "siblings":[{Person}...],   "colleagues":[{Person}...],  "knows":[{Person}...],  "performerIn":[{Event},...]   "follows":[{Person}...],    "address":{PostalAddress},   "telephone":["Text",...],   "faxNumber":"Text" }

References

  1. ? JSON, http://json.org

Personal tools

Namespaces

Variants

Actions

Navigation

Toolbox