Adding an Edge to a Data Tree
Adding an edge to a data-tree essentially takes an existing relationshipand connects the tables together. This allows the data in the child table to be accessed by the parent table. In this example, the relationship is found by searching for relationships on the root table, but you can also create a new relationship. The root of the dataTree determines how the relationship data can be used based on the hierarchy.
import com.im.commons.progress.*
import com.im.df.api.util.*
def structureEty = dataTree.rootVertex.entity
def schema = dataTree.schema
schema.lockable.withLock('Adding edges') { envRW ->
rels = DIFUtilities.findUsagesInRelationships(structureEty)
firstRel = rels.get(0)
dataTree.rootVertex.addEdge(firstRel.reverse, envRW)
}
Versions: This script has been tested on IJC version 6.0
Copyright © 1999-2012 ChemAxon Ltd. All rights reserved.