Skip to content

Commit

Permalink
added conditional for new key set
Browse files Browse the repository at this point in the history
  • Loading branch information
NikkiBytes committed Oct 31, 2024
1 parent 2f82910 commit 98695d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/metakg/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,9 @@ def extract_metakgedges(self, ops, extra_data=None):
smartapi_data = op["association"]["smartapi"]
url = (smartapi_data.get("meta") or {}).get("url") or extra_data.get("url")
_id = smartapi_data.get("id") or extra_data.get("id")

edge = {
"subject": op["association"]["input_type"],
"object": op["association"]["output_type"],
# check if required, apply logic accordingly
# "subject_prefix": op["association"]["input_id"],
# "object_prefix": op["association"]["output_id"],
"predicate": op["association"]["predicate"],
"api": {
"name": op["association"]["api_name"],
Expand All @@ -169,6 +165,11 @@ def extract_metakgedges(self, ops, extra_data=None):
# "username": (smartapi_data.get("meta") or {}).get("username"),
},
}
# Conditionally add subject_prefix and object_prefix if they exist
if "input_id" in op["association"]:
edge["subject_prefix"] = op["association"]["input_id"]
if "output_id" in op["association"]:
edge["object_prefix"] = op["association"]["output_id"]
# include bte-specific edge metadata
bte = {}
for attr in ["query_operation", "response_mapping"]:
Expand Down

0 comments on commit 98695d4

Please sign in to comment.