Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hanging when creating edge with useLightweightEdges enabled #166

Open
DarrenLamb opened this issue Oct 31, 2018 · 0 comments
Open

hanging when creating edge with useLightweightEdges enabled #166

DarrenLamb opened this issue Oct 31, 2018 · 0 comments

Comments

@DarrenLamb
Copy link

DarrenLamb commented Oct 31, 2018

I'm new to OrientDb (and noSQL databases in general) and have put together a small application to model "friend" relationships.

The "FriendOf" edge is ideally just a link between two Person vertices, I had read in the documentation that the use of lightweight edges may increase performance. The below code works fine when lightweight edges are disabled. However, when enabling them the line to create the edge hangs.

Am I missing something?

public static void EnableLightweightEdges(ODatabase orient)
{
  orient.Command("ALTER DATABASE custom useLightweightEdges=true");
}

public static void DisableLightweightEdges(ODatabase orient)
{
   orient.Command("ALTER DATABASE custom useLightweightEdges=false");
}

public ODatabase Connect()
{
   return new ODatabase(_connectionOptions);
}

public void EnsureCreated()
{
   using (var orient = Connect())
   {
       DisableLightweightEdges(orient);
       if (!orient.Schema.IsClassExist<Person>())
       {
           orient.Create.Class<Person>().Extends<OVertex>().CreateProperties().Run();
       }

       if (!orient.Schema.IsClassExist("FriendOf"))
       {
           orient.Create.Class("FriendOf").Extends<OEdge>().Run();
       }
       CreatePeople(orient);
   }
}

private static void CreatePeople(ODatabase orient)
{         
   // Clear existing data
   orient.Delete.Edge("FriendOf").Run();
   orient.Delete.Vertex<Person>().Run();

   var person1 = new Person {Id = Guid.Parse("199a5b7a-b4fe-4927-901b-d5b5d2226045"), Name = "Person1"};
   var person1Vertex = orient.Create.Vertex(person1).Run();

   var person2 = new Person {Id = Guid.Parse("5dee19d8-86f0-41a8-b2d8-62a77f80b6d1"), Name = "Person2"};
   var person2Vertex = orient.Create.Vertex(person2).Run();

   orient.Create.Edge("FriendOf").From(person1.ORID).To(person2.ORID).Run();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant