Package gavo :: Package dm :: Module sil
[frames] | no frames]

Module sil

source code

SIL, the Simple Instance Language, is an attempt to allow data model instances written in a simple, JSON-like language.

Classes
  Atom
a sentinel class for atomic values of roles
  Reference
a sentinel class for roles referencing something else.
  getGrammar
returns a grammar for parsing a SIL object description.
Functions
 
iterparse(silLiteral)
yields parse events for a SIL literal in a string.
source code
 
getAnnotation(silLiteral, annotationFactory)
returns an annotation object parsed from silLiteral.
source code
Variables
  __package__ = 'gavo.dm'
Function Details

iterparse(silLiteral)

source code 

yields parse events for a SIL literal in a string.

The parse events are triples of one of the forms:

* ('attr', roleName, value) add an attribute to the current annotation * ('obj', roleName, type) create a new object object of type * ('coll', type, None) create a new collection annotation (type can be None) * ('item', val, None) add an atomic value to the current collection * ('pop', None, None) finish current annotation and add it to its container

getAnnotation(silLiteral, annotationFactory)

source code 

returns an annotation object parsed from silLiteral.

annotationFactory is a callable that takes attributeName/attributeValue pairs and returns annotations; attributeValue is either an Atom or a Reference in these cases.