From 124c83669972d01560cd73f6cb7676a915509ece Mon Sep 17 00:00:00 2001 From: Baptiste Toulemonde <toulemonde@cines.fr> Date: Fri, 7 Oct 2022 13:34:39 +0200 Subject: [PATCH] fix --- .../semantic-enrichment.component.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/app/semantic-enrichment/semantic-enrichment.component.ts b/src/app/semantic-enrichment/semantic-enrichment.component.ts index 754a5b296..cf8f8a93c 100644 --- a/src/app/semantic-enrichment/semantic-enrichment.component.ts +++ b/src/app/semantic-enrichment/semantic-enrichment.component.ts @@ -125,10 +125,10 @@ export class SemanticEnrichmentComponent implements OnInit { mappingData.fdpToken = this.data.fdpToken; mappingData.dataConcepts = []; this.response.forEach((data: KeywordResponse) => { + const concepts = new DataConcept(); + concepts.id = data.id; + concepts.iris = []; if (data.keywords) { - const concepts = new DataConcept(); - concepts.id = data.id; - concepts.iris = []; Object.values(data.keywords).forEach((value: ESModel) => { if (value && value.results) { @@ -138,12 +138,14 @@ export class SemanticEnrichmentComponent implements OnInit { } }); } - if (this.autocompleteMap.get(data.id) && this.autocompleteMap.get(data.id).length > 0) { - this.autocompleteMap.get(data.id).forEach((result: Result) => concepts.iris.push(result.source.document.iri)); - } - mappingData.dataConcepts.push(concepts); }); } + if (this.autocompleteMap.get(data.id) && this.autocompleteMap.get(data.id).length > 0) { + this.autocompleteMap.get(data.id).forEach((result: Result) => concepts.iris.push(result.source.document.iri)); + } + if (concepts) { + mappingData.dataConcepts.push(concepts); + } }); console.log(mappingData); -- GitLab