Module Wikidata.Snak

Represents Wikidata Snaks.

Value Types

type wikibase_entityid = {
entity_type : string;
id : string;
numeric_id : int option;
}

Represents a Wikibase entity id

type globecoordinate = {
latitude : float;
longitude : float;
precision : float option;
globe : string;
}

Represents a Globe coordinate

type quantity = {
amount : float;
upper_bound : float option;
lower_bound : float option;
quantity_unit : string;
}

Represents a Quantity

type time = {
time : string;
timezone : int;
before : int option;
after : int option;
calendarmodel : string;
precision : int;
}

Represents a Time

type monolingualtext = {
language : string;
text : string;
}

Represents Monolingual text

Data Types

type data =
| CommonsMedia of string
| GeographicShape of string
| GlobeCoordinate of globecoordinate
| MonolingualText of monolingualtext
| Quantity of quantity
| String of string
| TabularData of string
| Time of time
| URL of string
| ExternalIdentifier of string
| Item of wikibase_entityid
| Property of wikibase_entityid
| MusicalNotation of string
| MathematicalExpression of string
| Lexeme of wikibase_entityid
| Form of wikibase_entityid
| Sense of wikibase_entityid

This type represents a data type according to this page. Data types on Wikidata represent the way that the data should be interpreted, not the format the data is returned in. Note that each variant data type has a corresponding value type, which represents the form the data will be returned in. For example, both MusicalNotation and MathematicalExpression contain a simple string, and Item and Property both are represented by a wikibase_entityid.

Snaks

type t =
| Value of data

A snak with a known value data.

| SomeValue

A snak with some unknown value.

| NoValue

A snak representing an explicit, intentional lack of value.

This represents a Wikidata Snak. Value represents a known value. SomeValue represents an unknown but extent value, like William Shakespeare's date of birth. NoValue represents an explicitly empty value, like the children of Elizabeth I of England, who had no children.

Conversion

val of_string : string -> t

Takes a json string representing a Wikidata snak in the format described here and returns the snak in type t.