Documentation   >   Network database   >   Network Query Language - Java Client
 
Overview
Manipulation
Modification
NQL Extension
Java Client


Java Client
Posting, updating and querying data are possible through java-client.
Example how to post data:
// create empty network
Network net = new Network();

// create 'Dog Roger'
Connected roger = new Connected("Dog Roger");
roger.setProperty("age", "3");
roger.setProperty("color", "brown");
roger.setProperty("breed", "terrier");

// create 'House'
Connected house = new Connected("House");
house.setProperty("address", "...");

// make relation
NetworkUtils.addRelation(net, roger, house, "live at");

// get storage reference
Storage storage = NeuroManager.newInstance().getStorage("storage.properties");

// save/update data
storage.save(net);

Querying:

// get storage reference
Storage storage = NeuroManager.newInstance().getStorage("storage.properties");

// query some data
Network net = storage.query("SELECT (first_name='John') / () ");

Modification:

// get storage reference
Storage storage = NeuroManager.newInstance().getStorage("storage.properties");

// query some data
Network net = storage.query("SELECT (first_name='John') ");

Connected john = net.getEntityByName("John");

// create 'Bob'
Connected bob = new Connected("Bob");
bob.setProperty("first_name", "Bob");
bob.setProperty("age", "33");

// make relation
NetworkUtils.addRelation(net, john, bob, "friends");

// save/update data
storage.save(net);
Powered by ESG