def radd_handler(item): """Handler method for RADD dependencies. Creates the RADD entities and relationship to the variable. Args: var: the variable object (from the Variable Catalog). var_entity: Var object corresponding to the var object. """ variable_type = item.get('type') variable_name = item.get('name') table_name = item['table_name'] field_name = item['field_name'] radd_key = item['keys'] var_entity = create_radd_var(variable_type, variable_name) for keys in radd_key: if keys: for item in keys: if 'variable' in item: print 'keyname '+item['name'] key_entity = Var(name=item['name']) key_entity.create_node() var_entity.create_unique_relationship('USING_KEY', key_entity.node) if is_empty(table_name): pass radd_entity = create_radd_entities(table_name) var_entity.create_unique_relationship('QUERIES', radd_entity.node)
def reading_edge_handler(edge_container, edge_key, raw_edge, var_entity): """Handler method for Edge Container dependencies. Creates the Edge Container entities and relationship to the variable. Args: var: the variable object (from the Variable Catalog). var_entity: Var object corresponding to the var object. """ if is_empty(edge_container): return edge_entity = EdgeContainer(name=edge_container) edge_entity.create_node() var_entity.create_unique_relationship('ATTRIBUTE_OF', edge_entity.node) if is_empty(edge_key): return key_entity = Var(name=edge_key) key_entity.create_node() var_entity.create_unique_relationship('USING_KEY', key_entity.node) if is_empty(raw_edge): return raw_edge_entity = Var(name=raw_edge, is_raw_edge=True) raw_edge_entity.create_node() var_entity.create_unique_relationship('DERIVE_FROM', raw_edge_entity.node)
def create_raw_edge_entity(variable_name, aggregation_type, edge_type): var_entity = Var(name=variable_name , type='EDGE', aggregation_type = aggregation_type, edge_type = edge_type, is_raw_edge = True) var_entity.create_node() return var_entity
def create_reading_edge_entity(container_key, aggregation_type, variable_name, edge_type): var_entity = Var(name=variable_name, type='EDGE', aggregation_type = aggregation_type, container_key= container_key, edge_type = edge_type, ) var_entity.create_node() return var_entity
def _create_raw_edge_entity(self, var): print 'need update ', var['variable_name'] var_entity = Var(name=var['variable_name'], release_date=var['release_date'], status=var['variable_status'], code_link=var.get('code_link', ''), type='EDGE', is_raw_edge=True) var_entity.create_node() return var_entity
def create_radd_var(variable_type, variable_name, iseve): """Creates the variable entity and the remote node in the datastore. Args: var: a dictionary with the variable data. Returns: The newly created entity. """ try: var_entity = Var(name=variable_name, is_eve_radd=True, type='RADD') var_entity.create_node() return var_entity except ValueError: pass
def _create_var_entity(self, var): """Creates the variable entity and the remote node in the datastore. Args: var: a dictionary with the variable data. Returns: The newly created entity. """ try: print 'need update ', var['variable_name'] var_entity = Var(name=var['variable_name'], release_date=var['release_date'], status=var['variable_status'], type=var['variable_type']) var_entity.create_node() return var_entity except ValueError: pass