Hi, 
i'm trying to implement a time series function in Orient Graph 2.0.8
i would like to build a simple series like the following

Time --next--> Time --next--> Time --last-->Time

where Time is a Vertex with timestamp and next and last are edges defined 
both as classes at shema level
target in the function is attached to the newly created timestamp Vertex

my function is as folllow

var now = new Date().getTime();
    var gdb = orient.getGraph();
    var last;
    try {
        //create time vtx
        last = gdb.addVertex('class:Time');
        last.setProperty('last_update', now);
        //create edge  target->now
        var targetV=gdb.getVertex(target);
        if (targetV!=null){
            
          //return newLastE;
            //se c'era un last aggiorno gli archi
            var lastsE = gdb.getEdgesOfClass('last');
            if (lastsE.iterator().hasNext()) {
                var oldLastE =lastsE.iterator().next();
                 //return oldLastE;

                var inV=oldLastE.getInVertex();
                //return inV;
                var outV=oldLastE.getOutVertex();
                //return outV;

                var next=gdb.addEdge(null, outV, inV, "next");
              //return next;
                oldLastE.remove();
                //return oldLastE;
                gdb.addEdge(null, inV, last, "last");
            }else{
                //first time run
                var root = gdb.addVertex('class:Time');
                root.setProperty('last_update', 0);
                gdb.addEdge(null, root, last, "last");
            }
          var newLastE=gdb.addEdge(null, targetV, last, "updated"); //(id, 
in, out, class)
        }
        gdb.commit();
    } catch (err) {
        gdb.rollback();
        response.send(500, 'error creating time vertex', 'text/plain', 
err.toString());
    }
    return last;



the problem arise when i try to build the edge 'next' with an error

java.lang.ClassCastException: 
Cannotcastcom.orientechnologies.orient.core.record.impl.ODocumenttocom.tinkerpop.blueprints.Vertex

i can i avoid this Cast and go ahead ?

thanks for your time

-- 

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