Internet-Draft JSON semantic format (JSON-NTV) September 2023
THOMY Expires 7 March 2024 [Page]
Workgroup:
Internet Engineering Task Force
Internet-Draft:
draft-thomy-json-ntv-01
Published:
Intended Status:
Informational
Expires:
Author:
P. THOMY
Loco-labs

JSON semantic format (JSON-NTV)

Abstract

This document describes a set of simple rules for unambiguously and concisely encoding semantic data into JSON Data Interchange Format. These rules are based on an NTV (Named and Typed Values) data structure applicable to any simple or complex data. The JSON-NTV format is its JSON translation.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 4 March 2024.

1. Introduction

1.1. Presentation

The semantic level of JSON or CSV shared data remains low. It is often limited to the type of data defined in those exchange formats (strings for CSV formats; numbers, strings, arrays and objects for JSON formats).

JSON-NTV proposes to increase the semantic level of the JSON entities [RFC8259] by adding two additional pieces of information to a JSON entity :

  • name: interpretation of the JSON value in human language or detailed information or link to external information,
  • type: interpretation of the JSON value in a data standard (eg. GeoJSON, datetime), in a data catalog or in a software language.

The NTV entity is thus a triplet with a mandatory element (value) and two additional elements (name, type).

  • For example, Paris location can be represented by :

    • a name : "paris",
    • a type : geoJSON Point coordinates [RFC7946],
    • a value : [2.3522, 48.8566]

The easiest way to add that information into a JSON value is to use a JSON object with a single member. The first term is the additional elements using the syntax JSON-ND [JSON-ND]. The second term is the JSON value.

  • The JSON value of the previous example is:

    • { "paris:point" : [2.3522, 48.8566] }

With this approach, two NTV entities are defined :

  • a primitive entity which is not composed of any other entity,
  • a structured entity which is an ordered sequence of NTV entities.

as well as two JSON formats depending on the presence of the additional elements :

  • simple format when name and type are not present
  • named format when name or type is present
  • Example (entity composed of two other primitive entities):

    • { "cities::point": [[2.3522, 48.8566], [4.8357, 45.7640]] } simple format for primitive entities
    • {"cities::point": {"paris":[2.3522, 48.8566], "lyon":[4.8357, 45.7640]}} named format for primitive entities

A JSON-NTV generator produces a JSON value from a NTV entity and vice versa a JSON-NTV parser transforms a JSON value into a NTV entity.

The conversion between NTV entity and native entity is outside the scope of this note.

1.2. Key design features

The format is focused on simplicity, lightness and web usage.

The key features of this format are the following:

  • JSON as the base format

    • JSON is simple and readable as simple text
    • JSON supports rich structure including nesting and basic types
    • JSON is web-native and very widely used and supported
    • JSON format has binary representation (eg. CBOR format)
  • high semantic level of data

    • wide variety of data typing
    • tree-like and customisable data typing
  • compatibility with existing formats

    • All JSON data is a JsonNTV data
    • All NTVtypes are standard types
  • compatibility with any type of platform

    • types and structures are independent of software and hardware platforms
    • the NTV concept is applicable to all types of "jsonable" data
  • reversibility

    • the NTV entity coming from a JSON value is identical to the NTV entity from which the JSON value comes
    • the JSON representation of an NTV entity is the same as the JSON value used to construct the NTV entity
  • tree structure

    • all NTV entities are trees
    • tree properties are applicable to NTV entities

1.3. Requirements Language

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.

This document also uses the following terms:

JsonType, JsonText, JsonName, JsonValue, JsonObject, JsonMember, JsonElement, JsonArray, JsonNumber, JsonString, JsonFalse, JsonNull, JsonTrue:
These terms are defined as type, text, name, value, object, member, element, array, number, string, false, null, true in the JSON grammar.
JsonPrimitive:
A JsonNumber, JsonString, JsonFalse, JsonTrue or JsonNull.
JsonUnnamed:
A JsonObject without a single member.
JsonNamed:
A JsonObject with a single member.
NTVsingle, NTVlist:

NTVlist and NTVsingle entities can be abbreviated as:

  • NVsingle : entity with default NTVtype "json",
  • NVlist : entity without NTVtype,
  • TVsingle, TVlist : entity without NTVname,
  • Vsingle, Vlist : NVsingle or NVlist without NTVname.

