Hi there,
Could you post the whole stacktrace of the exception in order to get some
more details?

/peter

Send from my mobile device, please excuse typos and brevity.
On Apr 1, 2011 3:44 PM, "bhargav gunda" <bhargav....@gmail.com> wrote:
> Respected,
>
> I created a graph and now i want to delete relationships in the graph
based
> on condition which is dependent of time.
>
> I have allotted systemTime to each node and as well to each relationship
> between nodes. So based on that I want to remove relationship between
nodes
> if they are older.
> So for this, the code is looks
>
> tx = myappdb.beginTx();
> TraversalDescription td = null;
> final long currentSystemTime = new Date().getTime();
> System.out.printf("Current System time is %d \n",
> currentSystemTime);
> try{
> td =
> Traversal.description().breadthFirst().relationships(relType.Knows,
> Direction.BOTH)
> .uniqueness(Uniqueness.RELATIONSHIP_GLOBAL)
> .evaluator(new Evaluator(){
> public Evaluation evaluate(Path path) {
> Node start = path.startNode();
> Node end = path.endNode();
> Relationship lastRel = path.lastRelationship();
> if(lastRel == null){
> return Evaluation.EXCLUDE_AND_CONTINUE;
> }
> long relTime = (Long)lastRel.getProperty("Timestamp");
> if((currentSystemTime - ms) >= relTime){
> for(Relationship rel :
> start.getRelationships(relType.Knows, Direction.BOTH))
> {
> if (rel.getEndNode().equals(end)){
> rel.delete();
> }
> }
> if(!start.hasRelationship(relType.Knows)){
> start.delete();
> }else if(!end.hasRelationship(relType.Knows)){
> end.delete();
> }
> return Evaluation.INCLUDE_AND_CONTINUE;
> }else{
> return Evaluation.INCLUDE_AND_CONTINUE;
> }
> }
> });
> for (Path path : td.traverse(referenceNode)){
> Node testNode = (Node) path.endNode();
> System.out.println("At Depth " +path.length() + " = " +
> testNode.getProperty("Name"));
> }
> tx.success();
> }catch(Exception ex){
> ex.printStackTrace();
> tx.failure();
> }finally{
> tx.finish();
> }
> .......
> I don't know where I am doing mistake to solve the bug.
> I am getting error "IllegalStateException" and I studied the about the
error
> and delete semantics of nodes and relationships.
> But i tried in different different ways (method calling, without
transation
> commit, ......) to solve, but i couldn't solve. Can any one help me out
from
> this.
>
> One more thing, is there any direct function to clean all nodes which
don't
> have relationships in the space. If so let me know....
>
> Thanks for your time and awaiting for your valuable reply.
>
> Regards,
> G.
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to