Beispiel #1
0
 def test_delete(self):
     inst = self.metamodel.select_any('S_DT', where(Name='void'))
     self.assertTrue(xtuml.navigate_one(inst).PE_PE[8001]())
     
     xtuml.delete(inst)
     self.assertFalse(xtuml.navigate_one(inst).PE_PE[8001]())
     
     inst = self.metamodel.select_any('S_DT', where(Name='void'))
     self.assertFalse(inst)
Beispiel #2
0
def delete_globals(m, disconnect=False):
    '''
    Remove global instances, e.g. the core data type integer.
    '''
    filt = lambda sel: (247728914420827907967735776184937480192 <= sel.DT_ID <=
                        247728914420827907967735776184937480208)

    for s_dt in m.select_many('S_DT', filt):
        xtuml.delete(one(s_dt).PE_PE[8001](), disconnect)
        xtuml.delete(subtype(s_dt, 17), disconnect)
        xtuml.delete(s_dt, disconnect)
Beispiel #3
0
def delete_globals(m, disconnect=False):
    '''
    Remove global instances, e.g. the core data type integer.
    '''
    filt = lambda sel: (247728914420827907967735776184937480192 <= 
                        sel.DT_ID <= 
                        247728914420827907967735776184937480208)

    for s_dt in m.select_many('S_DT', filt):
        xtuml.delete(one(s_dt).PE_PE[8001](), disconnect)
        xtuml.delete(subtype(s_dt, 17), disconnect)
        xtuml.delete(s_dt, disconnect)
Beispiel #4
0
 def accept_DeleteNode(self, node):
     inst = self.symtab.find_symbol(node.variable_name)
     xtuml.delete(inst)
def mk_ooaofooa_component(filename):
    loader = ooaofooa.Loader()
    loader.filename_input(filename)

    m = loader.build_metamodel()

    for r_rel in m.select_many('R_REL', description_filter):
        logger.info('Filtering R%d' % r_rel.Numb)
        xtuml.delete(r_rel)

    for o_obj in m.select_many('O_OBJ', description_filter):
        logger.info('Filtering %s' % o_obj.Key_Lett)
        for r_rel in many(o_obj).R_OIR[201].R_REL[201]():
            logger.info('Filtering R%d' % r_rel.Numb)
            for r_oir in many(r_rel).R_OIR[201]():
                xtuml.unrelate(r_rel, r_oir, 201)

            xtuml.delete(r_rel)

        xtuml.delete(o_obj)

    for o_attr in m.select_many('O_ATTR', where(Name='SMspd_ID')):
        if not one(o_attr).O_RATTR[106]():
            continue

        for o_oida in many(o_attr).O_OIDA[105]():
            for o_rtida in many(o_oida).O_RTIDA[110]():
                xtuml.delete(o_rtida)
            xtuml.delete(o_oida)

        for o_ref in many(o_attr).O_RATTR[106].O_REF[108]():
            xtuml.delete(o_ref)

    c = ooaofooa.mk_component(m, None, derived_attributes=True)
    metaclass = c.find_metaclass('ACT_ACT')
    metaclass.insert_attribute(index=5,
                               name='return_value',
                               type_name='INTEGER')

    for o_obj in m.select_many('O_OBJ'):
        for o_attr in many(o_obj).O_ATTR[102](description_filter):
            logger.info('Filtering %s.%s' % (o_obj.Key_Lett, o_attr.Name))
            metaclass = c.find_metaclass(o_obj.Key_Lett)
            metaclass.delete_attribute(o_attr.Name)

    return c
Beispiel #6
0
 def test_delete_twise(self):
     inst = self.metamodel.select_any('S_DT', where(Name='void'))
     xtuml.delete(inst)
     self.assertRaises(xtuml.DeleteException, xtuml.delete, inst)
Beispiel #7
0
 def accept_DeleteNode(self, node):
     inst = self.symtab.find_symbol(node.variable_name)
     xtuml.delete(inst)
def main():
    if len(sys.argv) < 2:
        logger.info('usage: %s <path to ooaofooa model folder>' % sys.argv[0])
        sys.exit(1)
        
    loader = ooaofooa.Loader()
    for filename in sys.argv[1:]:
        loader.filename_input(filename)
    
    m = loader.build_metamodel()

    for r_rel in m.select_many('R_REL', description_filter):
        logger.info('Filtering R%d' % r_rel.Numb)
        xtuml.delete(r_rel)

    for o_obj in m.select_many('O_OBJ', description_filter):
        logger.info('Filtering %s' % o_obj.Key_Lett)
        for r_rel in many(o_obj).R_OIR[201].R_REL[201]():
            logger.info('Filtering R%d' % r_rel.Numb)
            for r_oir in many(r_rel).R_OIR[201]():
                xtuml.unrelate(r_rel, r_oir, 201)
                
            xtuml.delete(r_rel)
            
        xtuml.delete(o_obj)

    for o_attr in m.select_many('O_ATTR', where(Name='SMspd_ID')):
        if not one(o_attr).O_RATTR[106]():
            continue
            
        for o_oida in many(o_attr).O_OIDA[105]():
            for o_rtida in many(o_oida).O_RTIDA[110]():
                xtuml.delete(o_rtida)
            xtuml.delete(o_oida)

        for o_ref in many(o_attr).O_RATTR[106].O_REF[108]():
            xtuml.delete(o_ref)
            
    c = ooaofooa.mk_component(m, None, derived_attributes=True)
    metaclass = c.find_metaclass('ACT_ACT')
    metaclass.insert_attribute(index=5, name='return_value', type_name='INTEGER')

    for o_obj in m.select_many('O_OBJ'):
        for o_attr in many(o_obj).O_ATTR[102](description_filter):
            logger.info('Filtering %s.%s' % (o_obj.Key_Lett, o_attr.Name))
            metaclass = c.find_metaclass(o_obj.Key_Lett)
            metaclass.delete_attribute(o_attr.Name)
            
    xtuml.persist_schema(c, '/dev/stdout')