2. NTV structure

2.1. NTV layers

NTV and JsonNTV structures are defined as shown in Figure 1:

  • NTV is a data triplet (NTVname, NTVtype, NTVvalue) that contains all the information needed to build the native entity.
  • JsonNTV is the JsonValue of the NTV entity. JsonNTV is used to build an interchangeable JsonText
Layer 1 JsonText JsonNTV native entity NTV triplet JSON load JSON dump NTV load NTV dump to_obj from_obj
Figure 1: NTV layers

Example:

  • Native layer

    • new_year_2022 = datetime.date(2022, 01, 01) is a Python variable "new_year_2022" corresponding to a datetime object
  • NTV layer

    • ("new_year_2022", "date", "2022-01-01") is a triplet
  • JsonNTV layer

    • { "new_year_2022:date" : "2022-01-01" } is a JsonValue
  • JsonText layer

    • '{"new_year_2022:date":"2022-01-01"}' is a JsonString

2.2. NTV entities

Two categories of entities (one primitive and one structured) are defined:

  • NTVsingle for the primitive entity,
  • NTVlist for an ordered sequence of NTV entities

An NTV entity is therefore a tree where the leaves nodes are the NTVsingle entities and where the inner nodes are the NTVlist entities

2.2.1. NTVsingle

The data triplet of NTVsingle entities is composed by:

  • NTVsingleValue: This NTVvalue is the JSON representation (JsonValue) of the main content of the NTV entity,
  • NTVsingleType: This NTVtype defines the type of entity and the conversion rules between the native entity and the NTV entity. The default NTVtype (defaultNTVtype) is the "json" NTVtype.
  • NTVname: The NTVname is an additional textual information (JsonString)

In other words, any entity that has on the one hand a function of encoding it into a JsonValue and on the other hand a function of creating from a JsonValue can be taken into account. This approach is very general because the majority of computer objects are defined by a list of parameters (e.g. *args in python) and/or a list of key/values (e.g. **kwargs in python) which simply translate into a JsonArray or a JsonObject.

The consistency between NTVsingleValue and NTVsingleType is outside the scope of this note.

2.2.2. NTVlist

The data triplet of NTVlist entities is composed by:

  • NTVlistValue: This NTVvalue is an ordered sequence of included NTV entities.
  • NTVlistType: This NTVtype is a Namespace or a NTVtype to apply to the NTV entities included. This NTVlistType avoids including a NTVtype (if NTVtype) or reduces the length (if Namespace) in the JSON representation (JsonNTV) of the included NTV entities. The default NTVtype (defaultNTVtype) is "None".
  • NTVname: The NTVname is an additional textual information (JsonString)

Example of equivalent JSON representations:

  • where NTVlistType is None for the global NTVlist

    • [ { ":point" : [2.3522, 48.8566]}, {":point" : [4.8357, 45.7640]} ]
  • where NTVlistType is "point" for the global NTVlist

    • { "::point" : [ [2.3522, 48.8566], [4.8357, 45.7640] ] }

If JSON-value is { "::dat" : ["2022-01-28T18-23-54", {":point": [1.1, 2.2] ] } }, the parsers deduce that the first NTVvalue has a "dat" NTVtype and the second a "point" NTVtype.

2.3. NTVtype and Namespace

NTVtype is defined in a nested structure called Namespace.

This structuring of type makes it possible to reference any type of data that has a JSON representation and to consolidate all the shared data structures within the same tree of types.

2.3.1. Namespace

A Namespace is defined by a name (NamespaceName) and a Namespace parent (NamespaceParent). The NamespaceName is unique in the NamespaceParent.

Root node in the Namespace tree is the GlobalNamespace.

  • REQ1:
    NamespaceParent of GlobalNamespace is None.

2.3.2. NTVtype

A NTVtype is defined by a name (NTVtypeName) and a Namespace parent (NamespaceParent). The NTVtype is unique in the NamespaceParent.

NTVtype and the rules to encode or decode NTVvalues MUST be understood by data producers and data consumers. So NTVtype and rules associated have to be defined in a specification shared by a large community. On the other hand, it must be possible for everyone to share data according to their own data structure.

