Skip to content
Snippets Groups Projects
Commit 9998df45 authored by dcz's avatar dcz
Browse files

Ignore non existing slowal frames

parent e7a5591c
Branches
No related merge requests found
......@@ -54,25 +54,25 @@ class UnifiedFrameImport:
def storeSlowalFrame(cls, tree, unifiedFrame, argumentIdsMapping):
slowal_frame_id = tree._attrs['id']
users = Frame.objects.filter(pk=slowal_frame_id)
if not users.exists():
frames = Frame.objects.filter(pk=slowal_frame_id)
if frames.exists():
unifiedFrame2SlowalFrameMapping = UnifiedFrame2SlowalFrameMapping(unified_frame=unifiedFrame,
slowal_frame_id=slowal_frame_id)
unifiedFrame2SlowalFrameMapping.save()
for subtree in tree._children:
if subtree._name == 'argument_connections':
for subsubtree in subtree._children:
if subsubtree._name == 'argument_connection':
unifier_argument_id = subsubtree._attrs['unifier_argument_id']
slowal_id = subsubtree._attrs['slowal_id']
unifiedFrameArgumentSlowalFrameMapping = UnifiedFrameArgumentSlowalFrameMapping(unified_frame_mapping=unifiedFrame2SlowalFrameMapping,
unified_agrument_id=argumentIdsMapping[unifier_argument_id],
slowal_agrument_id=slowal_id)
unifiedFrameArgumentSlowalFrameMapping.save()
else:
print('Slowal frame do not exists in database: {}', slowal_frame_id)
unifiedFrame2SlowalFrameMapping = UnifiedFrame2SlowalFrameMapping(unified_frame=unifiedFrame,
slowal_frame_id=slowal_frame_id)
unifiedFrame2SlowalFrameMapping.save()
for subtree in tree._children:
if subtree._name == 'argument_connections':
for subsubtree in subtree._children:
if subsubtree._name == 'argument_connection':
unifier_argument_id = subsubtree._attrs['unifier_argument_id']
slowal_id = subsubtree._attrs['slowal_id']
unifiedFrameArgumentSlowalFrameMapping = UnifiedFrameArgumentSlowalFrameMapping(unified_frame_mapping=unifiedFrame2SlowalFrameMapping,
unified_agrument_id=argumentIdsMapping[unifier_argument_id],
slowal_agrument_id=slowal_id)
unifiedFrameArgumentSlowalFrameMapping.save()
@classmethod
def storeUnifiedFrame(cls, frame_tree):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment