Now that the "gibberish" issue has hidden itself, and keyboard keys work properly, I've returned to the TP2->TP3 migration..
HELP!
I'm having trouble migrating my application from TP2 grammer to TP3.
I was able to create the Vertex s. But I'm having trouble making a
2nd pass over the Vertex set... to pick out connection info at the
end of each Vertex.
See the last 5 lines below. How do I access the 111 Vertex?
Perhaps part of my problem is the extra square brackets; perhaps
indicating an extra level of imbedding...??
....then I'll be able to get this code working to add the edges.. :
def insed(aa,g){
aa.each{
v1=g.getVertex(it[0]);
v2=g.getVertex(it[7]);
v3=g.getVertex(it[8]);
v4=g.getVertex(it[9]);
if (v1 != null && v2 != null)
g.addEdge(g.getVertex(it[7]),g.getVertex(it[0]),'father') ;
if (v1 != null && v3 != null)
g.addEdge(g.getVertex(it[8]),g.getVertex(it[0]),'mother') ;
if ((v1 != null && v4 != null) && (
v1.sx=='M'))
g.addEdge(g.getVertex(it[9]),g.getVertex(it[0]),'wife') ;
if ((v1 != null && v4 != null) && (
v1.sx=='F'))
g.addEdge(g.getVertex(it[9]),g.getVertex(it[0]),'husband');
} }
insed(aa,g)
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> mydir = "C:\\Users\\Thomas\\Documents\\gene\\reports\\"
==>C:\Users\Thomas\Documents\gene\reports\
gremlin> myname = "Just3.csv"
==>Just3.csv
gremlin> myfile = new File(mydir + myname)
==>C:\Users\Thomas\Documents\gene\reports\Just3.csv
gremlin> aa=[]
gremlin> myfile.eachLine{l->fp=l.replaceAll('"','');
gremlin> p=fp.split(",");
gremlin> fxid=Integer.parseInt(p[0]);
gremlin> p[0]=fxid;
gremlin> aa=aa+p;}
==>[1, Murphy, Thomas Robert, M, 18 Oct 1942, 24 Apr 1965, , 222, 332, 111]
==>[57, Murphy, Timothy Robert, M, 17 Jan 1966, 21 Sep 2002, , 1, 111, 464]
==>[222, Murphy, Raymond Joseph, M, 14 Jan 1902, 14 Jan 1925, 20 Dec 1987, 409, 420, 332]
==>[111, Szumiloski, Elizabeth Ann, F, 15 Oct 1943, 24 Apr 1965, , 134, 145, 1]
gremlin> aa.each{if(it[3].size()==0){it[3]=' '}}
==>[1, Murphy, Thomas Robert, M, 18 Oct 1942, 24 Apr 1965, , 222, 332, 111]
==>[57, Murphy, Timothy Robert, M, 17 Jan 1966, 21 Sep 2002, , 1, 111, 464]
==>[222, Murphy, Raymond Joseph, M, 14 Jan 1902, 14 Jan 1925, 20 Dec 1987, 409, 420, 332]
==>[111, Szumiloski, Elizabeth Ann, F, 15 Oct 1943, 24 Apr 1965, , 134, 145, 1]
gremlin> // aa.each{if(it[2].size()>1){bn=it[2];it[2]=bn[1..-1];println it[2]}}.iterate()
==>true
gremlin> for (it in aa[0..aa.size-1]) {if(it[2].size()>1){bn=it[2];it[2]=bn[1..-1]}}
==>null
gremlin>
gremlin> gr = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> g=gr.traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> aa.each{gr.addVertex it[0],[lname:it[1],fname:it[2],sx:it[3],dob:it[4],dom:it[5],dod:it[6]]}
==>[1, Murphy, Thomas Robert, M, 18 Oct 1942, 24 Apr 1965, , 222, 332, 111]
==>[57, Murphy, Timothy Robert, M, 17 Jan 1966, 21 Sep 2002, , 1, 111, 464]
==>[222, Murphy, Raymond Joseph, M, 14 Jan 1902, 14 Jan 1925, 20 Dec 1987, 409, 420, 332]
==>[111, Szumiloski, Elizabeth Ann, F, 15 Oct 1943, 24 Apr 1965, , 134, 145, 1]
gremlin>
gremlin> g.V().values()
==>[lname:Murphy, fname:Thomas Robert, sx:M, dob: 18 Oct 1942, dom: 24 Apr 1965, dod:]
==>[lname:Murphy, fname:Timothy Robert, sx:M, dob: 17 Jan 1966, dom: 21 Sep 2002, dod:]
==>[lname:Murphy, fname:Raymond Joseph, sx:M, dob: 14 Jan 1902, dom: 14 Jan 1925, dod: 20 Dec 1987]
==>[lname:Szumiloski, fname:Elizabeth Ann, sx:F, dob: 15 Oct 1943, dom: 24 Apr 1965, dod:]
gremlin> g.V(111) // <== this line returns nothing at the Console?????