Wikidata/Data model/JSON

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
Icono de esbozo.svg This page represents the current status of discussions within the Wikidata project team. It is used as a base for development. To avoid confusion please only update it to reflect updates of this status. If you want to discuss it, please use the Wikidata mailing list or the talk page. Thank you!

This document will describe how the Wikidata data model is serialized in JSON internally when saved as a data content type object. For the moment, it is just providing an example.

As an example, an ItemDescription could look as follows (for Phase 1, we omit Statements for now).

{
  "id" : "q7",
  "sitelinks" : {
    "en" : {
      "site" : "en",
      "value" : "Georgia_(country)"
    },
    "de" : {
      "site" : "de",
      "value" : "Georgien"
    }
  },
  "labels" : {
    "en" : {
      "language" : "en",
      "value" : "Georgia"
    },
    "de" : {
      "language" : "de",
      "value" : "Georgien"
    }
  },
  "descriptions" : {
    "en" : {
      "language" : "en",
      "value" : "A central-asian country"
    },
    "de" : {
      "language" : "de",
      "value" : "Land im Kaukasus"
    }
  }
}

Note that this simplifies some aspects of the data model (e.g., the entity is just a short string ID, not an Entity, not even an IRI). In general, this is possible as long as the type of the data is known implicitly. Such simplifications are possible as long as the underlying data (according to the data model) can still be constructed in a clear way in the context where the JSON is used. Moreover, lists (compositions) have been encoded by using particular keys for every entry (language codes in the above case), which is not stated in the data model.

See also [edit]