Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion java-rest-bindings batch support
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Hunger  
View profile  
 More options Apr 25 2012, 6:09 pm
From: Michael Hunger <michael.hun...@neotechnology.com>
Date: Thu, 26 Apr 2012 00:09:20 +0200
Local: Wed, Apr 25 2012 6:09 pm
Subject: Re: [Neo4j] java-rest-bindings batch support

Daniel,
sorry for that, you're right there is too little documentation (besides the tests).

we also discussed an approach like your Transaction suggestion, the main problem with that is references leaking outside the scope (imho).

But might be worth a try.

Feel free to chime in and try it out.

Cheers

Michael

Let's have a look at the test: BatchRestAPITest

@Test
    public void testCreateRelationship(){
        TestBatchResult r = this.restAPI.executeBatch(new BatchCallback<TestBatchResult>() {
            @Override
            public TestBatchResult recordBatch(RestAPI batchRestApi) {
                TestBatchResult result=new TestBatchResult();
                result.n1 = batchRestApi.createNode(map("name", "newnode1"));
                result.n2 = batchRestApi.createNode(map("name", "newnode2"));
                result.rel = batchRestApi.createRelationship(result.n1, result.n2, Type.TEST, map("name", "rel") );
                result.allRelationships = result.n1.getRelationships();
                return result;
            }
        });

        Relationship foundRelationship = TestHelper.firstRelationshipBetween( r.n1.getRelationships(Type.TEST, Direction.OUTGOING), r.n1, r.n2);
        Assert.assertNotNull("found relationship", foundRelationship);
        assertEquals("same relationship", r.rel, foundRelationship);
        assertEquals("rel", r.rel.getProperty("name"));

        assertThat(r.n1.getRelationships(Type.TEST, Direction.OUTGOING), new IsRelationshipToNodeMatcher(r.n1, r.n2));
        assertThat(r.n1.getRelationships(Direction.OUTGOING), new IsRelationshipToNodeMatcher(r.n1, r.n2));
        assertThat(r.n1.getRelationships(Direction.BOTH), new IsRelationshipToNodeMatcher(r.n1, r.n2));
        assertThat(r.n1.getRelationships(Type.TEST), new IsRelationshipToNodeMatcher(r.n1, r.n2));
        assertThat(r.allRelationships, new IsRelationshipToNodeMatcher(r.n1, r.n2));
    }

Am 25.04.2012 um 21:01 schrieb Daniel Cox:

> Hey All,
> The java-rest-bindings readme says it supports batch operations, but I haven't found any code examples. My best guess is that it supports batches transparently through GraphDatabaseService's transactions, so that I would just do this, and it would kick off a batch operation in tx.success():

> Transaction tx = db.beginTx();
> try {
>  // graph mutations here
> tx.success();
> } finally { tx.finish(); }

> Is that right?
> I'm having a hard time finding anything on the java-rest-binding project, actually.
> Thanks,
> -Daniel


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.