There are therefore two categories of NTVtype:

  • custom NTVtype (and Namespace) which can be created by anyone without control,
  • shared NTVtype (and Namespace) that are defined in a single, shared repository. Each 'shared' Namespace or NTVtype is uniquely managed.

For shared NTVtype, three sub-categories are defined (None, Simple, Generic).

  • The "None" NTVtype is used with NTVlist as defaultNTVtype.
  • Simple NTVtype is associated to conversion rules between a native entity and a NTV entity.
  • Generic NTVtype is equivalent to a set of Simple NTVtype. This indicates that parsers use associated simple NTVtype to decode the JsonNTVvalue.

Example:

  • "dat" is the generic NTVtypeName for "datetime" and "timeposix"
  • If a JSONvalue is { "::dat" : ["2022-01-28T18-23-54", 123456.78] }, the parser deduces that the first entity has a "datetime" NTVtypeName and the second a "timeposix" NTVtypeName.

2.3.3. Representation

A Namespace is defined by a string followed by a point (NamespaceName).

A NTVtype is defined by a string (NTVtypeName).

The representation of a Namespace (NamespaceLongName) is composed by all the nested NamespaceName.

The representation of a NTVtype (NTVtypeLongName) is composed by the NamespaceLongName and the NTVtypeName.

The NTVtypeLongName is defined in Figure 2, which uses ABNF from [RFC5234].


; representation of NtvType and Namespace (LongName)

NTVtypeLongName     = NamespaceParentLongName NTVtypeName

NamespaceLongName   = NamespaceParentLongName NamespaceName
NamespaceParentLongName = NamespaceLongName

NamespaceName   = [ ["$"] JsonString "." ]      ; REQ2 REQ3
NTVtypeName     = ["$"] JsonString              ; REQ3

Figure 2: JsonNTVtype - ABNF

The corresponding rules are as follows:

  • REQ2:
    NamespaceName and NamespaceLongName of GlobalNamespace are empty.
    REQ3:
    NTVtype (or Namespace) has 'custom' category if NTVtypeName (or NamespaceName) begins with '$' or NTVtypeParent has 'custom' category

Example for a representation of an NTVtype defined in two nested Namespace in the global Namespace:

  • "ns1.ns2.type"
  • where:

    • "ns1." is a NamespaceName of a Namespace defined in the global Namespace,
    • "ns2." is a NamespaceName of a Namespace defined in the "ns1" Namespace,
    • "type" is a NTVtypeName of a NTVtype defined in the "ns2" Namespace

Example of custom categories:

  • If "fr." is the name of a Namespace attached to the global Namespace and containing the Namespace 'BAN' and the NTVtype 'dep', then:

    • "fr.dep" is a name of a shared NTVtype,
    • "fr.$test" is a name of a custom NTVtype,
    • "fr.$example.one" is a name of a custom NTVtype
    • "fr.BAN.$test" is a name of a custom NTVtype

3. JsonNTV

3.1. JsonNTV format

The JsonNTV format is the JSON representation of an NTV entity (JsonValue) as defined in Figure 3, which uses ABNF from [RFC5234].


; JSON representation of NTV entities (JsonNTV)

JsonNTV        = JsonNTVnamed / JsonNTVsimple      ; REQ4

JsonNTVnamed   = beginObject JsonNTVMember endObject
JsonNTVsimple  = JsonNTVvalue

JsonNTVMember  = JsonNTVname nSep JsonNTVvalue

; Extract of JSON grammar used in this document

beginArray    = ws "[" ws
beginObject   = ws "{" ws
endArray      = ws "]" ws
endObject     = ws "}" ws
nSep          = ws ":" ws
vSep          = ws "," ws
ws = *( %x20 / %x09 / %x0A / %x0D )

JsonValue  = JsonValue   ; indicates that rule is defined in RFC8259
JsonString = JsonString  ; indicates that rule is defined in RFC8259

Figure 3: JsonNTV - ABNF

The JsonNTV format is built with the NTVname, NTVvalue and the JsonNTVtype.

