From 8e4386f6900a20ab12ddba15e9f6db7f401e5d80 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Fri, 7 Oct 2022 13:26:03 +0200
Subject: [PATCH] fix wip

---
 .../semantic-enrichment.component.ts          | 26 ++++++++++---------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/app/semantic-enrichment/semantic-enrichment.component.ts b/src/app/semantic-enrichment/semantic-enrichment.component.ts
index 91062ad3a..5e3f9025a 100644
--- a/src/app/semantic-enrichment/semantic-enrichment.component.ts
+++ b/src/app/semantic-enrichment/semantic-enrichment.component.ts
@@ -125,10 +125,11 @@ export class SemanticEnrichmentComponent implements OnInit {
     mappingData.fdpToken = this.data.fdpToken;
     mappingData.dataConcepts = [];
     this.response.forEach((data: KeywordResponse) => {
-      if (data.keywords) {
-        const concepts = new DataConcept();
-        concepts.id = data.id;
-        concepts.iris = [];
+      const concepts = new DataConcept();
+      concepts.id = data.id;
+      concepts.iris = [];
+      if (data.keywords && data.keywords.size > 0) {
+
 
         for (const [key, value] of data.keywords) {
 
@@ -139,16 +140,17 @@ 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(
-                {iri: result.source.document.iri, label: result.source.document.label, originalKeyword: null}
-              )
-            );
-          }
-          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(
+            {iri: result.source.document.iri, label: result.source.document.label, originalKeyword: null}
+          )
+        );
+      }
+      mappingData.dataConcepts.push(concepts);
     });
 
     console.log(mappingData);
-- 
GitLab