OrientDB time series data not populating

55 views
Skip to first unread message

Kiran

unread,
Oct 13, 2015, 5:07:29 AM10/13/15
to OrientDB
I just read about the OrientDB so tried to create a simple program to populate the TimeSeries data to get a hold on how it works. but I don't see it work correctly. let me explain what I did. 

BTW I am using c# and .Net 4.5 to connect with the database

  1. Created the data structure
public class Year : OVertex
{
    public string Label { get; set; }
    public HashSet<ORID> Months { get; set; }
}
public class Month : OVertex
{
    public string Label { get; set; }
    public HashSet<ORID> Days { get; set; }
}
public class Day : OVertex
{
    public string Label { get; set; }
    public HashSet<ORID> Hours { get; set; }
}
public class Hour : OVertex
{
    public string Label { get; set; }
    public string Log { get; set; }
}
2. I have a simple button click handler that looks like below.
OClient.CreateDatabasePool("127.0.0.1", 2424, "TimeSeries", ODatabaseType.Graph, "admin", "admin", 10, "myTimeSeries");
using (ODatabase graph = new ODatabase("myTimeSeries"))
  {
           graph.Create.Class<Year>().Extends<OVertex>().CreateProperties().Run();
            graph.Create.Class<Month>().Extends<OVertex>().CreateProperties().Run();
            graph.Create.Class<Day>().Extends<OVertex>().CreateProperties().Run();
            graph.Create.Class<Hour>().Extends<OVertex>().CreateProperties().Run();

            var start = DateTime.Now;
            //add a few year vertex
            for (int yy = 2015; yy < 2016; yy++) 
            {
                //all months this year

                var months = new HashSet<ORID>();
                //add all the months
                for (int mm = 0; mm < 12; mm++) 
                {
                    var days = new HashSet<ORID>();
                    for (int dd = 1; dd < 32; dd++)
                    {
                        var hours = new HashSet<ORID>();
                        for (int i = 0; i < 24; i++)
                        {
                            var hour = new Hour { Label = i + ":00 to " + i + ":59" };
                            graph.Create.Vertex<Hour>(hour).Run();
                            hours.Add(hour.ORID);
                        }
                        var day = new Day { Hours = hours, Label = dd.ToString() };
                        graph.Create.Vertex<Day>(day).Run();
                        days.Add(day.ORID);
                    }
                    var month = new Month { Days = days, Label = mm.ToString() };
                    graph.Create.Vertex<Month>(month).Run();
                    months.Add(month.ORID);
                }
                var year = new Year { Months = months, Label = yy.ToString() };
                graph.Create.Vertex(year).Run();
            }
            MessageBox.Show("Completed in := " + DateTime.Now.Subtract(start).TotalSeconds.ToString() + " sec");
        }

The issue I see with the above code is that:

  1. Once I run this code, it creates the required classes in the database but I see no data in there.
  2. The code takes almost 2 minutes to complete this task, where as in Neo4J with cypher, I am able to get this completed in less than 10 sec as I can chain the queries and execute it in one go.

Also I think I may have got it wrong, but there seams to be no way to chain the multiple queries in one go and execute it together to seed up the batch operations.

can some one please explain me what I may be doing wrong here?


Regards Kiran

Reply all
Reply to author
Forward
0 new messages