2

I have a gml file that I read it with java in eclipse and I want to know how to store the result of the code below in neo4j:

   TinkerGraph graph = new TinkerGraph();
   GMLReader gml= new GMLReader(graph);
   gml.inputGraph("/home/salma/Desktop/celegansneural.gml"); 
Salma Hakim
  • 105
  • 8

1 Answers1

1

You can import graphml and other formats from the neo4j shell with the help of the following: https://github.com/jexp/neo4j-shell-tools

Then just open the shell and use the command:

import-graphml -it /home/salma/Desktop/celegansneural.gml

The -t option tells it to import the node labels as well.

abruski
  • 851
  • 3
  • 10
  • 27
  • the command gives me error : neo4j-sh (?)$ import-graphml -it /home/salma/Desktop/celegansneural.gml Unknown command 'import-graphml' – Salma Hakim Aug 05 '16 at 11:00
  • neo4j-sh (?)$ import-graphml -it /home/salma/Desktop/celegansneural.gml Unknown command 'import-graphml' – Salma Hakim Aug 05 '16 at 11:03
  • Did you follow the instructions in the link that I provided? – abruski Aug 05 '16 at 11:04
  • i thought the installation of neo4j-shell-tools was not necessary so i didn't do it that's why it gives the unkown command error! but now i follow all the steps including the installation part and it gives me this : GraphML-Import file /home/salma/Desktop/celegansneural.gml rel-type RELATED_TO batch-size 40000 use disk-cache false finish after 0 row(s) 0. 0%: nodes = 0 rels = 0 properties = 0 time 208 ms total 208 ms ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog. Can you please tell me what means this result – Salma Hakim Aug 05 '16 at 11:15
  • The file should be proper graphml. It should begin like this: – abruski Aug 05 '16 at 11:18
  • If your graph is directed change edgedefault – abruski Aug 05 '16 at 11:18
  • ok it works now i was working with file .gml but when i worked with the xml extension for the same file it works , thank you for the help – Salma Hakim Aug 05 '16 at 11:26
  • @aburski is there a way to import the gml file not the xml ? – Salma Hakim Aug 05 '16 at 11:44