-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
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/mySubGraphThis adds 2 new concepts:
- sub-graphs may be identified within any
graphattribute using/, as inparentGraph/childGraph graph cleargets an optionalparentattribute
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/mySubGraphI'm open to suggestions and opinions.