Great! Thank you!

Am Mittwoch, 9. April 2014 12:39:30 UTC+2 schrieb Lvc@:
>
> Hi Marc,
> this is the slowest way :-)
>
> Create an index at the beginning against property ID of your class, and 
> then lookup against the index.
>
> Look at: 
> https://github.com/orientechnologies/orientdb/wiki/Graph-Database-Tinkerpop#use-indices
>
> Lvc@
>
>
>
> On 9 April 2014 12:20, Marc Tigges <[email protected] 
> <javascript:>>wrote:
>
>> Sorry, i deleted the last message after some minutes cause i noticed, 
>> that my database was locked (dont know why)
>> Its working!
>>
>> But anyway i think i have another question.
>>
>> This is the method to create a edge:
>>
>> edge = this.graph.addEdge(id, outVertex, inVertex, edgeName);
>>
>> so to create a new edge i need the out and the in vertex. i process my 
>> data in the following way
>>
>>
>>    1.  I parse all classes (vertex types)
>>    2.  I parse all instances (vertices)
>>    3.  I parse all edges (schemaless)
>>    
>> So that means when i create my edges i have to find my in vertex and my 
>> out vertex.
>> What is the most efficient way to do it? At the moment i do it like that:
>>
>>  public void createEdge(String edgeName, String outID, String outClass, 
>> String inID, String inClass, String property) {
>> Vertex outVertex = null;
>>  Vertex inVertex = null;
>> Edge edge = null;
>>  for(Vertex vertex : this.graph.getVerticesOfClass(outClass)) {
>>  if(vertex.getProperty("ID").equals(outID)) {
>> outVertex = vertex;
>> }
>>  }
>>  for(Vertex vertex : this.graph.getVerticesOfClass(inClass)) {
>>  if(vertex.getProperty("ID").equals(inID)) {
>> inVertex = vertex;
>> }
>>  }
>>  edge = this.graph.addEdge(null, outVertex, inVertex, edgeName);
>>  if(property != null) {
>> if(DataType.isInteger(property)) {
>>  edge.setProperty("value", Integer.valueOf(property));
>> } else if(DataType.isDouble(property)) {
>> edge.setProperty("value", Double.valueOf(property));
>>  } else if(DataType.isBoolean(property)) {
>> edge.setProperty("value", Boolean.valueOf(property));
>>  } else if(DataType.isDate(property)) {
>>  edge.setProperty("value", Date.valueOf(property));
>> } else {
>> edge.setProperty("value", property);
>>  }
>> }
>>  this.inkrementStatementCounter();
>> }
>>
>> In my opinion it is not very efficient to iterate over all vertices of a 
>> given class to find the vertex with 
>> the correct id.
>>
>> Is there a more efficient way?
>>
>> Am Mittwoch, 9. April 2014 11:34:10 UTC+2 schrieb Lvc@:
>>
>>> Hi Marc,
>>> where did you get a timeout? Can you post here the full exception? What 
>>> release are you using?
>>>
>>> Lvc@
>>>
>>>>
>>>>   -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "OrientDB" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

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

Reply via email to