Question

Is there are way to access the metamodel, instantiate a node or edge of a specific type and add it to the graph in a script?

Please note: The booggie-project does not exist anymore but led to the development of Soley Studio which covers the same functionality.

Was it helpful?

Solution

Yes, you can get the node/edges types from the metamodel using

graph.Model.NodeModel.GetType("MyNodeType")
  • or -
graph.Model.EdgeModel.GetType("MyEdgeType")

Using the method graph.AddNode you can add it to the graph and the added node is returned to which attribute assignments can be made.

All together, it looks like this:

    newNode = graph.AddNode(graph.Model.NodeModel.GetType("MyNodeType"))
    newNode.myAttribute = 42
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top