Esempio n. 1
0
 def __init__(self,
              vodmlid,
              name,
              ref,
              superclass,
              attributes,
              abstract=False,
              vodml_constraints=VodmlConstraintDict()):
     '''
     :param vodmlid:
     :type vodmlid:
     :param name:
     :type name:
     :param ref:
     :type ref:
     :param superclass:
     :type superclass:
     :param attributes:
     :type attributes:
     :param abstract:
     :type abstract:
     :param vodml_constraints:
     :type vodml_constraints: VodmlConstraintDict
     '''
     self.vodmlid = vodmlid
     self.ref = ref
     self.name = name
     self.superclass = superclass
     self.attributes = attributes
     self.abstract = abstract
     self.vodml_constraints = vodml_constraints
Esempio n. 2
0
 def __init__(self,
              vomdlid,
              name,
              superclass,
              attributes,
              abstract=False,
              vodml_constraints=VodmlConstraintDict()):
     self.vodmlid = vomdlid
     self.name = name
     self.superclass = superclass
     self.attributes = attributes
     self.abstract = abstract
     self.vodml_constraints = vodml_constraints
Esempio n. 3
0
    def read_data_type(self, model_name, datatype_tag):
        vodmlid = ''
        name = ''
        superclass = ''
        ref = ''
        attributes = dict()
        constraints = VodmlConstraintDict()
        abstract = False
        if datatype_tag.get("abstract") == "true":
            abstract = True
        for datatype_tag_child in datatype_tag.findall('*'):
            if datatype_tag_child.tag == "vodml-id":
                vodmlid = model_name + ":" + datatype_tag_child.text
                logger.info("READING DATA TYPE " + vodmlid)

            elif datatype_tag_child.tag == "name":
                name = datatype_tag_child.text
            elif datatype_tag_child.tag == "vodml-ref":
                ref = datatype_tag_child.text
            elif datatype_tag_child.tag == "attribute" or datatype_tag_child.tag == "reference":
                att = self.read_attribute(model_name, datatype_tag_child)
                attributes[att.vodmlid] = att
            elif datatype_tag_child.tag == "extends":
                for super_type_child in datatype_tag_child.findall(
                        'vodml-ref'):
                    superclass = super_type_child.text
                    break
            elif datatype_tag_child.tag == "constraint":
                ct = self.read_constraint(model_name, datatype_tag_child)
                constraints.add_contraint(ct)

            elif datatype_tag_child.tag == "reference":
                att = self.read_reference(model_name, datatype_tag_child)
                attributes[att.vodmlid] = att

        retour = VodmlDataType(vodmlid, name, ref, superclass, attributes,
                               abstract, constraints)

        return retour
Esempio n. 4
0
    def read_object_type(self, model_name, object_type_tag):
        attributes = dict()
        constraints = VodmlConstraintDict()
        superclass = ''

        abstract = False
        if object_type_tag.get("abstract") == "true":
            abstract = True
        for object_type_child in object_type_tag.findall('*'):
            if object_type_child.tag == "vodml-id":
                vodmlid = model_name + ":" + object_type_child.text
                logger.info("READING OBJECT TYPE " + vodmlid)

            elif object_type_child.tag == "name":
                name = object_type_child.text
            elif object_type_child.tag == "composition" or object_type_child.tag == "attribute":
                #or multiplicity_tag_child in object_type_child.findall('maxOccurs'):
                #    array_size = int(multiplicity_tag_child.text)
                att = self.read_attribute(model_name, object_type_child)
                attributes[att.vodmlid] = att
            elif object_type_child.tag == "extends":
                for super_type_child in object_type_child.findall('vodml-ref'):
                    superclass = super_type_child.text
                    break
            elif object_type_child.tag == "reference":
                att = self.read_reference(model_name, object_type_child)
                attributes[att.vodmlid] = att

            elif object_type_child.tag == "constraint":
                ct = self.read_constraint(model_name, object_type_child)
                constraints.add_contraint(ct)

        obj = VodmlObjectType(vodmlid, name, superclass, attributes, abstract,
                              constraints)

        return obj
 def __init__(self,
              vodmlid,
              name,
              ref,
              superclass,
              attributes,
              abstract=False,
              vodml_constraints=VodmlConstraintDict(),
              literals={}):
     '''
     :param vodmlid:
     :type vodmlid:
     :param name:
     :type name:
     :param ref:
     :type ref:
     :param superclass:
     :type superclass:
     :param attributes:
     :type attributes:
     :param abstract:
     :type abstract:
     :param vodml_constraints:
     :type vodml_constraints: VodmlConstraintDict
     :param literals:
     :type literals: {vodml-id:{name, description}}
     '''
     self.vodmlid = vodmlid
     self.ref = ref
     self.name = name
     self.superclass = superclass
     self.attributes = attributes
     self.abstract = abstract
     self.vodml_constraints = vodml_constraints
     self.literals = literals
     print("@@@@@@@@ " + self.vodmlid + " " + str(len(self.literals)))