[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas/doc odmg.txt
From: |
Daniel E. Baumann |
Subject: |
gnue/geas/doc odmg.txt |
Date: |
Mon, 04 Mar 2002 22:43:06 -0500 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Daniel E. Baumann <address@hidden> 02/03/04 22:43:05
Modified files:
geas/doc : odmg.txt
Log message:
Add the rest of the Meta Object stuff, this could serve as an API spec
for the
"Schema Compiler" or ODL Object Repository for adding user-defined
object types.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/geas/doc/odmg.txt.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
Patches:
Index: gnue/geas/doc/odmg.txt
diff -c gnue/geas/doc/odmg.txt:1.10 gnue/geas/doc/odmg.txt:1.11
*** gnue/geas/doc/odmg.txt:1.10 Sat Mar 2 06:41:35 2002
--- gnue/geas/doc/odmg.txt Mon Mar 4 22:43:05 2002
***************
*** 1438,1441 ****
--- 1438,1971 ----
list<RepositoryObject> children();
+ };
+
+ Visitors
+ ========
+ - visitors provide a convenient "double dispatch" mechanism for
+ traversing the meta objects in the repository
+ - to utilize this mechanism a client must implement a
+ RepositoryObjectVisitor object that responds to the
+ visit_... callbacks in an appropriate manner
+ - then, by passing this visitor to one of the meta objects in the
+ repository, an appropriate callback will occur that may be used as
+ required by the client object
+
+ enum MetaKind {mk_attribute, mk_class, mk_collection,
+ mk_constant, mk_const_operand, mk_enumeration,
mk_exception,
+ mk_expression, mk_interface, mk_literal, mk_member,
mk_module,
+ mk_operation, mk_parameter, mk_primtive_type,
+ mk_relationship,mk_repository, mk_structure,
+ mk_type_definition, mk_union, mk_union_case};
+
+ interface RepositoryObject
+ {
+ void accept_visitor(in RepositoryObjectVisitor
a_repository_object_visitor);
+
+ Scope parent();
+
+ readonly attribute MetaKind meta_kind;
+ };
+
+ interface RepositoryObjectVisitor
+ {
+ void visit_attribute(in Attribute an_attribute);
+ void visit_class(in Class a_class);
+ void visit_collection(in Collection a_collection);
+ void visit_constant(in Constant a_constant);
+ void visit_const_operand(in ConstOperand a_const_operand);
+ void visit_enumeration(in Enumeration an_enumeration);
+ void visit_exception(in Exception an_exception);
+ void visit_expression(in Expression an_expression);
+ void visit_interface(in Interface an_interface);
+ void visit_literal(in Literal a_literal);
+ void visit_member(in Member a_member);
+ void visit_module(in Module a_module);
+ void visit_operation(in Operation an_operation);
+ void visit_parameter(in Parameter a_parameter);
+ void visit_primitive_type(in PrimitiveType a_primitive_type);
+ void visit_relationship(in Relationship a_relationship);
+ void visit_repository(in Repository a_repository);
+ void visit_structure(in Structure a_structure);
+ void visit_type_define(in TypeDefinition a_type_definition);
+ void visit_union(in Union a_union);
+ void visit_union_case(in UnionCase a_union_case);
+ };
+
+ Meta Objects
+ ============
+ - they participate in a definedIn relationship with other meta
+ objects
+ - DefiningScopes and Scopes contain meta objects and have
+ operations for creating, adding and removing meta objects
+
+ typedef string ScopedName;
+
+ interface MetaObject: RepositoryObject
+ {
+ attribute string name;
+
+ attribute string comment;
+
+ relationship DefiningScope definedIn
+ inverse DefiningScope::defines;
+
+ ScopedName absolute_name();
+ };
+
+ enum PrimitiveKind {pk_boolean, pk_char, pk_date, pk_short,
+ pk_unsigned_short, pk_time, pk_timestamp,
+ pk_long, pk_unsigned_long, pk_long_long,
+ pk_float, pk_double, pk_octet, pk_interval,
+ pk_void};
+
+ enum CollectionKind {ck_list, ck_array, ck_bag, ck_set,
+ ck_dictionary, ck_sequence, ck_string };
+
+ interface DefiningScope: Scope
+ {
+ relationship list<MetaObject> defines
+ inverse MetaObject::definedIn;
+
+ exception InvalidType{string reason; };
+ exception InvalidExpression{string reason; };
+ exception CannotRemove{string reason; };
+
+ PrimitiveType create_primitive_type(in PrimitiveKind primitive_kind);
+
+ Collection create_collection(in CollectionKind collection_kind,
+ in Operand max_size,
+ in Type sub_type);
+
+ Dictionary create_dictionary_type(in Type key_type, in Type
sub_type);
+
+ Operand create_operand(in string expression)
+ raises(InvalidExpression);
+
+ Member create_member(in string member_name, in Type
member_type);
+
+ UnionCase create_union_case(in string case_name,
+ in Type case_type,
+ in list<Operand> caseLabels)
+ raises(DuplicateName, InvalidType);
+
+ Constant add_constant(in string name, in Type type,
+ in Operand value)
+ raises(DuplicateName);
+
+ TypeDefinition add_type_definition(in string name, in Type alias)
+ raises(DuplicateName);
+
+ Enumeration add_enumeration(in string name,
+ in list<string> element_names)
+ raises(DuplicateName, InvalidType);
+
+ Structure add_structure(in string name, in list<Member> fields)
+ raises(DuplicateName, InvalidType);
+
+
+ Union add_union(in string name, in Type switch_type,
+ in list<UnionCase> cases)
+ raises(DuplicateName, InvalidType);
+
+ Exception add_exception(in string name, in Structure result)
+ raises(DuplicateName);
+
+ void remove_constant(in Constant object)
raises(CannotRemove);
+
+ void remove_type_definition(in TypeDefinition object)
+ raises(CannotRemove);
+
+ void remove_enumeration(in Enumeration object)
+ raises(CannotRemove);
+
+ void remove_structure(in Structure object)
+ raises(CannotRemove);
+
+ void remove_union(in Union object) raises(CannotRemove);
+
+ void remove_exception(in Exception object)
+ raises(CannotRemove);
+ };
+
+ Modules
+ =======
+ - modules and the schema repository itself are DefiningScopes that
define
+ operations for creating modules and interfaces within themselves
+
+ interface Module: MetaObject, DefiningScope
+ {
+ Module add_module(in string name) raises(DuplicateName);
+
+ Interface add_interface(in string name, in list<Interface> inherits)
+ raises(DuplicateName);
+
+ Class add_class(in string name, in list<Interface> inherits,
+ in class extender)
+ raises(DuplicateName);
+
+ void remove_module(in Module object) raises(CannotRemove);
+
+ void remove_interface(in Interface object)
raises(CannotRemove);
+
+ void remove_class(in Class object) raises(CannotRemove);
+ };
+
+ Operations
+ ==========
+ - operations model behavior that app objects support, they maintain
+ signature list of Parameters and refer to a result type, operations may
+ raise exceptions
+
+ interface Operations: MetaObject, Scope
+ {
+ relationship list<Parameter> signature
+ inverse Parameter::operation;
+
+ relationship Type result
+ inverse Type::operations;
+
+ relationship list<Exception> exceptions
+ inverse Exception:operations;
+ };
+
+ Exceptions
+ ==========
+ - operations may raise Exceptions consequently returning a different set
+ of results
+ - Exceptions refer to a Structure that defines their results and keeps
+ track of the Operations that may raise them
+
+ interface Exception: MetaObject
+ {
+ relationship Structure result
+ inverse Structure::exception_result;
+
+ relationship set<Operation> operations
+ inverse Operation::exceptions;
+ };
+
+ Constants
+ =========
+ - constants provide a mechanism for statically associating values with
+ names in the he repository
+ - value is defined by the an Operand subclass that is either a literal
+ value (Literal), a reference to an another constant (ConstOperand), or
the
+ value of a constant expression (Expression)
+ - each Constant has an associated type and keeps track of the other
+ ConstOperands that refer to it in the repository
+
+ interface Constant: MetaObject
+ {
+ relationship Operand the_Value
+ inverse Operand::value_of;
+
+ relationship Type type
+ inverse Type::constants;
+
+ relationship set<ConstOperand> referenced_by
+ inverse ConstOperand::references;
+
+ relationship Enumeration enumeration
+ inverse Enumeration::elements;
+
+ // Allows constant's actual value to be computed at runtime
+ Object value();
+ };
+
+ Properties
+ ==========
+ - an abstract interface for Attribute and Relationship meta objects
+
+ interface Property: MetaObject
+ {
+ // Associated type of the property
+ relationship Type type
+ inverse Type::properties;
+ };
+
+ Attributes
+ ==========
+ - Attributes maintain simple abstract state, they may be read-only
+
+ interface Attribute: Property
+ {
+ attribute boolean is_read_only;
+ };
+
+ Relationships
+ =============
+ - relationships model bidirectional references between objects
+ - 2 relationship meta objects require to represent each traversal
+ direction in a relationship
+
+ enum Cardinality {c1_1, c1_N, cN_M};
+
+ interface Relationship: Property
+ {
+ relationship Relationship traversal
+ inverse Relationship::traversal;
+
+ // Accessor operation for manipulating traversals
+ Cardinality get_cardinality();
+ };
+
+ Types
+ =====
+ - TypeDefinitions are meta objects that define new names, aliases, or
the
+ types to which they refer
+
+ interface TypeDefinition: Type
+ {
+ relationship Type alias
+ inverse Type::type_defs;
+ };
+
+ - Type meta objects are used to represent information about datatypes,
it
+ contains many relationships which help maintain the referential
integrity
+ of the repository as a whole
+
+ interface Type: MetaObject
+ {
+ relationship set<Collection> collection
+ inverse Collection::subtype;
+
+ relationship set<Dictionary> dictionaries
+ inverse Dictionary::key_type;
+
+ relationship set<Specifier> specifiers
+ inverse Specifier::type;
+
+ relationship set<Union> unions
+ inverse Union::switch_type;
+
+ relationship set<Operation> operations
+ inverse Operation::result;
+
+ relationship set<Property> properties
+ inverse Property::type;
+
+ relationship set<Constant> constants
+ inverse Constant::type;
+
+ relationship set<TypeDefinition> type_defs
+ inverse TypeDefinition::alias;
+ };
+
+ Interfaces
+ ==========
+ - most important types in he repository, define abstract behavior
+ of application objects and contain operations for creating and
+ removing Attributes, Relationships, and Operations within
+ themselves
+ - linked in multiple-inheritance graph with other Inheritance
+ objects by two relationships, inherits and derives
+
+ interface Interface: Type, DefiningScope
+ {
+ struct ParameterSpec
+ {
+ string param_name;
+ Direction param_mode;
+ Type param_type;
+ };
+
+ relationship set<Interface> inherits
+ inverse Interface::derives;
+
+ relationship set<Interface> derives
+ inverse Interface::inherits;
+
+ exception BadParameter{string reason; };
+ exception BadRelationship{string reason; };
+
+ Attribute add_attribute(in string attr_name,
+ in Type attr_type)
+ raises(DuplicateName);
+
+ Relationship add_relationship(in string rel_name,
+ in Type rel_type,
+ in Relationship rel_traversal)
+ raises(DuplicateName, BadRelationship);
+
+ Operation add_operation(in string op_name,
+ in Type op_result,
+ in list<ParameterSpec> op_params,
+ in list<Exception> op_raises)
+ raises(DuplicateName, BadParameter);
+
+ void remove_attribute(in Attribute object)
+ raises(CannotRemove);
+
+ void remove_relationship(in Relationship)
+ raises(CannotRemove);
+
+ void remove_operation(in Operation object)
+ raises(CannotRemove);
+ };
+
+ Classes
+ =======
+ - classes are subtype of Interface whose properties define the
+ abstract state of objects stored in an ODMS
+ - classes are in a single-inheritance hierarchy where they
inherit
+ state and behavior from their extender class
+ - classes may define keys and extents over its instances
+
+ interface Class: Interface
+ {
+ attribute list<string> extents;
+ attribute list<string> keys;
+
+ relationship Class extender
+ inverse Class::extensions;
+
+ relationship Class extensions
+ inverse Class::extender;
+ };
+
+ Collections
+ ===========
+ - types that aggregate variable numbers of elements of a single
+ subtype and provide different ordering, accessing, and comparison
+ behavior
+ - max size specified by constant or constant expression, if
+ unspecified is equal to literal 0
+
+ interface Collection: Type
+ {
+ readonly attribute CollectionKind collection_kind;
+
+ relationship Operand max_size
+ inverse Operand::size_of;
+
+ relationship Type subtype
+ inverse Type::collections;
+
+ boolean is_ordered();
+
+ unsigned long bound();
+ };
+
+ interface Dictionary: Collection
+ {
+ relationship Type key_type
+ inverse Type::dictionaries;
+ };
+
+ Constructed Types
+ =================
+ - elements/types that aggregate others and said to be
+ constructed from those types
+ - ScopedType is abstract interface that consolidates the
+ mechanisms for its subclasses Enumeration, Structure, and
+ Union
+ - Enumerations contain Constants, Structured contain
+ Members, and Unions contain UnionCases
+ - Unions also have a relationship to a switch_type that
+ defines the descriminator of the union
+
+ interface ScopedType: Scope, Type {};
+
+ interface Enumeration: ScopedType
+ {
+ relationship list<Constant> elements
+ inverse Constant::enumeration;
+ };
+
+ interface Structure: ScopedType
+ {
+ relationship list<Member> fields
+ inverse Member::structure_type;
+
+ relationship Exception exception_result
+ inverse Exception::result;
+ };
+
+ interface Union: ScopedType
+ {
+ relationship Type switch_type
+ inverse Type::unions;
+
+ relationship list<UnionCase> cases
+ inverse UnionCase::union_type;
+ };
+
+ Specifiers
+ ==========
+ - used to assign a name to a type in certain contexts, they consolidate
+ these elements for their subclasses
+ - Members, UnionCases, and Parameters are referenced by Structures,
Unions,
+ and Operations, respectively
+
+ interface Specifier: RepositoryObject
+ {
+ attribute string name;
+
+ relationship Type type
+ inverse Type::specifiers;
+ };
+
+ interface Member: Specifier
+ {
+ relationship Structure structure_type
+ inverse Structure::fields;
+ };
+
+ interface UnionCase: Specifier
+ {
+ relationship Union union_type
+ inverse Union::cases;
+
+ relationship list<Operand> case_labels
+ inverse Operand::case_in;
+ };
+
+ enum Direction {mode_in, mode_out, mode_inout};
+
+ interface Parameter: Specifier
+ {
+ attribute Direction parameter_mode;
+
+ relationship Operation operation
+ inverse Operation::signature;
+ };
+
+ Operands
+ ========
+ - form the base type for all constants in the repository
+ - they have a value operation and maintain relationships with other
+ Constants, Collections, UnionCases, and Expressions that refer to them
+ - Literals contain a single literalValue attribute and produce their value
+ directly
+ - ConstOperands produce their value by delegating to their associated
+ constant
+ - Expressions compute their value by evaluating their operator on the
values
+ of their operands
+
+ interface Operand: RepositoryObject
+ {
+ relationship Expression operand_in
+ inverse Expression::the_operands;
+
+ relationship Constant value_of
+ inverse Constant::the_value;
+
+ relationship Collection size_of
+ inverse Collection::max_size;
+
+ Object value();
+ };
+
+ interface Literal: Operand
+ {
+ attribute Object literal_value;
+ };
+
+ interface Expression: Operand
+ {
+ attribute string operator;
+
+ relationship list<Operand> the_operands
+ inverse Operand::operand_in;
};