Data sets
Data sets
A data set is used when you need to define a subset of the data store to use somewhere in the UI components. Could be related to some other specific data or global, automatically picking up the context it is applied to.
It is common to use statements to filter by some specific property. Data sets uses cytoscape.js#selectors selectors and cytoscape.js#collection/traversing traversing API's, the selector statements are directly used by administrators in configuration and is good to refer to for detail (API's are used internally and only of interest when writing Extending with plugin code).
Example use:
- When expanding a table row, what related data should display as child rows? (e.g. product structure)
- In a related data column, which nodes should be presented? (e.g. specifications)
- Loading the root nodes of a table, should all data nodes go there or just with a certain state or type?
Chaining data sets
dataset a → dataset B → dataset C
Data sets could be chained together (e.g. give me all project nodes related to me ? out of those fully expand their folder structures ? out of that result give me all in work documentation). To chain simply use the datasets property and point out the data sets to apply on the result set of the first data set before returning.
"datasets":{
"user-projects": {
"type": "filter",
"statement": "[type='Project'][owner='currentUser']",
"datasets": ["expand-folders"]
},
"expand-folders" : {
"type": "expand",
"edgeStatement": "[type='FolderLink']",
"nodeStatement": "[type='Folder']"
}
}
Common data set properties
The following properties applies to all data set configuration
| Property | Description | Data Type | Required |
|---|---|---|---|
datasets | Data set identifier references to chain. Applies to the result set. | array string | no |
type | Data set type (listed below e.g. expand) | string | yes |
Expand
Traverses the graph (similar to mql expand) the given number of levels applying the edge and node statements (selectors) on each every level independently (it require match for each level and not the result set, which cold give a different result). You can control the number of levels, the direction and what selectors to apply for edges and for nodes. There is an option to retain leaf nodes of that expand only.
Note that the node statements also apply to the starting nodes (a difference compared to mql). Node statements need to match root nodes for expansion as well.
"ups-roots-example" : {
"type": "expand",
"edgeStatement": "[type='VPMInstance']",
"nodeStatement": "[type='VPMReference']",
"predecessors": true,
"leavesOnly": true,
"levels": 100
}
| Property | Description | Default | Data Type | Required |
|---|---|---|---|---|
edgeStatement | cytoscape.js#selector validated with all edges, retains matching only | string | no | |
edgeEdgeNavigation | Include rel-to-rel edge (excluded when false) | false | boolean | no |
edgeEdgeReturn | Applicable when edgeEdgeNavigation=true. Control which edge to return, available values source/target/self | target | string | no |
edgeEdgeDirection | Applicable when edgeEdgeNavigation=true. Control the direction to navigate edge-to-edge, available values source / target | target | string | no |
leavesOnly | Removes all eles from the result set that is not a leaf according to the applied node and edge statements, default false | false | boolean | no |
levels | The number of levels to expand, if left out all levels is expanded (there is a max value to prevent issues, explicitly state a high value to override) | number | no | |
nodeStatement | cytoscape.js#selector validated with all nodes, retains matching only | string | no | |
predecessors | Expand direction, true expands upwards (where used), default is false | false | boolean | no |
Filter
Filters out all eles matching a given cytoscape selector statement.
"vpm-structure-example" : {
"type": "filter",
"statement": "[type='VPMInstance'],[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | cytoscape.js#selector validated with all edges and nodes in the collection, returns matching eles only | string | yes |
Nodes
Filters out all nodes matching a given cytoscape selector statement.
"vpm-instances-example" : {
"type": "nodes",
"statement": "[type='VPMInstance']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | cytoscape.js#selector validated with all nodes in the collection, returns matching nodes only | string | no |
Edges
Filters out all edges matching a given cytoscape selector statement.
"vpm-references-example" : {
"type": "edges",
"statement": "[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | cytoscape.js#selector validated with all edges in the collection, returns matching edges only | string | no |
Successors
Fully expands all eles in the collection recursively then applies a given cytoscape selector statement on the result set of both edges and nodes.
Note that the cytoscape selector statement is applied on the result set and that intermediate expansions getting there do not have to match the statement. See #Expand .
"vpm-structure-example" : {
"type": "successors",
"statement": "[type='VPMReference'],[type='VPMInstance']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | cytoscape.js#selectors validated with all eles in the result set collection, returns matching eles only | string | no |
Predecessors
Fully expands all eles in the collection recursively in the upwards direction (where used) then applies a given cytoscape selector statement on the result set of both edges and nodes.
Note that the cytoscape selector statement is applied on the result set and that intermediate expansions getting there do not have to match the statement. See #Expand
"vpm-parent-structure-example" : {
"type": "predecessors",
"statement": "[type='VPMReference'],[type='VPMInstance']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all eles in the result set collection, returns matching eles only | string | no |
Sources
Gets the source nodes connected with the edges of the collection then applies a given cytoscape selector statement on the result set.
"vpm-parent-nodes-example" : {
"type": "sources",
"statement": "[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all nodes in the result set collection, returns matching nodes only | string | no |
Targets
Gets the target nodes connected with the edges of the collection then applies a given cytoscape selector statement on the result set.
"vpm-child-nodes-example" : {
"type": "targets",
"statement": "[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all nodes in the result set collection, returns matching nodes only | string | no |
Outgoers
Get edges and their target nodes coming out of the nodes in the collection, then applies a given cytoscape selector statement on the result set.
"vpm-children-example" : {
"type": "outgoers",
"statement": "[type='VPMReference'],[type='VPMInstance']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all eles in the result set collection, returns matching eles only | string | no |
Incomers
Get edges and their source nodes coming in to the nodes in the collection, then applies a given cytoscape selector statement on the result set.
"vpm-parents-example" : {
"type": "incomers",
"statement": "[type='VPMReference'],[type='VPMInstance']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all eles in the result set collection, returns matching eles only | string | no |
Roots
Get nodes with no incoming edges in the collection, then applies a given cytoscape selector statement on the result set.
Note that node have to be a true root and that the cytoscape selector statement do not affect the root validation (all incoming edges even if not matching the statement could prevent the node from validating as a root). See #Expand
"vpm-true-roots-example" : {
"type": "roots",
"statement": "[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all nodes in the result set collection, returns matching nodes only | string | no |
Leaves
Get nodes with no outgoing edges in the collection, then applies a given cytoscape selector statement on the result set.
Note that node have to be a true leaf and that the cytoscape selector statement do not affect the leaf validation (all outgoing edges even if not matching the statement could prevent the node from validating as a leaf). See #Expand
"vpm-true-leaves-example" : {
"type": "leaves",
"statement": "[type='VPMReference']"
}
| Property | Description | Data Type | Required |
|---|---|---|---|
statement | A cytoscape.js#selector validated with all nodes in the result set collection, returns matching nodes only | string | no |