Two JsonNTV formats are defined:

  • named format (if NTVname or JsonType is not an empty string):

    • { JsonNTVname : JsonNTVvalue }
  • simple format (if NTVname and JsonType are empty string):

    • JsonNTVvalue

The corresponding rules are as follows:

  • REQ4:
    If JsonNTVname is empty, simple format is used

This format allows full compatibility with existing JSON structures:

  • a JsonNumber, JsonString, JsonNull or JsonBoolean is the representation of a Vsingle entity,
  • a JsonObject with a single member is the representation of an NVsingle or TVsingle entity,
  • a JsonArray is the representation of a Vlist entity,
  • a JsonObject without a single member is the representation of a Vlist entity composed with unnamed entities.

Note :

  • JsonNTV : 21, { ":" : 21 } and { ":json" : 21 } represent the same Vsingle entity,

3.2. JsonNTVname

JsonNTVname is the concatenation of NTVname and JsonSepType.

JsonSepType is composed with the separator singleSep or listSep and the JsonNTVtype.

JsonNTVname and JsonSepType are defined in Figure 4, which uses ABNF from [RFC5234].


; JSON representation of NTVname and NTVtype (JsonNTVname)

JsonNTVname = NTVname JsonSepType
JsonSepType = [singleSep [JsonNTVtype]]/[listSep JsonNTVtype]
    ; REQ5 REQ6

NTVname = JsonString

singleSep   = ":"      ; NTVsingle separator
listSep     = "::"     ; NTVlist separator

Figure 4: JsonNTVname - ABNF

For NTVsingle entities:

  • REQ5:

    If JsonNTVtype is not "json", JsonSepType is identical to singleSep joined with JsonNTVtype,

    else if JsonNTVvalue is not a JsonArray and not a JsonUnnamed, JsonSepType is empty,

    else JsonSepType is identical to singleSep.

For NTVlist entities:

  • REQ6:

    If JsonNTVtype is not empty, JsonSepType is identical to listSep joined with JsonNTVtype

    else JsonSepType is empty.

3.3. JsonNTVtype

The JSON representation of a NTVtype (JsonNTVtype) is a compact representation of the NTVtype in the context of the NTVtypeParent.

The JsonNTVtype is defined in Figure 5, which uses ABNF from [RFC5234].


; JSON representation of NtvType (JsonNTVtype)

JsonNTVtype = [ NTVtypeLongName / relativeNTVtypeLongName ]
    ; REQ7

relativeNTVtypeLongName = *NamespaceName NTVtypeName
    ; REQ7

Figure 5: JsonNTVtype - ABNF

The corresponding rules are as follows:

  • REQ7:

    if NTVtype is identical to NTVtypeParent, JsonNTVtype is empty,

    else if NTVtypeParent is a Namespace and if NTVtype is including in NTVtypeParent, JsonNTVtype is the NTVtypeLongName relative to the NTVtypeParent.

    else JsonNTVtype is the NTVtypeLongName

Example:

  • If "fr." is the name of a Namespace attached to the global Namespace and containing the NTVtype 'dep', then:

    • { "::fr." : { "department1:dep": "name1", "department2:dep": "name2" } } is a valid JsonNTV representation.

3.4. JsonNTVvalue

The JsonNTVvalue is the JsonValue representation of NTVvalue as defined in Figure 6, which uses ABNF from [RFC5234].


; JSON representation of NTVvalue (JsonNTVvalue)

JsonNTVvalue       = JsonNTVsingleValue / JsonNTVlistValue

JsonNTVsingleValue = NTVsingleValue
JsonNTVlistValue   = JsonNTVarrayValue / JsonNTVobjectValue
    ; REQ8

JsonNTVarrayValue  = beginArray ListJsonNTVvalue endArray
ListJsonNTVvalue   = [JsonNTV  *( vSep JsonNTV )]
JsonNTVobjectValue = beginObject ListJsonNTVmember endObject
ListJsonNTVmember  = [JsonNTVMember *( vSep JsonNTVMember)]

NTVsingleValue     = JsonValue

Figure 6: JsonNTVvalue - ABNF

For a NTVsingle, JsonNTVvalue is the NTVvalue.

For a NTVlist, JsonNTValue has two representations:

  • a JsonArray where JsonElements are the JsonNTV of included NTV entities,
  • a JsonObject where the JsonMembers are the JsonMembers of the JsonNTV of included NTV entities.

