| 260 | return getattr(module, module_type)(module_info) |
| 261 | |
| 262 | async def create_relationships(self, relationships, operation): |
| 263 | for relationship in relationships: |
| 264 | relationship.origin = operation.id if operation else self.id |
| 265 | await self.save_fact(operation, relationship.source, relationship.score, relationship.shorthand) |
| 266 | await self.save_fact(operation, relationship.target, relationship.score, relationship.shorthand) |
| 267 | if all((relationship.source.trait, relationship.edge)): |
| 268 | knowledge_svc_handle = BaseService.get_service('knowledge_svc') |
| 269 | await knowledge_svc_handle.add_relationship(relationship) |
| 270 | self.relationships.append(relationship) |
| 271 | |
| 272 | async def save_fact(self, operation, fact, score, relationship): |
| 273 | knowledge_svc_handle = BaseService.get_service('knowledge_svc') |