# Path: bridgepoint/ooaofooa.py
# class OoaOfOoaException(Exception):
# class Domain(xtuml.MetaModel):
# class ModelLoader(xtuml.ModelLoader):
#     def __init__(self, id_generator=None):
#     def add_symbol(self, name, handle):
#     def find_symbol(self, name):
# def is_contained_in(pe_pe, root):
# def is_global(pe_pe):
# def get_defining_component(pe_pe):
# def get_attribute_type(o_attr):
# def _get_data_type_name(s_dt):
# def _get_related_attributes(r_rgo, r_rto):
# def mk_enum(s_edt):
# def mk_bridge(metamodel, s_brg):
# def mk_external_entity(metamodel, s_ee):
# def mk_function(metamodel, s_sync):
# def mk_constant(cnst_syc):
# def mk_operation(metaclass, o_tfr):
# def mk_derived_attribute(metaclass, o_dbattr):
# def mk_class(m, o_obj, derived_attributes=False):
# def mk_simple_association(m, r_simp):
# def mk_linked_association(m, r_assoc):
#     def _mk_assoc(side1, side2):
# def mk_subsuper_association(m, r_subsup):
# def mk_derived_association(m, r_comp):
# def mk_association(m, r_rel):
# def mk_component(bp_model, c_c=None, derived_attributes=False):
#     def __init__(self, load_globals=True):
#     def filename_input(self, path_or_filename):
#     def build_component(self, name=None, derived_attributes=False):
# def _mk_loader(resource, load_globals):
# def load_metamodel(resource=None, load_globals=True):
# def load_component(resource, name=None, load_globals=True):
# def delete_globals(m, disconnect=False):
#     EE = collections.namedtuple(s_ee.Key_Lett, names)
# 
# Path: xtuml/meta.py
# def relate(from_instance, to_instance, rel_id, phrase=''):
#     '''
#     Relate *from_instance* to *to_instance* across *rel_id*. For reflexive
#     association, a *phrase* indicating the direction must also be provided.
#     
#     The two instances are related to each other by copying the identifying 
#     attributes from the instance on the TO side of a association to the instance
#     n the FROM side. Updated values which affect existing associations are 
#     propagated. A set of all affected instances will be returned.
#     '''
#     if None in [from_instance, to_instance]:
#         return False
# 
#     inst1, inst2, ass = _find_link(from_instance, to_instance, rel_id, phrase)
#     if not ass.source_link.connect(inst1, inst2):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
# 
#     if not ass.target_link.connect(inst2, inst1):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
#     
#     return True
# 
# Path: xtuml/meta.py
# def where_eq(**kwargs):
#     '''
#     Return a where-clause that filters out instances based on named 
#     keywords.
#     
#     Usage example:
#     
#     >>> from xtuml import where_eq as where
#     >>> m = xtuml.load_metamodel('db.sql')
#     >>> inst = m.select_any('My_Modeled_Class', where(My_Number=5))
#     '''
#     return WhereEqual(kwargs)


import xtuml
from bridgepoint import ooaofooa
from xtuml import relate
from xtuml import where_eq as where


m = ooaofooa.empty_model()

#
# Create top-level package (External Entities - generated by pyxtuml)
#
ep_pkg = m.new('EP_PKG', Name='External Entities - generated by pyxtuml')
pe_pe = m.new('PE_PE', Visibility=True, type=7)
relate(pe_pe, ep_pkg, 8001)

#
# Create an external entity (My_External_Entity)
#
s_ee = m.new('S_EE', Name='My_External_Entity', Key_Lett='My_External_Entity')
pe_pe = m.new('PE_PE', Visibility=True, type=5)
relate(s_ee, pe_pe, 8001)
relate(pe_pe, ep_pkg, 8000)

#
# Create a bridge operation (My_Bridge_Operation: boolean)
#
s_dt = m.select_one('S_DT', where(Name='boolean'))
s_brg = m.new('S_BRG', Name='My_Bridge_Operation')
relate(s_brg, s_ee, 19)
relate(s_brg, s_dt, 20)

#
# Create a bridge parameter (My_Parameter: string)
#