The corresponding rules are as follows:

  • REQ8:

    if NTVlistValue has more than one NTV entities and if all NTVname are different and not empty, JsonNTVobject is used,

    else JsonNTVarray is used

Example:

  • { ":point" : [2.3522, 48.8566], ":point" : [4.8357, 45.7640] } is not a valid JsonNTV

4. Examples

Examples of JsonNTV representation of NTV entities:

Vsingle :

  • "lyon"
  • 52.5
  • { ":" : [4.8357, 45.7640] }

NVsingle :

  • { "city" : "paris" }
  • { "paris:" : [4.8357, 45.7640] }

TVsingle:

  • { ":point" : [4.8357, 45.7640] }

NTVsingle:

  • { "paris:point" : [2.3522, 48.8566] }
  • { "paris:ntv" : { "coordinate:point" : [4.8357, 45.7640] } }

Vlist (composed with JsonArray):

  • [4, 45]
  • ["paris"]
  • [ [2.3522, 48.8566], {"lyon" : [4.8357, 45.7640]} ]
  • [ { ":point" : [2.3522, 48.8566]}, {":point" : [4.8357, 45.7640]} ]
  • []

Vlist (composed with JsonObject) :

  • { "name": "white", "firstname":"walter", "surname":"heisenberg" }
  • { "paris:point" : [2.3522, 48.8566] , "lyon" : "france"}
  • { "paris" : [2.3522, 48.8566], "" : [4.8357, 45.7640]}
  • { }

NVlist :

  • { "simple list": [4, 45.7]}
  • { "cities": [{":point": [2.3522, 48.8566]}, {":point": [4.8357, 45.7640]}]}

TVlist :

  • { "::point": [[2.3522, 48.8566], {"lyon" : [4.8357, 45.7640]} ] }
  • { "::dat": [ "2022-01-28T18-23-54Z", "2022-01-28", 1234.78 ] }

NTVlist :

  • { "cities::point": [[2.3522, 48.8566], {"lyon": [4.8357, 45.7640]}] }
  • { "generic date::dat": [ "2022-01-28T18-23-54Z", "2022-01-28", 1234.78]}
  • { "various::point": [ [2.3, 48.8], { ":date": "2022-01-28"}, {":json": 25 }, { "another NTVlist::json": [1,2,3]} ]}

NTVlist and NVlist (composed with JsonObject) :

  • { "cities::point": { "paris": [2.352, 48.856], "lyon": [4.835, 45.764]}}
  • { "cities": {"paris:point": [2.3522, 48.8566] , "lyon": "france"}}

5. Parsing a JsonValue

JsonValue is parsed according to JSON structure (from root to leaves).

Several steps are considered:

  • JSON decoding
  • NTV entity decoding
  • NTVvalue decoding
  • NTVtype decoding

5.1. JSON decoding

This part is not detailed and consists of:

  • exploit the JSON structure to identify JsonNTVname and JsonNTVvalue,
  • extract the following data from the JsonNTVname string: JsonNTVtype, NTVname and singleSep or listSep

5.2. NTV entity decoding

The NTV entity is inferred from the JSON structure of JsonValue or JsonNTVvalue:

  • PARS1:
    The tables Table 1 and Table 2 define the entity identification rules (NTVsingle or NTVlist)
Table 1: Decoding JsonValue
JsonValue NTV entity
JsonPrimitive Vsingle
JsonUnnamed Vlist
JsonArray Vlist
JsonNamed see Table 2
Table 2: Decoding JsonNTVvalue
Separator JsonNTVvalue NTV entity
None JsonPrimitive NVsingle
None JsonNamed NVsingle
None JsonUnnamed NVlist
None JsonArray NVlist
":" JsonValue TVsingle or NTVSingle
"::" JsonUnnamed NVlist or TVlist or NTVlist
"::" JsonArray NVlist or TVlist or NTVlist

5.3. NTVvalue decoding

The NTVvalue is inferred from the JsonNTVvalue:

  • PARS2:
    The NTVvalue of NTVsingle is the JsonNTVvalue.
    PARS3:
    The NTVvalue of NTVlist is the list of NTV entities parsed for each JsonElement or JsonMember including in the JsonNTVvalue.

