I'm using the batchinserter to build a graph. I'm not sure if what I am
seeing here is something I am doing wrong or something in the batchinserter.
For one task I need to check whether a relationship already exists to a
target node and perform a test on the target node, before deciding whether
to build a new blank node or not. I'm getting the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: id=697209
at
org.neo4j.impl.batchinsert.BatchInserterImpl.getRelationshipRecord(BatchInserterImpl.java:508)
at
org.neo4j.impl.batchinsert.BatchInserterImpl.getRelationships(BatchInserterImpl.java:267)
at
uk.co.pointofcare.echobase.snosled.neoimpl.NeoSctNodeBuilder.build(NeoSctNodeBuilder.java:330)
at
uk.co.pointofcare.echobase.snosled.neoimpl.NeoLoadRunner.loadFile(NeoLoadRunner.java:129)
at
uk.co.pointofcare.echobase.snosled.neoimpl.NeoLoadRunner.sequenceLoading(NeoLoadRunner.java:107)
at
uk.co.pointofcare.echobase.snosled.neoimpl.NeoLoadRunner.batchload(NeoLoadRunner.java:63)
at
uk.co.pointofcare.echobase.snosled.neoimpl.NeoLoadRunner.main(NeoLoadRunner.java:41)

>From the following code segment:

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.
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to