Hello Achim,

Thanks a lot for the reply. I modified my code to almost similar to your 
test case. still i'm faced with the same error.
Please can you let me know if you have any suggestions.

 arangoDriver.startBatchMode();;

        for(String line : lines)
        {
            String[] data = line.split(",");
            
            BaseDocument device = new BaseDocument();BaseDocument 
phyAddress = new BaseDocument(); BaseDocument conn = new BaseDocument();
            
            
device.setDocumentKey(data[0]);device.addAttribute("device_id",data[0]);
            phyAddress.addAttribute("address",data[1]);
            conn.addAttribute("weight",0);

            final DocumentEntity<BaseDocument> fromHandle = 
arangoDriver.graphCreateVertex("testGraph", "DeviceId", device, null);    
    
            final DocumentEntity<BaseDocument> toHandle = 
arangoDriver.graphCreateVertex("testGraph", "PhysicalLocation", phyAddress, 
null);
            arangoDriver.graphCreateEdge("testGraph", 
"DeviceId_PhysicalLocation", null,fromHandle.getDocumentHandle(),  
toHandle.getDocumentHandle(), null, null);

        }
        arangoDriver.executeBatch();

Thanks,
Praveen

On Thursday, August 18, 2016 at 12:56:55 PM UTC+5:30, achim....@triagens.de 
wrote:
>
> Hello Praveen,
>
> it is not so easy to create vertices and edges in one batch execution. You 
> need the document handle (document field "_id") of the vertices for the 
> function createGraphEdge().
>
> Example:
>         driver.startBatchMode();
>         final DocumentEntity<TestComplexEntity03> v1 = 
> driver.graphCreateVertex(this.graphName, this.collectionName,
>             new TestComplexEntity03("v1-user", "desc1", 10), null);
>         final DocumentEntity<TestComplexEntity03> v2 = 
> driver.graphCreateVertex(this.graphName, this.collectionName,
>             new TestComplexEntity03("v2-user", "desc2", 12), null);
>         driver.graphCreateEdge(this.graphName, edgeCollectionName, null, 
> v1.getDocumentHandle(), v2.getDocumentHandle(), null, null);
>         driver.executeBatch();
>
> In this example v1.getDocumentHandle() and v2.getDocumentHandle() is null 
> and so createGraphEdge() fails.
>
> If you know the document key of a vertex you can build the document handle 
> by "collectionName" + "/" + "documentKey".
>
> I added a test file 
> <https://github.com/arangodb/arangodb-java-driver/blob/3.0/src/test/java/com/arangodb/ArangoDriverBatchGraphTest.java>
>  
> to the git repo.
>
>
> Am Mittwoch, 17. August 2016 09:30:48 UTC+2 schrieb 
> praveen....@tigeranalytics.com:
>>
>> Hi,
>>
>> I'm using ArangoDB to build a POC. I'm using the Batch mode with the Java 
>> driver to build the application.
>>
>> The Vertices are getting updated in Batch but the edges are not getting 
>> updated at all. The same code works
>> if the Batch mode is removed.
>>
>> Thanks,
>> Praveen
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to arangodb+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to