5.4. NTVtype decoding

NTVtype is inferred from the JsonNTVtype:

  • PARS4:

    If JsonNTVtype is a valid NTVtypeLongName NTVtype is the decoded JsonNTVtype,

    else NTVtype is "json" NTVtype if concatened ParentNTVtypeLongName with JsonNTVtype is empty,

    else NTVtype is the decoded of concatenation of ParentNTVtypeLongName with JsonNTVtype if it is a valid NTVtypeLongName,

    else NTVtype is the defaultNTVtype

The [JSON-NTV] repository gives some examples of NTV usage.

6. NTV extended structure

The NTVvalue of NTV entities are JsonValue. In the NTV extended structure, NTVvalue can be every kind of data.

With this structure, the NTV representation is a "json like" data where:

  • JsonNTVvalue is always NTVvalue,
  • JsonNTVtype is optional (if NTVtype can be deduced from the NTVvalue),
  • JsonNTVname is optional (if NTVname can be deduced from the NTVvalue).

Examples of NTV extended representation:

    • { "date object" : [ datetime.date(2022, 1, 18), datetime.date(2023, 1, 12) ] }

  • this "json like" structure can be converted in JsonNTV format:
    • { "date object::date" : [ "2022-01-18", "2023-01-12" ] }

7. IANA Considerations

Any JsonValue is a JsonNTVValue and conversely, any JsonNTVvalue is a JsonValue.

Thus, any JSON data may or may not be treated as JsonNTV data, so there is no need to create a specific MIME media type for JsonNTV.

All properties of the MIME media type "application/json" are applicable.

8. Security Considerations

The format used for NTV data exchanges is the JSON format. So, all the security considerations of [RFC8259] apply.

The NTV structure provides no cryptographic integrity protection of any kind.

9. References

9.1. Normative References

[RFC7946]
Butler, H., Daly, M., Doyle, A., Gillies, S., Hagen, S., and T. Schaub, "The GeoJSON Format", RFC 7946, DOI 10.17487/RFC7946, , <https://www.rfc-editor.org/info/rfc7946>.
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
[RFC5234]
Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, DOI 10.17487/RFC5234, , <https://www.rfc-editor.org/info/rfc5234>.
[RFC8259]
Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, , <https://www.rfc-editor.org/info/rfc8259>.
[RFC3339]
Klyne, G. and C. Newman, "Date and Time on the Internet: Timestamps", RFC 3339, DOI 10.17487/RFC3339, , <https://www.rfc-editor.org/info/rfc3339>.

9.2. Informative References

[JSON-ND]
Kleidon, G., "JSON-ND", , <https://github.com/glenkleidon/JSON-ND>.
[JSON-NTV]
Thomy, P., "JSON-NTV", , <https://github.com/loco-philippe/NTV#readme>.
[OLC]
"Google", "Open Location Code", , <https://github.com/google/open-location-code>.
[W3C_TAB]
"W3C", "Recommendation : Model for Tabular Data and Metadata on the Web", 17 December 2015, <https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/>.
[ISO_3166-1_alpha-2]
"ISO", "Codes for the representation of names of countries and their subdivisions - Part 1: Country code", , <https://www.iso.org/standard/72482.html>.

Appendix A. Global NTVtype and Namespace

The structure of NTVtype by Namespace makes it possible to have NTVtype or Namespace corresponding to recognized standards at the global level.

A standard NTVtype / Namespace is a NTVtype / Namespace defined in the Global Namespace.

The standard NTVtype and Namespace are listed below.

A.1. Json

Json NTVtype have a generic NTVtype : "json"

Table 3: Json NTVtype
NTVtypeName (generic) NTVvalue example NTVvalue
json generic NTVtype
number (json) JsonNumber [RFC8259] 10
boolean (json) JsonBoolean [RFC8259] "true"
null (json) JsonNull [RFC8259] "null"
string (json) JsonString [RFC8259] "value"
array (json) JsonArray [RFC8259] [1.1, 2.2]
object (json) JsonObject [RFC8259] {"value1": 1, "value2": 2}

A.2. Numbers

