Language and RDF Types - Mutations

RDF N-Quad allows specifying a language for string values and an RDF type. Languages are written using @lang. For example

<0x01> <name> "Adelaide"@en .
<0x01> <name> "Аделаида"@ru .
<0x01> <name> "Adélaïde"@fr .
<0x01> <dgraph.type> "Person" .

See also how language strings are handled in queries.

RDF types are attached to literals with the standard ^^ separator. For example

<0x01> <age> "32"^^<xs:int> .
<0x01> <birthdate> "1985-06-08"^^<xs:dateTime> .

The supported RDF datatypes and the corresponding internal type in which the data is stored are as follows.

Storage Type Dgraph type <xs:string> string <xs:dateTime> dateTime <xs:date> datetime <xs:int> int <xs:integer> int <xs:boolean> bool <xs:double> float <xs:float> float <geo:geojson> geo <xs:password> password <http://www.w3.org/2001/XMLSchema#string> string <http://www.w3.org/2001/XMLSchema#dateTime> dateTime <http://www.w3.org/2001/XMLSchema#date> dateTime <http://www.w3.org/2001/XMLSchema#int> int <http://www.w3.org/2001/XMLSchema#positiveInteger> int <http://www.w3.org/2001/XMLSchema#integer> int <http://www.w3.org/2001/XMLSchema#boolean> bool <http://www.w3.org/2001/XMLSchema#double> float <http://www.w3.org/2001/XMLSchema#float> float

See the section on RDF schema types to understand how RDF types affect mutations and storage.


This is a companion discussion topic for the original entry at https://dgraph.io/docs/mutations/language-rdf-types/