undamental ata anguage

A human-readable data format for storing general purpose information

Schemata

Although in the general case, expressing schemata for data documents requires a Turing complete scripting language, many the format of many documents can be expressed fairly simply.

To help with embedded applications, to save people learning multiple languages unnecessarily, and to reduce the number of parseres needed, a schema language for FDL which itself constists of FDL documents is appropriate.

FDS: a schema language in FDL for FDL

Here we present a schema language in FDL, intended to describe FDL documents.

We will start with an example:

Here is a simple FDL document:

@fdl version="1.0" schema="http://fdl.org.uk/fds/people.fds"
person={
 name="Alfred Masters"
 age=22
 sex=male
 parent="Jack Masters"
 parent="Jill Masters"
}

person={
 name="Beth Masters"
 age=18
 sex=female
 parent="Jack Masters"
 parent="Jill Masters"
}

person={
 name="Jack Masters"
 age=46
 sex=male
 parent="unknown"
 parent="unknown"
}

person={
 name="Jill Masters"
 age=45
 sex=female
 parent="unknown"
 parent="unknown"
}
people.fdl

  ...and here's the associated schema:

@fdl version="1.0" schema="http://fdl.org.uk/fds/fds.fds"

# Person schema

# Schema for document root

element:root:{
 contains=(labelled person)
}

# Schemata for other elements

element:person:{
 element:age:{
  type=integer
  ensure=(value ">" -1)
 }

 element:sex:{
  type=identifier
  ensure=(value in (male female))
 }

 type=list
 contains=(1 labelled element:name:(type=string))

 contains=(1 labelled sex)
 contains=(1 labelled age)

 contains=(2 labelled element:parent:(type=string))

 contains=(labelled element:offspring:(type=string))

 contains=(labelled element:friend:(type=string))
}
people.fds

As well as being placed in FDS files, all these directives can also be placed directly in FDL files - as annotations.

More details about FDS will follow shortly.


Tim Tyler | Contact