Table 4: Numbers NTVtype
NTVtypeName NTVvalue comment
int JsonNumber [RFC8259] integer
int8, int16, int32, int64 JsonNumber [RFC8259] signed integer
uint8, uint16, uint32, uint64 JsonNumber [RFC8259] unsigned integer
float JsonNumber [RFC8259] floating point real
float16, float32, float64 JsonNumber [RFC8259] floating point real

A.3. Datation

Datation NTVtype have a generic NTVtype : "dat"

Table 5: Datation NTVtype
NTVtypeName (generic) NTVvalue example NTVvalue
year fullyear [RFC3339] 1998
month month [RFC3339] 10
day mday [RFC3339] day of month 21
wday wday [RFC3339] day of week 7
yday yday [RFC3339] day of year 360
week week [RFC3339] 38
hour hour [RFC3339] 20
minute minute [RFC3339] 18
second second [RFC3339] 54
dat generic NTVtype
date (dat) date [RFC3339] "2022-01-28""
time (dat) timespec-base [time-fraction][RFC3339] "T18:23:54", "18:23", "T18"
timetz (dat) timespec-base [time-fraction] time-zone[RFC3339] "T18:23:54+0400"
datetime (dat) iso-date-time (without time-zone)[RFC3339] "2022-01-28T18-23-54"
datetimetz (dat) iso-date-time (with time-zone)[RFC3339] "2022-01-28T18-23-54+0400"

A.4. Period and Duration

Table 6: Period and Duration NTVtype
NTVtypeName NTVvalue example NTVvalue
duration duration [RFC3339] "P3Y6M4DT12H30M5S"
timearray JsonArray

[dat1, dat2]

dat1, dat2 have "dat" NTVtypeName

period period [RFC3339]

"2022-01-01 / 2022-01-30"

"2022-01-01 / P3Y6M4DT12H30M5S"

A.5. Location

Location NTVtype have a generic NTVtype : "loc".

The CRS (Coordinate Reference Systems) is geographic, using the World Geodetic System 1984 (WGS 84) datum, with longitude and latitude units of decimal degrees (EPSG:4326).

Table 7: Location NTVtype
NTVtypeName (generic) NTVvalue example NTVvalue
loc generic NTVtype
point (loc) Point coordinates [RFC7946] [ 5.12, 45.256 ] (lon, lat)
multipoint MultiPoint coordinates [RFC7946]

[pt1, pt2, pt3]

ptx has "point" NTVtypeName

line (loc) LineString coordinates [RFC7946]

[pt1, pt2, pt3]

ptx has "point" NTVtypeName

multiline MultiLineString coordinates [RFC7946]

[li1, li2, li3]

lix has "line" NTVtypeName

polygon (loc) Polygon coordinates [RFC7946]

[rg1, rg2, rg3]

rgx has "line" NTVtypeName (ring)

multipolygon (loc) MultiPolygon coordinates [RFC7946]

[pl1, pl2, pl3]

plx has "polygon" NTVtypeName

bbox (loc) Bbox coordinates [RFC7946] [ -10.0, -10.0, 10.0, 10.0 ]
geojson (loc) geoJSON object [RFC7946] {"type": "point", "coordinates": [40.0, 0.0]}
codeolc (loc) Open Location Code [OLC] "8FW4V75V+8F6"

A.6. Structured data

Table 8: Structured NTVtype
NTVtypeName NTVvalue
row row [W3C_TAB]
field column [W3C_TAB]
tab table [W3C_TAB]
ntv JsonNTV

The data structure associated to this NTVtypeName are defined in specific document.

A.7. Normalized String

Table 9: Structured NTVtype
NTVtypeName NTVvalue example NTVvalue
uri URI (RFC3986)

"https://www.ietf.org/rfc/rfc3986.txt"

"urn:uuid:f81d4fae-7dec-11d0-a765-00a0c91e6bf6"

"geo:13.4125,103.86673" (RFC5870)"

"info:eu-repo/dai/nl/12345"

"mailto:John.Doe@example.com"

"news:comp.infosystems.www.servers.unix"

email adress (RFC5322) "John Doe <jdoe@machine.example>"
file file-hier-part (RFC8089)

"///path/to/file"

"//host.example.com/path/to/file"

