See: Description
Interface | Description |
---|---|
GraphDataValueGenerator |
Defines the method to compute all nodes and their relationships to generate a graph of data values.
|
GraphDataValueGeneratorDefinition |
Provides the methods to define the data value graph generator and its label.
|
Class | Description |
---|---|
DisplaySpec |
Enables node customization and transition display.
|
GraphDataValueContext |
Defines the parameters needed when calling the data value graph API.
|
GraphDataValueGeneratorCatalog |
Provides the methods to register instances of the data value graph generator for later use.
|
GraphDataValueSelection |
Defines the parameters for the selected records when calling the data value graph API.
|
GraphNode |
Defines all properties of a node.
|
GraphNodes |
Stores all graph nodes and their relationships.
|
NodeSpec |
Defines the customization options for node labels and layout.
|
RelationSpec |
Defines the customization options for link labels and layout.
|
TableDescriptor |
Defines all properties required to indicate an
AdaptationTable . |
Enum | Description |
---|---|
NodeService |
Defines the available services on the node.
|
Classes and interfaces for computing nodes and their relationships in a data value graph.
You can implement the GraphDataValueGenerator
interface to define your own rules to get a list of nodes and their relationships that are encapsulated in the GraphNodes
class.
public class GramGraphDataValue implements GraphDataValueGenerator { public static final String DEFAULT_NODE_LAYOUT = "[ON] DefaultNodeLayout"; public static final String DEFAULT_TRANSITION_LAYOUT = "[ON] Default"; public static final String GRAM_API = "GramAPI"; public GraphNodes generateGraph(GraphDataValueContext context) throws GramException { GraphNodes result = GraphValueNodesBridge.createGraphGraphValueNodes(); AdaptationTable selectedTable = context.getSelection().getSelectedTable(); if (selectedTable == null) { throw new GramException(UserMessage.createError("Cannot get the corresponding table")); } Set<GraphNode> allNodes = new HashSet<GraphNode>(); RequestResult requestResult = selectedTable.createRequest().execute(); Adaptation adaptation; try { while ((adaptation = requestResult.nextAdaptation()) != null) { allNodes.add(new GraphNode(adaptation)); } } finally { requestResult.close(); } GraphNode firstRecord = allNodes.iterator().next(); if (firstRecord == null) { throw new GramException(UserMessage.createError("The selected table is empty")); } GraphNode graphNode = result.get(firstRecord); if (graphNode == null) { graphNode = firstRecord; result.addNode( graphNode, new NodeSpec(UserMessage.createInfo(GramGraphDataValue.GRAM_API + firstRecord.getPrimaryKey().format()), GramGraphDataValue.DEFAULT_NODE_LAYOUT)); } //Starting from the current table’s first record for (GraphNode aNode : allNodes) { if (firstRecord.equals(aNode)) { continue; } //links to all other records. graphNode.addNodesTo( aNode, new RelationSpec( UserMessage.createInfo(firstRecord.getPrimaryKey().format() + " - " + aNode.getPrimaryKey().format()), GramGraphDataValue.DEFAULT_TRANSITION_LAYOUT)); GraphNode toNode = result.get(aNode); if (toNode == null) { //Link the current record from firstRecord as linksFrom toNode = aNode; result.addNode( toNode, new NodeSpec(UserMessage.createInfo(GramGraphDataValue.GRAM_API + toNode.getPrimaryKey().format()), GramGraphDataValue.DEFAULT_NODE_LAYOUT)); } toNode.addNodesFrom(firstRecord); } return result; } }