Hi Luigi, Thanks so much:) Best regards Devin 在 2015年8月31日星期一 UTC+2下午5:39:09,Luigi Dell'Aquila写道: > > Hi Devin, > > you can use > > var vertex = orient.getGraph().getVertex(yourDoc); > > Regards > > Luigi > > > 2015-08-28 10:39 GMT+02:00 Devin Lee <[email protected] <javascript:>>: > >> and here is my code///// >> >> var findView = orient.getGraph().command("gremlin","g.V.has('xid','" + >> SourceViewXid + "')"); >> var iterator = orient.getGraph().command("gremlin","g.V.has('xid','" + >> findView.getProperty("xid") +"').out('hasComponent')"); >> //return iterator[0]; >> var newView = orient.getGraph().addVertex("class:View"); >> newView.setProperty('name',ViewName); >> newView.setProperty('xid',ViewXid); >> >> var list = []; >> for(var i=0; i<iterator.length; i++){ >> var newComponent = db.newInstance("Component"); >> newComponent.fromStream(iterator[i].toStream()); >> //newComponent.field("xid",xid); >> //newComponent.field("name",PointName); >> newComponent.save(); >> list.push(newComponent); >> } >> >> for(var j=0; j<list.length; j++) >> { >> //Vertex result = new >> OrientVertex(graph.getRawGraph(),results.get(0).getDocument()) >> var result = >> orient.getGraph(list[j].getDocument()).vertices().iterator().next(); >> //var result = orient.getGraph().query().has("dataPointXid", >> list[j].field("dataPointXid")).vertices().iterator().next(); >> orient.getGraph().addEdge(null,newView,result,"hasComponent"); >> } >> >> >> 在 2015年8月28日星期五 UTC+2上午8:44:31,Luigi Dell'Aquila写道: >>> >>> Hi Devin, >>> >>> is your js an OFunction? Or are you referring to NodeJS application? >>> >>> Luigi >>> >>> 2015-08-27 15:46 GMT+02:00 Devin Lee <[email protected]>: >>> >>>> Anyone who knows that how to change document to vertex by javascript. >>>> Best regards >>>> Devin >>>> >>>> -- >>>> >>>> --- >>>> 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. >>>> >>> >>> -- >> >> --- >> 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.
