语言和RDF类型 (Language and RDF types)

RDF N-Quad允许为字符串值和RDF类型指定一种语言。语言是使用@lang指定的。例如:

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

请参阅如何在查询中处理语言字符串

RDF类型通过标准的^^分隔符附加到字面量值上。例如:

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

受支持的RDF数据类型和存储数据的相应内部类型如下所示:

存储类型Dgraph类型
<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

请参阅RDF Schema类型一节,以了解RDF类型如何影响变更(mutation)和存储。