Good point, even edges with the same label are created as lightweight.  

Not sure what Lvc@ is trying to say on the doc page, but I really hope that 
multiple lightweight edges are allowed for every Vertex, that's a VERY 
useful feature which we use heavily in our latest project.  And I like that 
I can mix lightweight and heavy edges in the same vertex (e.g. by 
un-commenting the heavy edge line in my example).

On Thursday, January 8, 2015 at 1:03:38 AM UTC-7, Riccardo Tasso wrote:
>
> Hi Keith.
>
> I don't like very much your example, since I'm expecting that edges with 
> different labels could exists between the same two vertices.
> From the last documentation I thought that the first edge created was 
> lightweight and the following were created as record.
>
> Anyway I used your code to produce another example, which I think is more 
> appropriated:
>
> import com.tinkerpop.blueprints.Direction;
> import com.tinkerpop.blueprints.Edge;
> import com.tinkerpop.blueprints.impls.orient.OrientEdge;
> import com.tinkerpop.blueprints.impls.orient.OrientGraphFactory;
> import com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx;
> import com.tinkerpop.blueprints.impls.orient.OrientVertex;
>
> public class O2GraphLWEdges
> {
>     public static void main(String[] args)
>     {
>         long start = System.currentTimeMillis();
>
>         OrientGraphFactory gfactory = new 
> OrientGraphFactory("memory:temp");
>         
>         try
>         {
>             OrientGraphNoTx graph = gfactory.getNoTx(); // get an instance 
> from the pool
>             graph.setUseLightweightEdges(true);
>
>             try
>             {
>                 
>                 OrientVertex v1 = graph.addVertex("class:V1", "name", 
> "Luca");
>                 OrientVertex v2 = graph.addVertex("class:V1", "name", 
> "Marko");
>                 OrientEdge e = graph.addEdge(null, v1, v2, "knows");
>                 if(e.isLightweight())
>                 System.out.println("created lightweight edge");
>                 e = graph.addEdge(null, v1, v2, "knows");
>                 if(e.isLightweight())
>                 System.out.println("created lightweight edge");
>                 e = graph.addEdge(null, v1, v2, "knows");
>                 if(e.isLightweight())
>                 System.out.println("created lightweight edge");
>                 e = graph.addEdge(null, v1, v2, "knows");
>                 if(e.isLightweight())
>                 System.out.println("created lightweight edge");
>                 
>                 System.out.println("Edges as Record: " + 
> Long.toString(graph.countVertices("E")));
>                 
>                 Iterable<Edge> edges = v1.getEdges(Direction.OUT);
>                 long i = 0;
>                 for(Edge edge : edges)
>                 i += 1;
>                 System.out.println("Outgoung Edges startign from v1: " + 
> Long.toString(i));
>             }
>             catch (Exception ex)
>             {
>                 try
>                 {
>                     graph.rollback();
>                 }
>                 catch (Exception ex1)
>                 {
>                     System.err.println("rollback exception! " + ex);
>                 }
>
>                 System.err.println("operation exception! " + ex);
>                 ex.printStackTrace(System.err);
>             }
>             finally
>             {
>                 graph.shutdown();
>             }
>         }
>         catch (Exception ex)
>         {
>             System.err.println("instance exception! " + ex);
>             ex.printStackTrace(System.err);
>         }
>         finally
>         {
>             gfactory.close();
>         }
>
>         System.out.println("done in " + (System.currentTimeMillis() - 
> start) + "ms");
>     }
> }
>
> The output is (Orient 1.7.10):
>
> created lightweight edge
> created lightweight edge
> created lightweight edge
> created lightweight edge
> Edges as Record: 0
> Outgoung Edges startign from v1: 4
> done in 787ms
>
> *My expectations where all wrong: multiple lightweight edges, with the 
> same label, between the same vertices can exist.*
>
> I can't clearly state if it's a bug or it's a feature, but documentation 
> should be fixed.
>
> Cheers,
>    Riccardo
>
>
>
> Il giorno mercoledì 7 gennaio 2015 20:55:10 UTC+1, Keith Freeman ha 
> scritto:
>>
>> Sorry, but I don't think the correction is right either: "two vertices 
>> are connected by maximum 1 edge, so if you already have one edge between 
>> two vertices and you're creating a new edge between the same vertices, the 
>> second edge will be regular."
>>
>> I just wrote a quick java program (on 2.0-rc1) that creates 2 vertices 
>> and 4 edges between them, all 4 edges are lightweight.  It seems the only 
>> real condition is that the edge have no properties (and of course that the 
>> database is configured for lightweight edges).
>>
>
>

-- 

--- 
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