From 02946f2534e01e71923075eb552acf7a2a7f4146 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Thu, 13 Oct 2022 09:39:36 +0200
Subject: [PATCH] add document properties

---
 src/app/dataset/dataset.component.html             |  3 +++
 src/app/dataset/dataset.component.ts               | 14 ++++++++++++++
 src/app/semantic-enrichment/ESModel.ts             |  3 +++
 .../semantic-enrichment.component.html             |  3 +++
 .../semantic-enrichment.component.ts               | 13 +++++++++++++
 5 files changed, 36 insertions(+)

diff --git a/src/app/dataset/dataset.component.html b/src/app/dataset/dataset.component.html
index 01849f3c6..37e778bef 100644
--- a/src/app/dataset/dataset.component.html
+++ b/src/app/dataset/dataset.component.html
@@ -109,6 +109,7 @@
               <th class="text-center">definition</th>
               <th class="text-center">synonyms</th>
               <th class="text-center">score</th>
+              <th class="text-center">harvested from</th>
               </thead>
               <tbody>
               <tr *ngFor="let result of (objet.value).results ">
@@ -120,6 +121,8 @@
                 <td class="text-center">{{ result.source.document.description }}</td>
                 <td class="text-center">{{ result.source.document.synonyms }}</td>
                 <td class="text-center">{{ result.score | number: '2.2-2' }}</td>
+                <td class="text-center"><a href="{{result.source.document.uiLink}}"
+                                          target="_blank">{{getOriginPortalname(result.source.document.harvestedFrom)}}</a></td>
               </tr>
               </tbody>
             </table>
diff --git a/src/app/dataset/dataset.component.ts b/src/app/dataset/dataset.component.ts
index 7c064b27f..25d7252d5 100644
--- a/src/app/dataset/dataset.component.ts
+++ b/src/app/dataset/dataset.component.ts
@@ -150,4 +150,18 @@ export class DatasetComponent implements OnInit {
       },
       () => this.loadingPublish = false);
   }
+
+  getOriginPortalname(harvestedFrom: string): string {
+    if (harvestedFrom.includes('agroportal')) {
+      return 'agroportal';
+    } else if (harvestedFrom.includes('bioontology')) {
+      return 'bioportal';
+    } else if (harvestedFrom.includes('nerc')) {
+      return 'nerc';
+    } else if (harvestedFrom.includes('eosc-pillar')) {
+      return 'eosc-pillar ontoportal';
+    } else {
+      return 'undefined';
+    }
+  }
 }
diff --git a/src/app/semantic-enrichment/ESModel.ts b/src/app/semantic-enrichment/ESModel.ts
index 114fa739a..6fb2385ee 100644
--- a/src/app/semantic-enrichment/ESModel.ts
+++ b/src/app/semantic-enrichment/ESModel.ts
@@ -39,4 +39,7 @@ export class Document {
   public resourceName: string;
   public resourceVersion: string;
   public domains: string[];
+  public resourcesReusing: string[];
+  public harvestedFrom: string;
+  public uiLink: string;
 }
diff --git a/src/app/semantic-enrichment/semantic-enrichment.component.html b/src/app/semantic-enrichment/semantic-enrichment.component.html
index e39aa7ea0..cf751dc42 100644
--- a/src/app/semantic-enrichment/semantic-enrichment.component.html
+++ b/src/app/semantic-enrichment/semantic-enrichment.component.html
@@ -113,6 +113,7 @@
                     <th class="text-center">definition</th>
                     <th class="text-center">synonyms</th>
                     <th class="text-center">score</th>
+                    <th class="text-center">harvested from</th>
                     </thead>
                     <tbody>
                     <tr *ngFor="let result of (objet.value).results ">
@@ -124,6 +125,8 @@
                       <td class="text-center">{{ result.source.document.description }}</td>
                       <td class="text-center">{{ result.source.document.synonyms }}</td>
                       <td class="text-center">{{ result.score | number: '2.2-2' }}</td>
+                      <td class="text-center"><a href="{{result.source.document.uiLink}}"
+                    target="_blank">{{getOriginPortalname(result.source.document.harvestedFrom)}}</a></td>
                     </tr>
                     </tbody>
                   </table>
diff --git a/src/app/semantic-enrichment/semantic-enrichment.component.ts b/src/app/semantic-enrichment/semantic-enrichment.component.ts
index 90029adc9..be5bd6aad 100644
--- a/src/app/semantic-enrichment/semantic-enrichment.component.ts
+++ b/src/app/semantic-enrichment/semantic-enrichment.component.ts
@@ -221,5 +221,18 @@ export class SemanticEnrichmentComponent implements OnInit {
     return Object.keys(dataMap);
   }
 
+  getOriginPortalname(harvestedFrom: string): string {
+    if (harvestedFrom.includes('agroportal')) {
+      return 'agroportal';
+    } else if (harvestedFrom.includes('bioontology')) {
+      return 'bioportal';
+    } else if (harvestedFrom.includes('nerc')) {
+      return 'nerc';
+    } else if (harvestedFrom.includes('eosc-pillar')) {
+      return 'eosc-pillar ontoportal';
+    } else {
+      return 'undefined';
+    }
+  }
 }
 
-- 
GitLab