(relations: Relation[])
| 125 | } |
| 126 | |
| 127 | async createRelations(relations: Relation[]): Promise<Relation[]> { |
| 128 | const graph = await this.loadGraph(); |
| 129 | const newRelations = relations.filter(r => !graph.relations.some(existingRelation => |
| 130 | existingRelation.from === r.from && |
| 131 | existingRelation.to === r.to && |
| 132 | existingRelation.relationType === r.relationType |
| 133 | )); |
| 134 | graph.relations.push(...newRelations); |
| 135 | await this.saveGraph(graph); |
| 136 | return newRelations; |
| 137 | } |
| 138 | |
| 139 | async addObservations(observations: { entityName: string; contents: string[] }[]): Promise<{ entityName: string; addedObservations: string[] }[]> { |
| 140 | const graph = await this.loadGraph(); |
no test coverage detected