Keywords are not defined as Normalized String (eg. "id", "mandatory", "units"), they can be used as custom NTVtype (eg. "$id", "$mandatory", "$units")

A.8. Namespace

The global Namespace includes Namespaces for countries, dependent territories and special areas as defined in [ISO_3166-1_alpha-2]

The JsonNamespace for those Namespace is composed by the two digits of the country following by a dot.

Example :

  • "fr." is the France JsonNamespace
  • "un." is The United Nations JsonNamespace

Each Namespace defines a list of included NTVtype and Namespace.

A.9. Custom NTVtype and Namespace

Custom NTVtype and Namespace can be created in any Namespace.

Table 10 below presents some examples of custom NTVtype.

Table 10: Examples of custom NTVtype
JsonNTVtype comment or JsonNTV example
"$id"

defined in the global Namespace

eg. { ":$id": 5426849" }

"$iata"

IATA airport code

eg. {"Paris Nord:$iata": "CDG"}

"$uic.station"

UIC station code

eg. {"Nantes station:$uic.station" : "8748100"}

"fr.$city"

NTVtype "city" in "fr." Namespace

eg. {":fr.$city" : "Paris"}

"$schemaorg."

"schemaorg" catalog

eg. { ":$schemaorg.propertyID": "NO2" }

{ ":$schemaorg.unitText": "mg/m3"}

"$darwincore."

"darwincore" catalog

eg. { ":$darwincore.acceptedNameUsage": "Tamias minimus" }

Appendix B. Complete ABNF notation


; representation of NtvType and Namespace (LongName)

NTVtypeLongName     = NamespaceParentLongName NTVtypeName

NamespaceLongName   = NamespaceParentLongName NamespaceName
NamespaceParentLongName = NamespaceLongName

NamespaceName   = [ ["$"] JsonString "." ]      ; REQ2 REQ3
NTVtypeName     = ["$"] JsonString              ; REQ3

; JSON representation of NTV entities (JsonNTV)

JsonNTV        = JsonNTVnamed / JsonNTVsimple      ; REQ4

JsonNTVnamed   = beginObject JsonNTVMember endObject
JsonNTVsimple  = JsonNTVvalue

JsonNTVMember  = JsonNTVname nSep JsonNTVvalue

; Extract of JSON grammar used in this document

beginArray    = ws "[" ws
beginObject   = ws "{" ws
endArray      = ws "]" ws
endObject     = ws "}" ws
nSep          = ws ":" ws
vSep          = ws "," ws
ws = *( %x20 / %x09 / %x0A / %x0D )

JsonValue  = JsonValue   ; indicates that rule is defined in RFC8259
JsonString = JsonString  ; indicates that rule is defined in RFC8259

; JSON representation of NTVname and NTVtype (JsonNTVname)

JsonNTVname    = NTVname JsonSepType
JsonSepType    = [singleSep [JsonNTVtype]] / [listSep JsonNTVtype]
    ; REQ5 REQ6

NTVname = JsonString

singleSep   = ":"      ; NTVsingle separator
listSep     = "::"     ; NTVlist separator

; JSON representation of NtvType (JsonNTVtype)

JsonNTVtype = [ NTVtypeLongName / relativeNTVtypeLongName ]
    ; REQ7

relativeNTVtypeLongName = *NamespaceName NTVtypeName
    ; REQ7

; JSON representation of NTVvalue (JsonNTVvalue)

JsonNTVvalue       = JsonNTVsingleValue / JsonNTVlistValue

JsonNTVsingleValue = NTVsingleValue
JsonNTVlistValue   = JsonNTVarrayValue / JsonNTVobjectValue
    ; REQ8

JsonNTVarrayValue  = beginArray ListJsonNTVvalue endArray
ListJsonNTVvalue   = [JsonNTV  *( vSep JsonNTV )]
JsonNTVobjectValue = beginObject ListJsonNTVmember endObject
ListJsonNTVmember  = [JsonNTVMember *( vSep JsonNTVMember)]

NTVsingleValue     = JsonValue

Figure 7: Collected ABNF grammar

Author's Address

Philippe THOMY
Loco-labs
476 chemin du gaf de Famian
84 500 BOLLENE
France