Netglub

Really Open Source Information Gathering

How to create a script

202 Comments »
    « We shall not fail or falter; we shall not weaken or tire…Give us the tools and we will finish the job. »
    Sir Winston Churchill, BBC radio broadcast, 1941

    1.What is a Netglub Script?

    Netglub scripting feature is powerful tool allowing you to automatize and use directly Neglub
    inner commands.

    2.Which langage

    Scripts can be yet written in ECMA script. That means you can manage graphs, nodes and transforms with
    loops, iterations,…

    3.Script technical overview:

    a.Graph management.

    Create a new graph called ‘graph1′ :

    graph1 = main.newGraph()

    Load graph at absolute path ‘GraphAbsolutePath’ :

    graph2 = loadGraph("GraphAbsolutePath") 

    Select a ‘graph1′ opened in the Netglub main window :

    main.selectGraph(graph1)

    Select nodes/edges view (mining/centrality/edgeweigthed) and layout (hierarchical/circular/molecular/block) :

    graph1.setLayout("view","layout")

    Redraw layout as set :

    graph1.startLayout()

    Redraw nodes and edges in order to fit the window the best as possible :

    graph1.bestFit()

    Create a new node of a desired entity type into ‘graphName’ :

    graph1.newNode("Entity type")

    Get node list contained by ‘graphName’ :

    graph1.nodeList()

    Delete node ‘node1′ in ‘graphName’ :

    graph1.deleteNode(node1)

    Add edge between ‘node1′ and ‘node2′ :

    graph1.addEdge(node1,node2)

    Delete edge between ‘node1′ and ‘node2′ :

    graph1.deleteEdge(node1,node2)

    Return ‘graphName’ nodes and edges :

    graph1.stats()

    b.Node management.

    Return node1′s ‘param1′ value :

    node1.param("param1")

    Set node1′s ‘param1′ to ‘value’ :

    node1.setParam("param1","value")

    Return node1′s entity type :

    node1.type()

    Return node1′s available transforms :

    node1.availableTransforms()

    add parameter-free transform called ‘transform1′to node1 :

    node1.transform("transform1")

    add parametized-transforms called ‘transform1′ to node1, you must have set transform parameters before launching :

    node1.advTransform(transform1)

    c.Transform management.

    Return transform1′s ‘param1′ value :

    transform1.param("param1")

    Set transform1′s ‘param1′ to ‘value’ :

    transform1.setParam("param1","value")

    Return transforms informations (input entity/parameter value) :

    transform1.display()

    4.Testing your script

    You can now test your script by running it, enjoy !

    Leave a Reply

    *