Skip to content

Commit

Permalink
Merge pull request #598 from sennetconsortium/maxsibilla/modify-predi…
Browse files Browse the repository at this point in the history
…cate

Maxsibilla/modify predicate
  • Loading branch information
maxsibilla authored Feb 4, 2025
2 parents 51ef878 + 66181e5 commit 496849d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.22
1.5.23
2 changes: 1 addition & 1 deletion entity-api-spec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.0.0
info:
description: 'The SenNet Entity API is a standard RESTful web service with create, update and read operations for the standard SenNet provenance graph entities.'
version: 1.5.22
version: 1.5.23
title: SenNet Entity API
contact:
name: SenNet Help Desk
Expand Down
8 changes: 4 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@ def get_ancestors(id):
property_list = app_neo4j_queries.get_ancestors(neo4j_driver_instance, uuid, data_access_level, properties=segregated_properties[0] + segregated_properties[2], is_include_action=properties_action)
complete_entities_list = schema_manager.get_complete_entities_list(token, property_list, segregated_properties[1], is_include_action=properties_action)
# Final result
final_result = complete_entities_list
final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list)

# Return all the details if no property filtering
else:
Expand Down Expand Up @@ -1805,7 +1805,7 @@ def get_descendants(id):
property_list = app_neo4j_queries.get_descendants(neo4j_driver_instance, uuid, data_access_level, properties=segregated_properties[0] + segregated_properties[2], is_include_action=properties_action)
complete_entities_list = schema_manager.get_complete_entities_list(token, property_list, segregated_properties[1], is_include_action=properties_action)
# Final result
final_result = complete_entities_list
final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list)
# Return all the details if no property filtering
else:
descendants_list = app_neo4j_queries.get_descendants(neo4j_driver_instance, uuid, data_access_level,
Expand Down Expand Up @@ -1935,7 +1935,7 @@ def get_parents(id):
property_list = app_neo4j_queries.get_parents(neo4j_driver_instance, uuid, properties=segregated_properties[0] + segregated_properties[2], is_include_action=properties_action)
complete_entities_list = schema_manager.get_complete_entities_list(token, property_list, segregated_properties[1], is_include_action=properties_action)
# Final result
final_result = complete_entities_list
final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list)
# Return all the details if no property filtering
else:
parents_list = app_neo4j_queries.get_parents(neo4j_driver_instance, uuid)
Expand Down Expand Up @@ -2037,7 +2037,7 @@ def get_children(id):
property_list = app_neo4j_queries.get_children(neo4j_driver_instance, uuid, properties=segregated_properties[0] + segregated_properties[2], is_include_action=properties_action)
complete_entities_list = schema_manager.get_complete_entities_list(user_token, property_list, segregated_properties[1], is_include_action=properties_action)
# Final result
final_result = complete_entities_list
final_result = schema_manager.normalize_entities_list_for_response(complete_entities_list)
# Return all the details if no property filtering
else:
children_list = app_neo4j_queries.get_children(neo4j_driver_instance, uuid)
Expand Down
4 changes: 2 additions & 2 deletions src/app_neo4j_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ def get_ancestors(neo4j_driver, uuid, data_access_level=None, properties: List[s

predicate = ''
if data_access_level:
predicate = f"AND t.data_access_level = '{data_access_level}' "
predicate = f"AND (t.status='Published' OR t.data_access_level = '{data_access_level}') "

if isinstance(properties, list):
query = (f"MATCH (e:Entity)-[:USED|WAS_GENERATED_BY*]->(t:Entity) "
Expand Down Expand Up @@ -685,7 +685,7 @@ def get_descendants(neo4j_driver, uuid, data_access_level=None, entity_type=None

predicate = ''
if data_access_level:
predicate = f"AND t.data_access_level = '{data_access_level}' "
predicate = f"AND (t.status='Published' OR t.data_access_level = '{data_access_level}') "

if isinstance(properties, list):
query = (f"MATCH (e:Entity)<-[:USED|WAS_GENERATED_BY*]-(t:Entity) "
Expand Down
3 changes: 1 addition & 2 deletions src/schema/schema_neo4j_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,8 +2233,7 @@ def exclude_include_query_part(properties:List[str], is_include_action = True, t
if is_include_action is False:
action = 'NOT'

if not len(properties) == 1:
schema.schema_manager.get_schema_defaults(properties, is_include_action, target_entity_type)
schema.schema_manager.get_schema_defaults(properties, is_include_action, target_entity_type)

# unwind the keys of the results from target/t
query_part = (f"WITH keys(t) AS k1, t unwind k1 AS k2 "
Expand Down

0 comments on commit 496849d

Please sign in to comment.