|
@@ -53,14 +53,16 @@ class EmBackendGraphviz(EmBackendDummy):
|
53
|
53
|
self.edges += cid+' -> '+self._component_id(c.em_class)+' [ style="dotted" ]\n'
|
54
|
54
|
for nat, sups in c.superiors().items():
|
55
|
55
|
for sup in sups:
|
56
|
|
- self.edges += cid+' -> '+self._component_id(sup)+' [ label="%s" color="green" ]'%nat
|
|
56
|
+ self.edges += cid+' -> '+self._component_id(sup)+' [ label="%s" color="green" ]\n'%nat
|
57
|
57
|
#dotfp.write("}\n")
|
58
|
58
|
|
|
59
|
+ """
|
59
|
60
|
for rf in [ f for f in em.components(EmField) if f.fieldtype == 'rel2type']:
|
60
|
61
|
dotfp.write(self._component_node(rf, em))
|
61
|
62
|
cid = self._component_id(rf)
|
62
|
63
|
self.edges += cid+' -> '+self._component_id(rf.em_class)+'\n'
|
63
|
64
|
self.edges += cid+' -> '+self._component_id(em.component(rf.rel_to_type_id))+'\n'
|
|
65
|
+ """
|
64
|
66
|
|
65
|
67
|
dotfp.write(self.edges)
|
66
|
68
|
|
|
@@ -72,12 +74,11 @@ class EmBackendGraphviz(EmBackendDummy):
|
72
|
74
|
return 'emcomp%d'%c.uid
|
73
|
75
|
|
74
|
76
|
def _component_node(self, c, em):
|
75
|
|
- #ret = 'emcomp%d '%c.uid
|
76
|
77
|
ret = "\t"+EmBackendGraphviz._component_id(c)
|
77
|
78
|
cn = c.__class__.__name__
|
78
|
79
|
rel_field = ""
|
79
|
80
|
if cn == 'EmClass':
|
80
|
|
- ret += '[ label="%s", shape="%s" ]'%(c.name.replace('"','\\"'), 'doubleoctagon')
|
|
81
|
+ ret += '[ label="EmClass %s", shape="%s" ]'%(c.name.replace('"','\\"'), 'doubleoctagon')
|
81
|
82
|
elif cn == 'EmField':
|
82
|
83
|
str_def = '[ label="Rel2Type {fname}|{{{records}}}", shape="record"]'
|
83
|
84
|
records = ' | '.join([f.name for f in em.components('EmField') if f.rel_field_id == c.uid])
|
|
@@ -88,10 +89,8 @@ class EmBackendGraphviz(EmBackendDummy):
|
88
|
89
|
cntref = 0
|
89
|
90
|
first = True
|
90
|
91
|
for f in [ f for f in c.fields() if f.name not in c.em_class.default_fields_list().keys()]:
|
91
|
|
- if cn == 'EmType' and f.rel_field_id is None:
|
92
|
|
-
|
93
|
|
- #if not (f.rel_to_type_id is None):
|
94
|
|
- if isinstance(f, EditorialModel.fieldtypes.rel2type.EmFieldType):
|
|
92
|
+ if f.rel_field_id is None:
|
|
93
|
+ if f.fieldtype == 'rel2type':
|
95
|
94
|
rel_node_id = '%s%s'%(EmBackendGraphviz._component_id(c), EmBackendGraphviz._component_id(em.component(f.rel_to_type_id)))
|
96
|
95
|
|
97
|
96
|
rel_node = '\t%s [ label="rel_to_type'%rel_node_id
|
|
@@ -105,7 +104,7 @@ class EmBackendGraphviz(EmBackendDummy):
|
105
|
104
|
rel_node += '{ '
|
106
|
105
|
first = False
|
107
|
106
|
rel_node += rf.name
|
108
|
|
- rel_node += '}" shape="record" style="dashed"]\n'
|
|
107
|
+ rel_node += '}" shape="record"]\n'
|
109
|
108
|
|
110
|
109
|
rel_field += rel_node
|
111
|
110
|
|
|
@@ -117,8 +116,7 @@ class EmBackendGraphviz(EmBackendDummy):
|
117
|
116
|
if first:
|
118
|
117
|
ret += ' { '
|
119
|
118
|
first = False
|
120
|
|
- #if not (f.rel_to_type_id is None):
|
121
|
|
- if isinstance(f, EditorialModel.fieldtypes.rel2type.EmFieldType):
|
|
119
|
+ if f.fieldtype == 'rel2type':
|
122
|
120
|
ret += '<f%d> '%cntref
|
123
|
121
|
cntref += 1
|
124
|
122
|
ret += f.name
|