No subject


Wed Apr 29 21:31:29 CEST 2009


long subject = <<current working node id - looked up against an index>>
if (roleGroup == 0) {
neoId = batchInsert.createRelationship(subject, object, rt,
neoMap.getMap());
} else {
// insert blank node to represent role groups. First of all find out whether
blank node has already been
// created.
long roleGroupNode = 0L;

// look for current relationship with HAS_ROLE_GROUP relationship type
for (SimpleRelationship sr: batchInsert.getRelationships(subject)) {
//<<stack trace here
if (sr.getType().equals(SctRelationshipType.HAS_ROLE_GROUP)) {

//look for end node with specific RELATIONSHP_GROUP property equal to
roleGroup
int tmp = (Integer)
batchInsert.getNodeProperties(sr.getEndNode()).get(SctPropertyName.RELATIONSHIP_GROUP.key());
if (tmp == roleGroup) {
roleGroupNode = sr.getEndNode(); //reference to current blank node
}
}
}
//If no existing blank node found then create a new one
if (roleGroupNode == 0) {
HashMap<String,Object> tmp = new HashMap<String,Object>();
roleGroupNode = batchInsert.createNode(tmp); //reference to new blank node
tmp.put(SctPropertyName.RELATIONSHIP_GROUP.key(), roleGroup);
batchInsert.createRelationship(roleGroupNode, object,
SctRelationshipType.HAS_ROLE_GROUP, tmp);
}
//create the relationship
neoId = batchInsert.createRelationship(subject, roleGroupNode, rt,
neoMap.getMap());
}

Am I misusing the batchinserter here? or is there another issue?

Rob.


More information about the User mailing list