예제 #1
0
def get_rel_names(path):
    root = xerml_einlesen.get_root(path)

    matrix = []
    for child in root:
        if child.tag == 'rel':
            matrix.append(child.get('to'))

    return (matrix)
예제 #2
0
def write_erd_to_file(pic, inputfile):
    root = xerml_einlesen.get_root(inputfile)
    '''
    title = "output"
    for child in root:
        if child.tag == "title":
            if child.get('lang') is None:
                title = child.get('name')
    '''
    if os.path.exists("erd.pic"):
        os.remove("erd.pic")
    file = open("erd.pic", "w")
    file.write(pic)
    file.close()
    print('Your file is created at: ' + os.getcwd() + '/erd.pic')
예제 #3
0
def get_rel(path):
    root = xerml_einlesen.get_root(path)

    matrix = []
    first_level = 0
    for child in root:
        temp_matrix = []
        if child.tag == 'rel':
            temp_matrix.append(child.get('to'))
            for grandchild in child:
                if grandchild.tag == 'part':
                    temp_matrix.append(grandchild.get('ref'))
                    temp_matrix.append(grandchild.get('min'))
                    temp_matrix.append(grandchild.get('max'))
        if len(temp_matrix) > 0:
            matrix.insert(first_level, temp_matrix)
            first_level += 1
    return matrix
예제 #4
0
def get_pk(path):
    root = xerml_einlesen.get_root(path)

    matrix = []
    first_level = 0
    for child in root:
        temp_matrix = []
        if child.tag == 'ent':
            temp_matrix.append(child.get('name'))

            for grandchild in child:
                if grandchild.tag == 'attr':
                    if grandchild.get('prime') == 'true':
                        temp_matrix.append(grandchild.get('name'))
        if len(temp_matrix) > 0:
            matrix.insert(first_level, temp_matrix)
            first_level += 1

    return matrix
예제 #5
0
def get_super_sub(path):
    root = xerml_einlesen.get_root(path)

    matrix = []
    first_level = 0
    for child in root:
        temp_matrix = []
        if child.tag == 'rel':
            temp_matrix.append(child.get('to'))

            for grandchild in child:
                if grandchild.tag == 'super':
                    temp_matrix.append(grandchild.get('ref'))
                    temp_matrix.append(grandchild.get('total'))
                    temp_matrix.append(grandchild.get('disjoint'))

                if grandchild.tag == 'sub':
                    temp_matrix.append(grandchild.get('ref'))

        if len(temp_matrix) > 0:
            matrix.insert(first_level, temp_matrix)
            first_level += 1

    return matrix