When thinking about the ability for one graph to load another graph within it (i.e. subgraphs), it seems to me that the storage of such graphs can take 3 forms:
- graphs published and consumed as components: often defined as code, and thus not editable within a graph editor UI.
- external graph references: graphs saved externally to the parent graph (i.e. a separate "project"). the same graph may be referenced by many other graphs. unlike
#1, these are the product of a graph editor (stored as .json or .fbp), rather than code. it may or may not be editable from the parent graph editor, depending on the abilities of the UI
- embedded graphs: saved within the parent graph. can only be referenced indirectly by other graphs via its parent. editable from the parent graph editor.
fbp-protocol already supports #1 (in reality it requires no additional support as these subgraphs can simply be treated as components). This ticket is for #3. EDIT: and #2
Below is a bare-bones example of a command sequence that creates a graph within a graph:
protocol: graph
command: clear
payload:
id: myGraph
---
protocol: graph
command: addnode
payload:
id: myNode
graph: myGraph
---
protocol: graph
command: clear
payload:
id: mySubGraph
parent: myGraph
---
protocol: graph
command: addnode
payload:
id: mySubNode
graph: myGraph/mySubGraph
---
protocol: graph
command: addinport
payload:
public: IN
node: mySubNode
port: IN
graph: myGraph/mySubGraph
This adds 2 new concepts:
- sub-graphs may be identified within any
graph attribute using /, as in parentGraph/childGraph
graph clear gets an optional parent attribute
I chose to add the parent attribute because I wanted this action to be explicit. An alternative would be to use the parent/child notation for the graph clear, like this:
protocol: graph
command: clear
payload:
id: myGraph/mySubGraph
I'm open to suggestions and opinions.
When thinking about the ability for one graph to load another graph within it (i.e. subgraphs), it seems to me that the storage of such graphs can take 3 forms:
#1, these are the product of a graph editor (stored as .json or .fbp), rather than code. it may or may not be editable from the parent graph editor, depending on the abilities of the UIfbp-protocol already supports
#1(in reality it requires no additional support as these subgraphs can simply be treated as components). This ticket is for#3. EDIT: and#2Below is a bare-bones example of a command sequence that creates a graph within a graph:
This adds 2 new concepts:
graphattribute using/, as inparentGraph/childGraphgraph cleargets an optionalparentattributeI chose to add the
parentattribute because I wanted this action to be explicit. An alternative would be to use theparent/childnotation for thegraph clear, like this:I'm open to suggestions and opinions.