# Path: bridgepoint/ooaofooa.py
# class OoaOfOoaException(Exception):
# class Domain(xtuml.MetaModel):
# class ModelLoader(xtuml.ModelLoader):
#     def __init__(self, id_generator=None):
#     def add_symbol(self, name, handle):
#     def find_symbol(self, name):
# def is_contained_in(pe_pe, root):
# def is_global(pe_pe):
# def get_defining_component(pe_pe):
# def get_attribute_type(o_attr):
# def _get_data_type_name(s_dt):
# def _get_related_attributes(r_rgo, r_rto):
# def mk_enum(s_edt):
# def mk_bridge(metamodel, s_brg):
# def mk_external_entity(metamodel, s_ee):
# def mk_function(metamodel, s_sync):
# def mk_constant(cnst_syc):
# def mk_operation(metaclass, o_tfr):
# def mk_derived_attribute(metaclass, o_dbattr):
# def mk_class(m, o_obj, derived_attributes=False):
# def mk_simple_association(m, r_simp):
# def mk_linked_association(m, r_assoc):
#     def _mk_assoc(side1, side2):
# def mk_subsuper_association(m, r_subsup):
# def mk_derived_association(m, r_comp):
# def mk_association(m, r_rel):
# def mk_component(bp_model, c_c=None, derived_attributes=False):
#     def __init__(self, load_globals=True):
#     def filename_input(self, path_or_filename):
#     def build_component(self, name=None, derived_attributes=False):
# def _mk_loader(resource, load_globals):
# def load_metamodel(resource=None, load_globals=True):
# def load_component(resource, name=None, load_globals=True):
# def delete_globals(m, disconnect=False):
#     EE = collections.namedtuple(s_ee.Key_Lett, names)
# 
# Path: xtuml/meta.py
# def relate(from_instance, to_instance, rel_id, phrase=''):
#     '''
#     Relate *from_instance* to *to_instance* across *rel_id*. For reflexive
#     association, a *phrase* indicating the direction must also be provided.
#     
#     The two instances are related to each other by copying the identifying 
#     attributes from the instance on the TO side of a association to the instance
#     n the FROM side. Updated values which affect existing associations are 
#     propagated. A set of all affected instances will be returned.
#     '''
#     if None in [from_instance, to_instance]:
#         return False
# 
#     inst1, inst2, ass = _find_link(from_instance, to_instance, rel_id, phrase)
#     if not ass.source_link.connect(inst1, inst2):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
# 
#     if not ass.target_link.connect(inst2, inst1):
#         raise RelateException(from_instance, to_instance, rel_id, phrase)
#     
#     return True
# 
# Path: xtuml/meta.py
# def where_eq(**kwargs):
#     '''
#     Return a where-clause that filters out instances based on named 
#     keywords.
#     
#     Usage example:
#     
#     >>> from xtuml import where_eq as where
#     >>> m = xtuml.load_metamodel('db.sql')
#     >>> inst = m.select_any('My_Modeled_Class', where(My_Number=5))
#     '''
#     return WhereEqual(kwargs)


# Path: examples/create_external_entity.py
import xtuml
from bridgepoint import ooaofooa
from xtuml import relate
from xtuml import where_eq as where



m = ooaofooa.empty_model()

#
# Create top-level package (External Entities - generated by pyxtuml)
#
ep_pkg = m.new('EP_PKG', Name='External Entities - generated by pyxtuml')
pe_pe = m.new('PE_PE', Visibility=True, type=7)
relate(pe_pe, ep_pkg, 8001)

#
# Create an external entity (My_External_Entity)
#
s_ee = m.new('S_EE', Name='My_External_Entity', Key_Lett='My_External_Entity')
pe_pe = m.new('PE_PE', Visibility=True, type=5)
relate(s_ee, pe_pe, 8001)
relate(pe_pe, ep_pkg, 8000)

#
# Create a bridge operation (My_Bridge_Operation: boolean)
#
s_dt = m.select_one('S_DT', where(Name='boolean'))
s_brg = m.new('S_BRG', Name='My_Bridge_Operation')
relate(s_brg, s_ee, 19)
relate(s_brg, s_dt, 20)

#
# Create a bridge parameter (My_Parameter: string)
#

s_dt = m.select_one('S_DT', where(Name='string'))