blob: be60b0590948b72e6cfeb1339867903704b7b3a5 [file] [log] [blame]
Michael Lando451a3402017-02-19 10:28:42 +02001import json
2import sys
3
4dict = {}
5dupliacteUid = {}
6#debugFlag = True
7debugFlag = False
8
9def debug(str1, str2=""):
10 'print only if debug enabled'
11 if (debugFlag == True): print str1, str2
12
13print 'Number of arguments:', len(sys.argv), 'arguments.'
14
15
16with open(sys.argv[1]) as json_file:
17 json_data = json.load(json_file)
18 for x in json_data['vertices']:
19 uid = None
20 nodeLabel=x.get('nodeLabel')
21 debug(nodeLabel)
22 if ( nodeLabel == 'user' ):
23 uid = x['userId']
24 elif ( nodeLabel == 'tag' ):
25 uid = x['name']
26 elif ( nodeLabel == None ):
27 pass
28 elif ( nodeLabel == 'lockNode' ):
29 uid = x.get('uid')
30 else: uid = x['uid']
31
32 debug(nodeLabel, uid)
33
34 existId = dict.get(uid)
35 if (existId == None):
36 dict[uid] = x.get('_id')
37 else:
38 dupliacteUid[uid] = existId
39
40 print dupliacteUid
41
42# with open('data.txt', 'w') as outfile:
43# json.dump(json_data, outfile)
44
45
46
47# print x['uid']