module Thing: sig end
This module provides things with a type, name and description. The type and name combination on a thing is unique. There is a exception to this rule for things with empty names, but those can only be found back through their relations with other things.
Things can be related to each other with 2 types of relations, the parent/child relation and normal relations.
The parent/child relations form a tree with all the things in them. There is a root thing named ('system', 'root') that will become the parent of all the other things. The tree can have extra lines between the nodes (relations with a type and with a numeric parameter and extra_parameter). When a node doesn't have a specific parameter type the parent are searched for that data.
Example:
'system'['root'] with childs:
'system'['wheels']'system'['colour']'colour'['red']'colour'['green']'system'['vehicle']'vehicle'['truck'] relations: ('wheels', 6, with 'system'['wheels']) ('colour' with 'colour'['red'])'vehicle'['cycle'] relations: ('wheels', 2, with 'system'['wheels']) ('colour' with 'colour'['green'])'verhicle'['cycle'] is 'vehicle'['my_cycle'] relation: ('colour' with 'colour'['red'])type t
val init : unit -> unitval create : string -> string -> t -> string -> bool -> tthing_type and name.
With a thing as parent and a description and possibly
with inheritance of relations of parent things.
This also creates a child relation between the parent thing
and the child. A special type of thing is the one where the
name parameter is the empty string. Normally there can only
be one thing with the same type and name but there can be
multiple nameless things. To change the description of a named
thing you have to define the same thing again.val relation : t -> string -> t -> int -> int -> unitthing with relation_type to related_thing.
There are two numbers parameter and extra_parameter
associated with a relation. There can only be one relation of
a specific type between 2 things. Create the same relation twice
to change the parameter and the extra parameter.val remove_relation : t -> string -> t -> unitval remove : t -> unitval execute : unit -> unitval output : Pervasives.out_channel -> t -> unitstreamval input : Pervasives.in_channel -> t -> unitstream as a child of the given
thing. The file should be the xml-like file written by List.output.val compare_file : Pervasives.in_channel -> t -> string -> t -> boolcompare_file stream parent changed_type changed_thing.
Read the given stream and compare it to the child things under parent.
The things that are changed in the file receive a relation to the given
changed_thing with the relation type changed_typeval get : string -> string -> ttype and nameval name : t -> stringval string_type : t -> stringval related : t -> string -> tval parm : t -> string -> intval extra : t -> string -> intval no : t -> string -> intval parent : t -> tval descr : t -> stringval parm_related : t -> string -> int -> tthing with the relation_type and the parameter.val rel : t -> string -> (t * int * int) listthing with the relation_type. The result gives the
list of (thing, parameter, extra-parameter)