@@ -146,13 +146,9 @@ def extract_metakgedges(self, ops, extra_data=None):
146146 smartapi_data = op ["association" ]["smartapi" ]
147147 url = (smartapi_data .get ("meta" ) or {}).get ("url" ) or extra_data .get ("url" )
148148 _id = smartapi_data .get ("id" ) or extra_data .get ("id" )
149-
150149 edge = {
151150 "subject" : op ["association" ]["input_type" ],
152151 "object" : op ["association" ]["output_type" ],
153- # check if required, apply logic accordingly
154- # "subject_prefix": op["association"]["input_id"],
155- # "object_prefix": op["association"]["output_id"],
156152 "predicate" : op ["association" ]["predicate" ],
157153 "api" : {
158154 "name" : op ["association" ]["api_name" ],
@@ -169,6 +165,11 @@ def extract_metakgedges(self, ops, extra_data=None):
169165 # "username": (smartapi_data.get("meta") or {}).get("username"),
170166 },
171167 }
168+ # Conditionally add subject_prefix and object_prefix if they exist
169+ if "input_id" in op ["association" ]:
170+ edge ["subject_prefix" ] = op ["association" ]["input_id" ]
171+ if "output_id" in op ["association" ]:
172+ edge ["object_prefix" ] = op ["association" ]["output_id" ]
172173 # include bte-specific edge metadata
173174 bte = {}
174175 for attr in ["query_operation" , "response_mapping" ]:
0 commit comments