@@ -118,10 +118,12 @@ function draw(self)
118118
119119 self .makeGraph
120120
121- rege = cellfun(@(s ) sprintf(' ^`[a-z]\\ w*`\\ .`%s [a-z]\\ w*`$' ,s ), dj .Schema .tierPrefixes , ' uni' , false );
121+ rege = cellfun(@(s ) sprintf(' ^`[a-z]\\ w*`\\ .`%s [a-z]\\ w*`$' ,s ), ...
122+ dj .Schema .tierPrefixes , ' uni' , false );
122123 rege{end + 1 } = ' ^`[a-z]\w*`\.`\W?\w+__\w+`$' ; % for part tables
123124 rege{end + 1 } = ' ^\d+$' ; % for numbered nodes
124- tiers = cellfun(@(l ) find(~cellfun(@isempty , regexp(l , rege )), 1 , ' last' ), self .graph .Nodes .Name );
125+ tiers = cellfun(@(l ) find(~cellfun(@isempty , regexp(l , rege )), 1 , ' last' ), ...
126+ self .graph .Nodes .Name );
125127 colormap(0.3 + 0.7 *[
126128 0.3 0.3 0.3
127129 0.0 0.5 0.0
@@ -180,8 +182,10 @@ function makeGraph(self)
180182 ref = [];
181183 from = [];
182184 else
183- from = arrayfun(@(item ) find(strcmp(item .from , list )), self .conn .foreignKeys , ' uni' , false );
184- ref = arrayfun(@(item ) find(strcmp(item .ref , list )), self .conn .foreignKeys , ' uni' , false );
185+ from = arrayfun(@(item ) find(strcmp(item .from , list )), ...
186+ self .conn .foreignKeys , ' uni' , false );
187+ ref = arrayfun(@(item ) find(strcmp(item .ref , list )), ...
188+ self .conn .foreignKeys , ' uni' , false );
185189 ix = ~cellfun(@isempty , from ) & ~cellfun(@isempty , ref );
186190 if ~isempty(ref )
187191 primary = [self .conn .foreignKeys(ix ).primary];
@@ -212,6 +216,18 @@ function makeGraph(self)
212216 end
213217 end
214218 end
215-
216-
219+ methods (Static )
220+ function tier = getTier(tableName )
221+ tier = [];
222+ for pattern = cellfun(@(x ) dj.(x(4 : end )).tierRegexp, dj .Schema .tierClasses , ...
223+ ' uni' , false )
224+ fieldInfo = regexp(tableName , pattern{1 }, ' names' );
225+ if ~isempty(fieldInfo )
226+ tier = fieldnames(fieldInfo );
227+ tier = tier{1 };
228+ break
229+ end
230+ end
231+ end
232+ end
217233end
0 commit comments