Skip to content

Commit

Permalink
Adds value-type to resource nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Nov 7, 2014
1 parent 79e5608 commit f306a89
Showing 1 changed file with 36 additions and 5 deletions.
41 changes: 36 additions & 5 deletions data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,52 @@ This document tries to use the same denominations as the
## Sentence trees

A sentence-tree is a tree whose nodes and leafs are objects.
Each node has an attribute type, which determines what the other
Each node has an attribute `type`, which determines what the other
attributes are.

The currently existing types are:

### `resource`
A `resource` is leaf of the tree. It has only one attribute, `value`
that may be any kind of literal (like string, integer...).

Example:
A `resource` is leaf of the tree. It has two primary attributes:
* `value` that is a string representation of the resource (for interoperability).
* `value-type` (optional) that adds information about the type of the entity. Each module can use its own types or use basic types specified just after. Default: `string`.
*
There may be additional attributes depending on the `value-type`.

Simple example:
```
{"type": "resource", "value": "George Washington"}
```

Example with `type`.
```
{"type": "resource", "value": "true", "value-type":"boolean"}
```

Example with `type` and additional attributes.
```
{"type": "resource", "value": "1111-11-11", "value-type":"time", "calendar":"julian"}
```

#### Basic value types
They are inspired by [XML Schema](http://www.w3.org/TR/xmlschema-2/#built-in-datatypes) ones.

##### `string`
A simple string. `value` may be any string.

Additional attributes:
* `language` (optional) the language code in which the `value` is written. Should Follow [RFC 4646](http://tools.ietf.org/html/rfc4646).

##### `boolean`
A bollean. `value` should be in {"true", "false", "1", "0"}.

##### `time`
A point in time. `value` should match [ISO 8601](http://www.iso.org/iso/fr/home/standards/iso8601.htm).

Addtional attributes:
* `calendar` (optional) the calendar of the date. Default: `gregorian`.


### `missing`

An unknown `resource`; also a leaf of the tree.
Expand Down

0 comments on commit f306a89

Please sign in to comment.