Search code examples
rulebooggie

How can I change attributes of a node within a script in booggie 2?


As can be seen in this post (How can I add a node type to the graph from within a script in booggie 2?) it's possible to add nodes/edges to the metamodel in booggie and change their attributes.

Is it also possible to change the attributes of already existing nodes (or edges) in a graph using a script?


Solution

  • I think you can get all nodes/edges of the current graph using the Nodes and Edges properties.

    Try this out:

    edgeList = graph.Edges
    nodeList = graph.Nodes
    

    Afterwards you can iterate over these lists for node in nodeList: and sort out the elements having the attributes you wanna change, e.g. if node.myAttribute == 42:.