Hi Michael,

First of all, I would like to update you that i am doing this for learning 
exercise, not a serious implementation.

Here is the python code and some sample entries. What I am going to show 
case is, want to display the shortest path from one place to another place.

Below are the few records i am trying to import 

1::EGLL EGLL DCT BUZAD DCT WELIN DCT TNT DCT RODOL DCT MIMKU DCT AGORI DCT 
BREKI DCT KEF DCT BIKF/0255 BIKF
2::EGLL EGLL DCT WOBUN DCT WELIN UN57 POL UN601 MARGO UN590 NINEX UP59 
BALIX DCT 6300N/02000W DCT 6500N/03000W DCT 6500N/04000W DCT 6500N/05000W 
DCT 6200N/06000W DCT VIMLA DCT 5900N/07000W DCT KPHX/0956 KPHX
4::EGLL EGLL DCT WOBUN DCT WELIN UN57 POL UN601 STN UN615 BESGA UN615 MATIK 
DCT 6300N/01000W DCT 6800N/02000W DCT 7000N/03000W DCT 7100N/04000W DCT 
7200N/06000W DCT MEDPA DCT NCAH DCT 7000N/09000W DCT NCAH DCT 6352N/11000W 
DCT NCAH DCT YHY J526 YQU DCT YDC J503 FOLDY DCT LKV J3 RBL DCT PYE GOLDN4 
KSFO KSFO
5::EGLL EGLL DCT CPT UL9 STU UL175 CRK UN523 DOLIP UN523 LIMRI DCT 
5200N/02000W DCT 5200N/03000W DCT 5200N/04000W DCT 5000N/05000W DCT KOBEV 
DCT YQX N124B TUSKY J575 BOS J75 MXE V378 BAL DCT KBWI/0727 KBWI
6::EGLL EGLL DCT WOBUN DCT WELIN UN57 POL UN601 MARGO UN590 NINEX UP59 
BALIX DCT 6000N/02000W DCT 5900N/03000W DCT 5800N/04000W DCT 5600N/05000W 
DCT SCROD DCT VALIE N260A ROBBE N260A MT DCT TVC DCT PMM PMM4 KORD/0742 KORD
7::EGLL EGLL DCT CPT UL9 STU UL175 CRK UN523 DOLIP UN523 LIMRI DCT 
5200N/02000W DCT 5200N/03000W DCT 5200N/04000W DCT 5000N/05000W DCT KOBEV 
DCT YQX N124B TUSKY DCT PLYMM PLYMM4 KJFK/0636 KJFK
8::EGLL EGLL DCT MID UN615 XAMAB UL612 RESMI UL851 MELKO UM606 MANAG UM139 
ARPUS DCT LFSB/0101 LFSB
9::EGLL EGLL DCT CPT UL9 STU UL175 CRK UN523 DOLIP UN523 LIMRI DCT 
5200N/02000W DCT 5200N/03000W DCT 5200N/04000W DCT 5000N/05000W DCT KOBEV 
DCT YQX DCT 4500N/06000W DCT ENGLE A700 SLATN DCT CLXTN A699 LOUIZ A699 
NUCAR DCT HEATT HEATT6 KMIA/0815 KMIA
10::EGLL EGLL DCT CPT UL9 STU UL175 CRK UN523 DOLIP UN523 LIMRI DCT 
5200N/02000W DCT 5200N/03000W DCT 5200N/04000W DCT 5000N/05000W DCT KOBEV 
DCT YQX N124B TUSKY DCT PLYMM PLYMM4 KJFK/0647 KJFK

Thanks,
Kannan


On Tuesday, February 23, 2016 at 4:27:21 PM UTC+5:30, Michael Hunger wrote:
>
> Hey,
>
> I couldn't really figure out anything from your screenshot. You will have 
> to share code / queries and a repeatable test case.
> Not sure what that "token" message means.
>
> On Tue, Feb 23, 2016 at 10:28 AM, Kannan Babu <[email protected] 
> <javascript:>> wrote:
>
>> Hi Michael,
>>
>> thanks for your suggestion. Before making the batch from 10k to 50k i 
>> would like to know what's the root cause of this error.
>>
>> Whether Py2neo not able to process after 65k records? or will be any 
>> issue in neo4j side.
>>
>> Once again thanks for your reply.
>>
>>
>>
>> On Tuesday, February 23, 2016 at 12:46:18 PM UTC+5:30, Michael Hunger 
>> wrote:
>>>
>>> No really sure what you do, could be that you have to batch your updates 
>>> into 10k to 50k large batches
>>>
>>> Von meinem iPhone gesendet
>>>
>>> Am 18.02.2016 um 06:55 schrieb Kannan Babu <[email protected]>:
>>>
>>> Hi All,
>>>
>>> I tried to import some flight db in to neo4j using python via py2neo, 
>>> for each route i am trying to create a relationship, 
>>>
>>> when 65873 records processed the script stops.
>>>
>>> I have attached the error for your reference. 
>>>
>>> any help appreciated. Please let me know if you have any other best 
>>> practice to import the large dataset in to neo4j.
>>>
>>> Many thanks,
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Neo4j" 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.
>>>
>>> <flight_import_error.png>
>>>
>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Neo4j" 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 
"Neo4j" 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.
#!/usr/bin/python
from py2neo import neo4j,Node,Relationship,authenticate,Graph,cypher

#authenticate("localhost:7474", "neo4j","password")
authenticate("localhost:7474", "neo4j","admin123")
graph_db = neo4j.Graph("http://localhost:7474/db/data";)

file="routes.txt"
with open(file, 'r') as f:
	contents = f.readlines()

for line in contents:
	sp = line.split("::")
	rts = sp[1].split(" ")
	linenum = sp[0]
	i = 0
	for rt in rts:
		#print "Create/Lookfor "+rt
		node = graph_db.find_one("Routes","name",rt)
		if node is None:
			node = Node("Routes",name=rt)
			graph_db.create(node)
			node.properties["name"] = rt
		if(i==0):
			node.properties["type"]=rt
			node.push()
		else:
			if (node != prevnode):
				node.properties["type"]=rt
				rel = Relationship(prevnode,linenum,node)
				#rel = Relationship(prevnode,"NextWP",node)
				rel.properties["routeid"] = linenum
				graph_db.create(rel)
				node.push()
		prevnode=node
		i=i+1
	#node.properties["type"]="Destination"
	#node.push()
	#print "Last node : "+node.properties["name"]+" "+node.properties["type"]
	print "Processed : "+linenum

Reply via email to