From 243a93943eb52a3dc96d3e516c9455dd264e088e Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Mon, 19 Jul 2021 11:12:26 +0200
Subject: [PATCH 1/7] mapping: upgrade features

---
 .../datasets/services/dataset-crud.service.ts | 11 +---
 src/app/mapping/mapping.component.html        | 15 ++++--
 src/app/mapping/mapping.component.ts          | 53 ++++++++++---------
 src/app/publishapi/publishapi.component.html  |  4 +-
 4 files changed, 44 insertions(+), 39 deletions(-)

diff --git a/src/app/datasets/services/dataset-crud.service.ts b/src/app/datasets/services/dataset-crud.service.ts
index f894912d4..5334b4c92 100644
--- a/src/app/datasets/services/dataset-crud.service.ts
+++ b/src/app/datasets/services/dataset-crud.service.ts
@@ -17,7 +17,7 @@ export class DatasetCrudService {
   itemsDataset: Object[] = [] ;
   constructor(private http: HttpClient,private appConfig: AppConfiguration, private parserService: ParseXmlService, private sessionStorage: TokenStorageService) { }
 
-  createDataSet(data:string){
+  createDataSet(data:string): Observable<Object> {
       if (this.fds2Token) {
         const httpOptions = {
           headers: new HttpHeaders({
@@ -27,14 +27,7 @@ export class DatasetCrudService {
           })
         };
         
-        this.http.post(FDP_URL +"/dataset", data, httpOptions ).subscribe( r => {
-            console.log("resultat: " + JSON.stringify(r));
-        },
-        error => console.error("The repository has not been published: " + error) ,
-        () => console.log("The datasets has benn published")
-        
-        ) ;
-       
+        return this.http.post(FDP_URL +"/dataset", data, httpOptions );
       }
     
     
diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html
index cd2e7483b..e1becf1b9 100644
--- a/src/app/mapping/mapping.component.html
+++ b/src/app/mapping/mapping.component.html
@@ -12,7 +12,8 @@
                             <div class="col-4">
 
                                 <nb-form-field>
-                                    <input nbInput fullWidth type="text" value="{{dataset.identifier}}" disabled />
+                                    <input *ngIf=" dataset.identifier !== 'dct:hasVersion'" nbInput fullWidth type="text" value="{{dataset.identifier}} " disabled />
+                                    <input *ngIf=" dataset.identifier === 'dct:hasVersion' " nbInput fullWidth type="text" value="{{dataset.identifier}} *" disabled  />
                                     <button nbSuffix nbTooltip="{{dataset.name}}: {{dataset.usageNote}}"
                                         nbTooltipStatus="info" nbButton status="basic" ghost>
                                         <nb-icon [icon]=" 'question-mark-circle-outline' " pack="eva">
@@ -24,9 +25,14 @@
                             <div class="col-8">
 
                                 <nb-form-field>
-                                    <input #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                    <input  *ngIf=" dataset.identifier === 'dct:hasVersion' " required #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
                                         nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
-                                        [(ngModel)]="selectedPaths[index]" (focus)="reset()" />
+                                        [(ngModel)]="selectedPaths[index]" (focus)="reset()"  autocomplete="false"/>
+                                        
+                                        <input  *ngIf=" dataset.identifier !== 'dct:hasVersion' "  #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                        nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
+                                        [(ngModel)]="selectedPaths[index]" (focus)="reset()" autocomplete="false"/>
+                                        
 
                                     <nb-autocomplete #auto>
 
@@ -70,7 +76,7 @@
 
                 </nb-list>
                 <div class="row">
-                    <button class="button-center" nbButton status="danger" (click)="mappedMetadatas.splice(index, 1); prev()">Delete datset<nb-icon icon="trash-2-outline">
+                    <button class="button-center" nbButton status="danger" *ngIf=" !first " (click)="mappedMetadatas.splice(index, 1); prev()">Delete datset<nb-icon icon="trash-2-outline">
                         </nb-icon></button>
                 </div>
             </nb-card-body>
@@ -87,6 +93,7 @@
                         <button nbButton (click)=" publishDataset()">Publish</button>
                     </div>
                 </div>
+                
             </nb-card-footer>
         </nb-card>
     </div>
diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index eecf8e06c..e49b91e25 100644
--- a/src/app/mapping/mapping.component.ts
+++ b/src/app/mapping/mapping.component.ts
@@ -3,7 +3,6 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core';
 import { Observable, of } from 'rxjs';
 import { map } from 'rxjs/operators';
 import { environment } from 'src/environments/environment.prod';
-import { AppConfiguration } from '../AppConfiguration';
 import { DatasetCrudService } from '../datasets/services/dataset-crud.service';
 import { Dataset } from './class/dataset';
 
@@ -28,11 +27,12 @@ export class MappingComponent implements OnInit {
   index: number = 0
   first: boolean = true;
   loading: boolean = false;
-  FDP_URL  = environment.fdpUrl;
+  FDP_URL = environment.fdpUrl;
+
   @ViewChild('autoInput') input;
   @Input() catalogId: any;
 
-  constructor(private appConfig: AppConfiguration, private dataSetService: DatasetCrudService) { }
+  constructor(private dataSetService: DatasetCrudService) { }
 
 
   ngOnInit() {
@@ -56,7 +56,7 @@ export class MappingComponent implements OnInit {
   populatecatalogue() {
     this.itemsdataset = this.dataSetService.itemsDataset;
     this.keys = [];
-    for (let i = 0; i< this.itemsdataset.length; i++){
+    for (let i = 0; i < this.itemsdataset.length; i++) {
       if (i === 0) {
         this.getKeysFromMetadata(this.itemsdataset[i], '');
         this.keysMap.set(this.itemsdataset.length, this.keys);
@@ -78,21 +78,23 @@ export class MappingComponent implements OnInit {
 
   }
 
-  
 
-publishDataset() {
-  let data: string = '';
-  let properties: string = '';
 
-  this.mappedMetadatas.forEach((value: Map<string, string>, key: number) => {
-    properties = "";
-    value.forEach( (value: string, key: string) => {
-     
-      properties += key+ ' "' + value + '";\n';
-    })
-   
+  publishDataset() {
+    let data: string = '';
+    let properties: string = '';
+
+    this.mappedMetadatas.forEach((value: Map<string, string>, key: number) => {
+      this.ok = false;
+      this.err  = false;
+      properties = "";
+      value.forEach((value: string, key: string) => {
 
-    data = '\@prefix dcat: <http://www.w3.org/ns/dcat#>.\n\
+        properties += key + ' "' + value + '";\n';
+      })
+
+
+      data = '\@prefix dcat: <http://www.w3.org/ns/dcat#>.\n\
   @prefix dct: <http://purl.org/dc/terms/>.\n\
   @prefix language: <http://id.loc.gov/vocabulary/iso639-1/>.\n\
   @prefix s: <'+ this.FDP_URL + '/>.\n\
@@ -102,12 +104,15 @@ s:new\n\
 a dcat:Dataset, dcat:Resource;\n\
 dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
 
-  console.log('data: ' + data);
-  this.dataSetService.createDataSet(data);
-  })
-  
-}
- 
+      console.log('data: ' + data);
+      this.dataSetService.createDataSet(data).subscribe(
+        () => this.ok = true,
+        error => this.err = true
+      );
+    })
+
+  }
+
 
   private getValue(tab: string[], item: Object): string {
     let obj: Object
@@ -146,10 +151,10 @@ dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
     }
   }
   prev() {
-    if(this.index > 0){
+    if (this.index > 0) {
       this.index -= 1;
     }
-    
+
     this.createDataset(this.itemsdataset[this.index])
     console.log('index = ' + this.index);
   }
diff --git a/src/app/publishapi/publishapi.component.html b/src/app/publishapi/publishapi.component.html
index 1640975f8..29bd36ed7 100644
--- a/src/app/publishapi/publishapi.component.html
+++ b/src/app/publishapi/publishapi.component.html
@@ -292,7 +292,7 @@
         <h4>Use parameters & launch request</h4>
         <app-datasets [openApi]="openApi"></app-datasets>
         <button class="prev-button" nbButton nbStepperPrevious>prev</button>
-        <button class="next-button" nbButton nbStepperNext (click)="initLabelThree = true">next</button>
+        <button class="next-button" nbButton nbStepperNext (click)="initLabelThree=true">next</button>
       </nb-step>
       <nb-step [label]="labelThree" >
         <ng-template #labelThree>Third step</ng-template>
@@ -301,7 +301,7 @@
           Map your metadata schema with DCAT schema
         </p> 
           <app-mapping *ngIf="initLabelThree" [catalogId]="openApi.info['x-catalog-id']"></app-mapping>
-        <button class="prev-button" nbButton nbStepperPrevious (click)="initLabelThree = false">prev</button>
+        <button class="prev-button" nbButton nbStepperPrevious (click)="initLabelThree=false">prev</button>
         <button class="next-button" nbButton disabled nbStepperNext>next</button>
       </nb-step>
       <!--<nb-step [label]="labelFour">
-- 
GitLab


From 582217180307b613ae756670a066aa9820d34534 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 10:17:26 +0200
Subject: [PATCH 2/7] fix mapping

---
 .../datasets/services/dataset-crud.service.ts |  3 +++
 src/app/mapping/mapping.component.ts          |  5 +----
 src/app/publishapi/publishapi.component.html  |  2 +-
 src/app/publishapi/publishapi.component.ts    |  7 ++++++-
 src/assets/dataset.json                       | 20 +++++++++----------
 5 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/src/app/datasets/services/dataset-crud.service.ts b/src/app/datasets/services/dataset-crud.service.ts
index 5334b4c92..54921f9b7 100644
--- a/src/app/datasets/services/dataset-crud.service.ts
+++ b/src/app/datasets/services/dataset-crud.service.ts
@@ -80,6 +80,9 @@ export class DatasetCrudService {
   saveDatasets(obj: Object) {
     this.itemsDataset.push(obj);
   }
+  resetDataset() {
+    this.itemsDataset = [];
+  }
 
 
 }
diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index e49b91e25..2eef97206 100644
--- a/src/app/mapping/mapping.component.ts
+++ b/src/app/mapping/mapping.component.ts
@@ -85,8 +85,6 @@ export class MappingComponent implements OnInit {
     let properties: string = '';
 
     this.mappedMetadatas.forEach((value: Map<string, string>, key: number) => {
-      this.ok = false;
-      this.err  = false;
       properties = "";
       value.forEach((value: string, key: string) => {
 
@@ -106,8 +104,7 @@ dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
 
       console.log('data: ' + data);
       this.dataSetService.createDataSet(data).subscribe(
-        () => this.ok = true,
-        error => this.err = true
+        
       );
     })
 
diff --git a/src/app/publishapi/publishapi.component.html b/src/app/publishapi/publishapi.component.html
index 29bd36ed7..d0a200dc8 100644
--- a/src/app/publishapi/publishapi.component.html
+++ b/src/app/publishapi/publishapi.component.html
@@ -301,7 +301,7 @@
           Map your metadata schema with DCAT schema
         </p> 
           <app-mapping *ngIf="initLabelThree" [catalogId]="openApi.info['x-catalog-id']"></app-mapping>
-        <button class="prev-button" nbButton nbStepperPrevious (click)="initLabelThree=false">prev</button>
+        <button class="prev-button" nbButton nbStepperPrevious (click)="initLabelThree=false;  resetDataset()">prev</button>
         <button class="next-button" nbButton disabled nbStepperNext>next</button>
       </nb-step>
       <!--<nb-step [label]="labelFour">
diff --git a/src/app/publishapi/publishapi.component.ts b/src/app/publishapi/publishapi.component.ts
index 3a3cf8853..32c4fa4cd 100644
--- a/src/app/publishapi/publishapi.component.ts
+++ b/src/app/publishapi/publishapi.component.ts
@@ -1,6 +1,7 @@
 import { ViewChild } from '@angular/core';
 import { Component, OnInit } from '@angular/core';
 import { cloneDeep } from 'lodash';
+import { DatasetCrudService } from '../datasets/services/dataset-crud.service';
 import { CatalogService, FdpApiResponseItem } from '../services/catalog.service';
 import HttpStatusCode from './class/http-enum';
 import { OpenApi, Parameter, Path, Request, Response } from './class/openapi';
@@ -22,7 +23,8 @@ export class PublishApiComponent implements OnInit {
   constructor(
     private openApiService: OpenApiService,
     private catalogService: CatalogService,
-    private openApiDTOMappingService: OpenApiDTOMappingService
+    private openApiDTOMappingService: OpenApiDTOMappingService,
+    private datasetService: DatasetCrudService
   ) { }
 
   openApi: OpenApi;
@@ -255,4 +257,7 @@ export class PublishApiComponent implements OnInit {
     request.responses.unshift(newResponse);
   }
 
+  resetDataset() {
+
+  }
 }
diff --git a/src/assets/dataset.json b/src/assets/dataset.json
index abaaa625f..6e2a19289 100644
--- a/src/assets/dataset.json
+++ b/src/assets/dataset.json
@@ -1,14 +1,19 @@
 [
-  {
-    "name": "description",
-    "identifier": "dct:description",
-    "usageNote": "Mandatory property. This property contains a free-text account of the Dataset. This property can be repeated for parallel language versions of the description."
-  },
   {
     "name": "title",
     "identifier": "dct:title",
     "usageNote": "Mandatory property. This property contains a name given to the Dataset. This property can be repeated for parallel language versions of the name."
   },
+  {
+    "name": "has Version",
+    "identifier": "dct:hasVersion",
+    "usageNote": "Optional property.This property refers to a related Dataset that is a version, edition, or adaptation of the described Dataset."
+  },
+  {
+    "name": "description",
+    "identifier": "dct:description",
+    "usageNote": "Mandatory property. This property contains a free-text account of the Dataset. This property can be repeated for parallel language versions of the description."
+  },
   {
     "name": "contact point",
     "identifier": "dcat:contactPoint",
@@ -124,11 +129,6 @@
     "identifier": "dct:isVersionOf",
     "usageNote": "Optional property. This property refers to a related Dataset of which the described Dataset is a version, edition, or adaptation."
   },
-  {
-    "name": "has Version",
-    "identifier": "dct:hasVersion",
-    "usageNote": "Optional property.This property refers to a related Dataset that is a version, edition, or adaptation of the described Dataset."
-  },
   {
     "name": "documentation",
     "identifier": "foaf:page",
-- 
GitLab


From 3c8408e1b5a90435be75277cef840c2ab875baba Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 13:31:40 +0200
Subject: [PATCH 3/7] fix form

---
 .../datasets/services/dataset-crud.service.ts | 103 +++++++++++-------
 src/app/mapping/mapping.component.html        |  10 +-
 src/app/mapping/mapping.component.ts          |  54 ++++++---
 src/app/publishapi/publishapi.component.ts    |   2 +-
 4 files changed, 112 insertions(+), 57 deletions(-)

diff --git a/src/app/datasets/services/dataset-crud.service.ts b/src/app/datasets/services/dataset-crud.service.ts
index 54921f9b7..0199c6eb7 100644
--- a/src/app/datasets/services/dataset-crud.service.ts
+++ b/src/app/datasets/services/dataset-crud.service.ts
@@ -13,65 +13,92 @@ const FDP_URL = environment.fdpUrl;
 export class DatasetCrudService {
 
   fds2Token: string = this.sessionStorage.getFDPToken();
-  public results: string[] = [];  
-  itemsDataset: Object[] = [] ;
-  constructor(private http: HttpClient,private appConfig: AppConfiguration, private parserService: ParseXmlService, private sessionStorage: TokenStorageService) { }
-
-  createDataSet(data:string): Observable<Object> {
-      if (this.fds2Token) {
-        const httpOptions = {
-          headers: new HttpHeaders({
-            'Accept':  'text/turtle',
-            'Content-Type':  'text/turtle',
-            'Authorization': 'Bearer '+ this.fds2Token
-          })
-        };
-        
-        return this.http.post(FDP_URL +"/dataset", data, httpOptions );
-      }
-    
-    
+  public results: string[] = [];
+  itemsDataset: Object[] = [];
+  constructor(private http: HttpClient, private appConfig: AppConfiguration, private parserService: ParseXmlService, private sessionStorage: TokenStorageService) { }
+
+  
+  createDataset(data: string): Observable<any> {
+    if (this.fds2Token) {
+      const httpOptions = {
+        headers: new HttpHeaders({
+          'Accept': 'text/turtle',
+          'Content-Type': 'text/turtle',
+          'Authorization': 'Bearer ' + this.fds2Token
+        })
+      };
+
+      return this.http.post(FDP_URL + "/dataset", data, httpOptions);
+    }
+  }
+
+  draftDataset(url: string) {
+    if (this.fds2Token) {
+      const httpOptions = {
+        headers: new HttpHeaders({
+          'Content-Type': 'text/turtle',
+          'Authorization': 'Bearer ' + this.fds2Token
+        })
+      };
+
+      return this.http.put(`${url}/meta/state`, { "current": "PUBLISHED" }, httpOptions);
+    }
+  }
+
+  updateDataset(data: string, url: string): Observable<Object> {
+    if (this.fds2Token) {
+      const httpOptions = {
+        headers: new HttpHeaders({
+          'Content-Type': 'text/turtle',
+          'Authorization': 'Bearer ' + this.fds2Token
+        })
+      };
+
+      return this.http.put(url, data, httpOptions);
+    }
   }
 
-  createDistribution(data:string){
+  createDistribution(data: string) {
 
     if (this.fds2Token) {
       const httpOptions = {
         headers: new HttpHeaders({
-          'Accept':  'text/turtle',
-          'Content-Type':  'text/turtle',
-          'Authorization': 'Bearer '+ this.fds2Token
+          'Accept': 'text/turtle',
+          'Content-Type': 'text/turtle',
+          'Authorization': 'Bearer ' + this.fds2Token
         })
       };
-      
-      let resultat = this.http.post(FDP_URL +"/distribution", data, httpOptions ).subscribe((r)=>{
+
+      let resultat = this.http.post(FDP_URL + "/distribution", data, httpOptions).subscribe((r) => {
         console.log('reponse: ', r);
         return JSON.stringify(resultat);
-      }) ;
+      });
     }
   }
 
   getDatasetsFromApi(url: string, params: string): Observable<any[]> {
     const httpOptions = {
-      headers: new HttpHeaders({'Content-Type':  'Application/json'})};
+      headers: new HttpHeaders({ 'Content-Type': 'Application/json' })
+    };
     return this.http.get<any[]>(`${url}/${params}`, httpOptions);
   }
 
-  findDataSetByTitle(title:string){
+  findDataSetByTitle(title: string) {
 
     let exist = false;
-    let query1='query=PREFIX dcterms: <http://purl.org/dc/terms/>  SELECT * WHERE { ?uri dcterms:title "'+ escape(title) +'". }'
+    let query1 = 'query=PREFIX dcterms: <http://purl.org/dc/terms/>  SELECT * WHERE { ?uri dcterms:title "' + escape(title) + '". }'
     this.parserService.getXmlResult(query1).subscribe(
-      data=>{
-      if (data){
-        this.results = []; 
-        data.results.bindings.forEach(element => { this.results.push(element);});
-         if (this.results[0]) {
-          
-          let exist = true;
-         }
-        }});
-      return exist
+      data => {
+        if (data) {
+          this.results = [];
+          data.results.bindings.forEach(element => { this.results.push(element); });
+          if (this.results[0]) {
+
+            let exist = true;
+          }
+        }
+      });
+    return exist
   }
 
   getLocally<T = any>(path: string): Observable<T> {
diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html
index e1becf1b9..b6983e1cf 100644
--- a/src/app/mapping/mapping.component.html
+++ b/src/app/mapping/mapping.component.html
@@ -12,8 +12,8 @@
                             <div class="col-4">
 
                                 <nb-form-field>
-                                    <input *ngIf=" dataset.identifier !== 'dct:hasVersion'" nbInput fullWidth type="text" value="{{dataset.identifier}} " disabled />
-                                    <input *ngIf=" dataset.identifier === 'dct:hasVersion' " nbInput fullWidth type="text" value="{{dataset.identifier}} *" disabled  />
+                                    <input *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'" nbInput fullWidth type="text" value="{{dataset.identifier}} " disabled />
+                                    <input *ngIf=" dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' " nbInput fullWidth type="text" value="{{dataset.identifier}} *" disabled  />
                                     <button nbSuffix nbTooltip="{{dataset.name}}: {{dataset.usageNote}}"
                                         nbTooltipStatus="info" nbButton status="basic" ghost>
                                         <nb-icon [icon]=" 'question-mark-circle-outline' " pack="eva">
@@ -25,11 +25,11 @@
                             <div class="col-8">
 
                                 <nb-form-field>
-                                    <input  *ngIf=" dataset.identifier === 'dct:hasVersion' " required #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                    <input  *ngIf="dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' " required #autoInput #{{dataset.identifier}}="ngModel" fullWidth id="{{dataset.identifier}}" name="{{dataset.identifier}}"
                                         nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
                                         [(ngModel)]="selectedPaths[index]" (focus)="reset()"  autocomplete="false"/>
-                                        
-                                        <input  *ngIf=" dataset.identifier !== 'dct:hasVersion' "  #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                        <div *ngIf="dataset.identifier.invalid && (dataset.identifier.dirty || dataset.identifier.touched)">champ obligatoire</div>
+                                        <input  *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"  #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
                                         nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
                                         [(ngModel)]="selectedPaths[index]" (focus)="reset()" autocomplete="false"/>
                                         
diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index 2eef97206..03bf25979 100644
--- a/src/app/mapping/mapping.component.ts
+++ b/src/app/mapping/mapping.component.ts
@@ -4,6 +4,7 @@ import { Observable, of } from 'rxjs';
 import { map } from 'rxjs/operators';
 import { environment } from 'src/environments/environment.prod';
 import { DatasetCrudService } from '../datasets/services/dataset-crud.service';
+import { ParseXmlService } from '../services/parse-xml.service';
 import { Dataset } from './class/dataset';
 
 
@@ -32,7 +33,7 @@ export class MappingComponent implements OnInit {
   @ViewChild('autoInput') input;
   @Input() catalogId: any;
 
-  constructor(private dataSetService: DatasetCrudService) { }
+  constructor(private dataSetService: DatasetCrudService, private parserService: ParseXmlService) { }
 
 
   ngOnInit() {
@@ -83,29 +84,56 @@ export class MappingComponent implements OnInit {
   publishDataset() {
     let data: string = '';
     let properties: string = '';
+    let result = '';
 
     this.mappedMetadatas.forEach((value: Map<string, string>, key: number) => {
+      let title = "";
       properties = "";
+      
       value.forEach((value: string, key: string) => {
+        if (key === 'dct:title') { title = value };
+        switch (key) {
+          case 'dct:landingPage':
+            properties += key + ' <' + value + '>;\n';
+            break;
+          case 'dcat:theme':
+            properties += key + ' <' + value + '>;\n';
+            break;
+          case 'dcat:contactPoint':
+            properties += key + ' <' + value + '>;\n';
+            break;
+          default:
+            properties += key + ' "' + value + '";\n';
+            break;
+        }
 
-        properties += key + ' "' + value + '";\n';
       })
+      
 
 
       data = '\@prefix dcat: <http://www.w3.org/ns/dcat#>.\n\
-  @prefix dct: <http://purl.org/dc/terms/>.\n\
-  @prefix language: <http://id.loc.gov/vocabulary/iso639-1/>.\n\
-  @prefix s: <'+ this.FDP_URL + '/>.\n\
-  @prefix c: <'+ this.FDP_URL + '/catalog/>.\n\
-  \n\
-s:new\n\
-a dcat:Dataset, dcat:Resource;\n\
-dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
+               @prefix dct: <http://purl.org/dc/terms/>.\n\
+               @prefix language: <http://id.loc.gov/vocabulary/iso639-1/>.\n\
+               @prefix s: <'+ this.FDP_URL + '/>.\n\
+               @prefix c: <'+ this.FDP_URL + '/catalog/>.\n\
+               \n\
+               s:new\n\
+               a dcat:Dataset, dcat:Resource;\n\
+               dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
+      
+      let query = 'query=PREFIX dcat: <http://www.w3.org/ns/dcat#>\n\
+               PREFIX dct: <http://purl.org/dc/terms/>\n\
+               SELECT ?dataset\n\
+               where {\n\
+                      ?dataset a dcat:Dataset;\n\
+                      dct:title "' + title + '" ;\n\
+                      dct:isPartOf <https://f2ds.eosc-pillar.eu/catalog/' + this.catalogId + '>. } '
 
       console.log('data: ' + data);
-      this.dataSetService.createDataSet(data).subscribe(
-        
-      );
+     
+    
+          this.dataSetService.createDataset(data).subscribe(r => console.log(r));
+     
     })
 
   }
diff --git a/src/app/publishapi/publishapi.component.ts b/src/app/publishapi/publishapi.component.ts
index 32c4fa4cd..d8f7340b7 100644
--- a/src/app/publishapi/publishapi.component.ts
+++ b/src/app/publishapi/publishapi.component.ts
@@ -258,6 +258,6 @@ export class PublishApiComponent implements OnInit {
   }
 
   resetDataset() {
-
+    this.datasetService.resetDataset();
   }
 }
-- 
GitLab


From d38fb7d3a793933bbdf98b4f0872c058923c3f9c Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 14:52:18 +0200
Subject: [PATCH 4/7] validation

---
 src/app/mapping/mapping.component.html       | 114 +++++++++++--------
 src/app/publishapi/publishapi.component.html |   4 +-
 src/app/publishapi/publishapi.component.ts   |   8 ++
 3 files changed, 75 insertions(+), 51 deletions(-)

diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html
index b6983e1cf..7f3ae0967 100644
--- a/src/app/mapping/mapping.component.html
+++ b/src/app/mapping/mapping.component.html
@@ -1,60 +1,75 @@
-<div class="card-row">
-    <div class="card-col">
-        <nb-card size="giant" [nbSpinner]="loading" nbSpinnerStatus="primary" nbSpinnerSize="large"
-            nbSpinnerMessage="Loading...">
-            <nb-card-header>Dataset metadata</nb-card-header>
-            <nb-card-body>
-                <div></div>
-                <ng-container *ngFor="let dataset of datasetModel; let index = index;trackBy:trackByIndex;">
-                    <nb-form-field>
-                        <div class="row">
+<form #form="ngForm">
+    <div class="card-row">
+        <div class="card-col">
+            <nb-card size="giant" [nbSpinner]="loading" nbSpinnerStatus="primary" nbSpinnerSize="large"
+                nbSpinnerMessage="Loading...">
+                <nb-card-header>Dataset metadata</nb-card-header>
+                <nb-card-body>
 
-                            <div class="col-4">
+                    <ng-container *ngFor="let dataset of datasetModel; let index = index;trackBy:trackByIndex;">
+                        <nb-form-field>
+                            <div class="row">
 
-                                <nb-form-field>
-                                    <input *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'" nbInput fullWidth type="text" value="{{dataset.identifier}} " disabled />
-                                    <input *ngIf=" dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' " nbInput fullWidth type="text" value="{{dataset.identifier}} *" disabled  />
-                                    <button nbSuffix nbTooltip="{{dataset.name}}: {{dataset.usageNote}}"
-                                        nbTooltipStatus="info" nbButton status="basic" ghost>
-                                        <nb-icon [icon]=" 'question-mark-circle-outline' " pack="eva">
-                                        </nb-icon>
-                                    </button>
-                                </nb-form-field>
+                                <div class="col-4">
 
-                            </div>
-                            <div class="col-8">
+                                    <nb-form-field>
+                                        <input
+                                            *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"
+                                            nbInput fullWidth type="text" value="{{dataset.identifier}} " disabled />
+                                        <input
+                                            *ngIf=" dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' "
+                                            nbInput fullWidth type="text" value="{{dataset.identifier}} *" disabled />
+                                        <button nbSuffix nbTooltip="{{dataset.name}}: {{dataset.usageNote}}"
+                                            nbTooltipStatus="info" nbButton status="basic" ghost>
+                                            <nb-icon [icon]=" 'question-mark-circle-outline' " pack="eva">
+                                            </nb-icon>
+                                        </button>
+                                    </nb-form-field>
+
+                                </div>
+                                <div class="col-8">
 
-                                <nb-form-field>
-                                    <input  *ngIf="dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' " required #autoInput #{{dataset.identifier}}="ngModel" fullWidth id="{{dataset.identifier}}" name="{{dataset.identifier}}"
-                                        nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
-                                        [(ngModel)]="selectedPaths[index]" (focus)="reset()"  autocomplete="false"/>
-                                        <div *ngIf="dataset.identifier.invalid && (dataset.identifier.dirty || dataset.identifier.touched)">champ obligatoire</div>
-                                        <input  *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"  #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
-                                        nbInput (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
-                                        [(ngModel)]="selectedPaths[index]" (focus)="reset()" autocomplete="false"/>
-                                        
+                                    <nb-form-field>
+                                        <input
+                                            *ngIf="dataset.identifier === 'dct:hasVersion' || dataset.identifier === 'dct:title' "
+                                            required #autoInput #{{dataset.identifier}}="ngModel" fullWidth
+                                            id="{{dataset.identifier}}" name="{{dataset.identifier}}" nbInput
+                                            (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
+                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()" autocomplete="false" />
+                                        <div
+                                            *ngIf="dataset.identifier.invalid && (dataset.identifier.dirty || dataset.identifier.touched)">
+                                            champ obligatoire</div>
+                                        <input
+                                            *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"
+                                            #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                            nbInput (input)="onChange()" placeholder="Enter value"
+                                            [nbAutocomplete]="auto" [(ngModel)]="selectedPaths[index]" (focus)="reset()"
+                                            autocomplete="false" />
 
-                                    <nb-autocomplete #auto>
 
-                                        <nb-option *ngFor="let option of filteredOptions | async" [value]="option">
-                                            {{ option }}
-                                        </nb-option>
+                                        <nb-autocomplete #auto>
 
-                                    </nb-autocomplete>
-                                </nb-form-field>
+                                            <nb-option *ngFor="let option of filteredOptions | async" [value]="option">
+                                                {{ option }}
+                                            </nb-option>
+
+                                        </nb-autocomplete>
+                                    </nb-form-field>
+                                </div>
                             </div>
-                        </div>
-                    </nb-form-field>
-                </ng-container>
-            </nb-card-body>
-        </nb-card>
+                        </nb-form-field>
+                    </ng-container>
+
+                </nb-card-body>
+            </nb-card>
+        </div>
     </div>
-</div>
-<div class="row">
-    <div>
-        <button nbButton (click)="mapDataset()">Check mapping</button>
+    <div class="row">
+        <div>
+            <button nbButton (click)="mapDataset()" [disabled]="!form.valid">Check mapping</button>
+        </div>
     </div>
-</div>
+</form>
 <div class="card-row">
     <div class="card-col">
         <nb-card>
@@ -76,7 +91,8 @@
 
                 </nb-list>
                 <div class="row">
-                    <button class="button-center" nbButton status="danger" *ngIf=" !first " (click)="mappedMetadatas.splice(index, 1); prev()">Delete datset<nb-icon icon="trash-2-outline">
+                    <button class="button-center" nbButton status="danger" *ngIf=" !first "
+                        (click)="mappedMetadatas.splice(index, 1); prev()">Delete datset<nb-icon icon="trash-2-outline">
                         </nb-icon></button>
                 </div>
             </nb-card-body>
@@ -93,7 +109,7 @@
                         <button nbButton (click)=" publishDataset()">Publish</button>
                     </div>
                 </div>
-                
+
             </nb-card-footer>
         </nb-card>
     </div>
diff --git a/src/app/publishapi/publishapi.component.html b/src/app/publishapi/publishapi.component.html
index d0a200dc8..fcb8a893b 100644
--- a/src/app/publishapi/publishapi.component.html
+++ b/src/app/publishapi/publishapi.component.html
@@ -292,7 +292,7 @@
         <h4>Use parameters & launch request</h4>
         <app-datasets [openApi]="openApi"></app-datasets>
         <button class="prev-button" nbButton nbStepperPrevious>prev</button>
-        <button class="next-button" nbButton nbStepperNext (click)="initLabelThree=true">next</button>
+        <button class="next-button" nbButton nbStepperNext [disabled]="!isValid()" (click)="initLabelThree=true">next</button>
       </nb-step>
       <nb-step [label]="labelThree" >
         <ng-template #labelThree>Third step</ng-template>
@@ -301,7 +301,7 @@
           Map your metadata schema with DCAT schema
         </p> 
           <app-mapping *ngIf="initLabelThree" [catalogId]="openApi.info['x-catalog-id']"></app-mapping>
-        <button class="prev-button" nbButton nbStepperPrevious (click)="initLabelThree=false;  resetDataset()">prev</button>
+        <button class="prev-button" nbButton nbStepperPrevious  (click)="initLabelThree=false;  resetDataset()">prev</button>
         <button class="next-button" nbButton disabled nbStepperNext>next</button>
       </nb-step>
       <!--<nb-step [label]="labelFour">
diff --git a/src/app/publishapi/publishapi.component.ts b/src/app/publishapi/publishapi.component.ts
index d8f7340b7..60ce360f9 100644
--- a/src/app/publishapi/publishapi.component.ts
+++ b/src/app/publishapi/publishapi.component.ts
@@ -260,4 +260,12 @@ export class PublishApiComponent implements OnInit {
   resetDataset() {
     this.datasetService.resetDataset();
   }
+
+  isValid(): boolean {
+    if(this.datasetService.itemsDataset.length > 0) {
+      return true;
+    } else {
+      return false;
+    }
+  }
 }
-- 
GitLab


From 5af1278be0b664cf205d021cb67c0efe944e8e71 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 16:09:05 +0200
Subject: [PATCH 5/7] fix form

---
 src/app/mapping/mapping.component.html | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html
index 7f3ae0967..f0ea33899 100644
--- a/src/app/mapping/mapping.component.html
+++ b/src/app/mapping/mapping.component.html
@@ -35,16 +35,16 @@
                                             required #autoInput #{{dataset.identifier}}="ngModel" fullWidth
                                             id="{{dataset.identifier}}" name="{{dataset.identifier}}" nbInput
                                             (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
-                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()" autocomplete="false" />
+                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()"  />
                                         <div
                                             *ngIf="dataset.identifier.invalid && (dataset.identifier.dirty || dataset.identifier.touched)">
                                             champ obligatoire</div>
                                         <input
                                             *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"
-                                            #autoInput #{{dataset.identifier}} fullWidth id="{{dataset.identifier}}"
+                                            #autoInput #{{dataset.identifier}}="ngModel" fullWidth id="{{dataset.identifier}}"  name="{{dataset.identifier}}"
                                             nbInput (input)="onChange()" placeholder="Enter value"
                                             [nbAutocomplete]="auto" [(ngModel)]="selectedPaths[index]" (focus)="reset()"
-                                            autocomplete="false" />
+                                             />
 
 
                                         <nb-autocomplete #auto>
-- 
GitLab


From 07f7a2483391635c9a00f875bf9c91410c0f08b0 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Tue, 20 Jul 2021 17:07:40 +0200
Subject: [PATCH 6/7] change sparql queries

---
 src/app/search/search.component.ts |  2 ++
 src/app/stats/stats.component.ts   | 13 +++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts
index a62bddb9c..41639e47d 100644
--- a/src/app/search/search.component.ts
+++ b/src/app/search/search.component.ts
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
 import { HttpClient, HttpHeaders } from '@angular/common/http';
 import { ParseXmlService } from '../services/parse-xml.service';
 import { FormBuilder, FormControl, FormGroup } from '@angular/forms';
+import { environment } from 'src/environments/environment.prod';
 
 
 export interface formData{
@@ -49,6 +50,7 @@ export class SearchComponent implements OnInit {
               where {\n\?dataset a dcat:Dataset ;\n\
                         dcterms:title ?title ;\n\
                         dcterms:description ?description; \n\
+                        dcterms:isPartOf* <'+ environment.fdpUrl +'>;\n\
                         dcat:keyword ?uri ; \n\
                         FILTER (contains( ?description, "' + 
                         term +'") || contains( ?title, "'+ term +'"))\n\.\n\
diff --git a/src/app/stats/stats.component.ts b/src/app/stats/stats.component.ts
index fdd8603f5..698c4e2d2 100644
--- a/src/app/stats/stats.component.ts
+++ b/src/app/stats/stats.component.ts
@@ -1,6 +1,7 @@
 import { Component, OnInit } from '@angular/core';
 import { HttpClient, HttpHeaders } from '@angular/common/http';
 import { ParseXmlService } from '../services/parse-xml.service';
+import { environment } from 'src/environments/environment';
 
 
 @Component({
@@ -17,11 +18,19 @@ export class StatsComponent implements OnInit {
 
   ngOnInit(): void {
 
-      let query1='query=SELECT (COUNT(?s) AS ?triples) WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog> }'
+      let query1='query=prefix dct: <http://purl.org/dc/terms/>\n\
+      SELECT (COUNT(?s) AS ?triples) \n\
+      WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog>;\n\
+              dct:isPartOf <https://f2ds.eosc-pillar.eu>\n\
+            }'
       this.parserService.getXmlResult(query1).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
       this.stats.push(this.results[0]["triples"].value)
 
-      let query2='query=SELECT (COUNT(?s) AS ?triples) WHERE { ?s a <http://www.w3.org/ns/dcat#Dataset> }'
+      let query2='query=prefix dct: <http://purl.org/dc/terms/>\n\
+      SELECT (COUNT(?s) AS ?triples) \n\
+      WHERE { ?s a <http://www.w3.org/ns/dcat#Dataset>;\n\
+              dct:isPartOf <'+ environment.fdpUrl +'>\n\
+            }'
       this.parserService.getXmlResult(query2).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
       this.stats.push(this.results[0]["triples"].value); }})
 
-- 
GitLab


From 0a881b37da44ae11e57a4b5d39441f01a1dbc860 Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Wed, 21 Jul 2021 09:27:00 +0200
Subject: [PATCH 7/7] mapping: fix template

---
 src/app/mapping/mapping.component.html | 26 +++++++++--------
 src/app/mapping/mapping.component.ts   | 39 +++++++++++---------------
 src/app/stats/stats.component.ts       |  4 +--
 3 files changed, 33 insertions(+), 36 deletions(-)

diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html
index f0ea33899..b9235c6fc 100644
--- a/src/app/mapping/mapping.component.html
+++ b/src/app/mapping/mapping.component.html
@@ -35,16 +35,16 @@
                                             required #autoInput #{{dataset.identifier}}="ngModel" fullWidth
                                             id="{{dataset.identifier}}" name="{{dataset.identifier}}" nbInput
                                             (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
-                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()"  />
+                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()" />
                                         <div
                                             *ngIf="dataset.identifier.invalid && (dataset.identifier.dirty || dataset.identifier.touched)">
                                             champ obligatoire</div>
                                         <input
                                             *ngIf=" dataset.identifier !== 'dct:hasVersion' && dataset.identifier !== 'dct:title'"
-                                            #autoInput #{{dataset.identifier}}="ngModel" fullWidth id="{{dataset.identifier}}"  name="{{dataset.identifier}}"
-                                            nbInput (input)="onChange()" placeholder="Enter value"
-                                            [nbAutocomplete]="auto" [(ngModel)]="selectedPaths[index]" (focus)="reset()"
-                                             />
+                                            #autoInput #{{dataset.identifier}}="ngModel" fullWidth
+                                            id="{{dataset.identifier}}" name="{{dataset.identifier}}" nbInput
+                                            (input)="onChange()" placeholder="Enter value" [nbAutocomplete]="auto"
+                                            [(ngModel)]="selectedPaths[index]" (focus)="reset()" />
 
 
                                         <nb-autocomplete #auto>
@@ -65,14 +65,13 @@
         </div>
     </div>
     <div class="row">
-        <div>
-            <button nbButton (click)="mapDataset()" [disabled]="!form.valid">Check mapping</button>
-        </div>
+        <button class="button-center" nbButton status="primary" (click)="mapDataset()" [disabled]="!form.valid">Check
+            mapping</button>
     </div>
 </form>
 <div class="card-row">
     <div class="card-col">
-        <nb-card>
+        <nb-card [nbSpinner]="loading" nbSpinnerStatus="primary" nbSpinnerSize="large" nbSpinnerMessage="loading">
             <nb-card-header>Map</nb-card-header>
             <nb-card-body>
                 <nb-list>
@@ -105,10 +104,15 @@
                     <div *ngIf="!first ">
                         <button nbButton (click)=" next()" [disabled]="index == mappedMetadatas.length -1">next</button>
                     </div>
-                    <div *ngIf="!first ">
-                        <button nbButton (click)=" publishDataset()">Publish</button>
+
+                </div>
+                <div class="row">
+                    <div class="button-center" *ngIf="!first ">
+                        <button nbButton status="primary" (click)=" publishDataset()">Publish</button>
                     </div>
                 </div>
+                <nb-alert status="success" *ngIf="messageOk" closable style="margin-top: 10px;">{{ messageOk }}
+                </nb-alert>
 
             </nb-card-footer>
         </nb-card>
diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts
index 03bf25979..9c09a0918 100644
--- a/src/app/mapping/mapping.component.ts
+++ b/src/app/mapping/mapping.component.ts
@@ -15,7 +15,6 @@ import { Dataset } from './class/dataset';
 })
 export class MappingComponent implements OnInit {
 
-
   itemsdataset: Object[] = []
   datasetModel: Dataset[];
   filteredOptions: Observable<string[]>;
@@ -29,13 +28,13 @@ export class MappingComponent implements OnInit {
   first: boolean = true;
   loading: boolean = false;
   FDP_URL = environment.fdpUrl;
+  messageOk: string;
 
   @ViewChild('autoInput') input;
   @Input() catalogId: any;
 
   constructor(private dataSetService: DatasetCrudService, private parserService: ParseXmlService) { }
 
-
   ngOnInit() {
     this.dataSetService.getLocally('./assets/dataset.json').subscribe(
       dataset => {
@@ -46,7 +45,6 @@ export class MappingComponent implements OnInit {
         console.error(error);
       },
     );
-
     this.obsMappedMetadatas = of(this.mappedMetadatas)
     this.populatecatalogue();
   }
@@ -74,23 +72,19 @@ export class MappingComponent implements OnInit {
         mappedMetadata.set(this.datasetModel[i].identifier, this.getValue(tab, item));
       }
     }
-
     return mappedMetadata;
-
   }
 
-
-
   publishDataset() {
     let data: string = '';
     let properties: string = '';
     let result = '';
 
-    this.mappedMetadatas.forEach((value: Map<string, string>, key: number) => {
+    for (let i = 0; i < this.mappedMetadatas.length; i++) {
       let title = "";
       properties = "";
-      
-      value.forEach((value: string, key: string) => {
+      this.messageOk = "";
+      this.mappedMetadatas[i].forEach((value: string, key: string) => {
         if (key === 'dct:title') { title = value };
         switch (key) {
           case 'dct:landingPage':
@@ -106,10 +100,7 @@ export class MappingComponent implements OnInit {
             properties += key + ' "' + value + '";\n';
             break;
         }
-
       })
-      
-
 
       data = '\@prefix dcat: <http://www.w3.org/ns/dcat#>.\n\
                @prefix dct: <http://purl.org/dc/terms/>.\n\
@@ -120,7 +111,7 @@ export class MappingComponent implements OnInit {
                s:new\n\
                a dcat:Dataset, dcat:Resource;\n\
                dct:isPartOf c:'+ this.catalogId + ';\n' + properties + '.';
-      
+
       let query = 'query=PREFIX dcat: <http://www.w3.org/ns/dcat#>\n\
                PREFIX dct: <http://purl.org/dc/terms/>\n\
                SELECT ?dataset\n\
@@ -130,12 +121,18 @@ export class MappingComponent implements OnInit {
                       dct:isPartOf <https://f2ds.eosc-pillar.eu/catalog/' + this.catalogId + '>. } '
 
       console.log('data: ' + data);
-     
-    
-          this.dataSetService.createDataset(data).subscribe(r => console.log(r));
-     
-    })
 
+      this.dataSetService.createDataset(data).subscribe(
+        r => {
+          console.log(r);
+          this.loading = true;
+        },
+        () => {
+            this.messageOk = "Dataset published successfully"
+            this.loading = false;
+        }
+      )
+    }
   }
 
 
@@ -155,7 +152,6 @@ export class MappingComponent implements OnInit {
           } else {
             return 'undefined';
           }
-
         }
       }
     }
@@ -179,7 +175,6 @@ export class MappingComponent implements OnInit {
     if (this.index > 0) {
       this.index -= 1;
     }
-
     this.createDataset(this.itemsdataset[this.index])
     console.log('index = ' + this.index);
   }
@@ -217,7 +212,6 @@ export class MappingComponent implements OnInit {
         }
       }
     });
-
   }
 
   trackByIndex(index: number, obj: any): any {
@@ -245,7 +239,6 @@ export class MappingComponent implements OnInit {
   reset() {
     this.filteredOptions = of(this.keys);
   }
-
 }
 
 
diff --git a/src/app/stats/stats.component.ts b/src/app/stats/stats.component.ts
index 698c4e2d2..d1b5743d2 100644
--- a/src/app/stats/stats.component.ts
+++ b/src/app/stats/stats.component.ts
@@ -21,7 +21,7 @@ export class StatsComponent implements OnInit {
       let query1='query=prefix dct: <http://purl.org/dc/terms/>\n\
       SELECT (COUNT(?s) AS ?triples) \n\
       WHERE { ?s a <http://www.w3.org/ns/dcat#Catalog>;\n\
-              dct:isPartOf <https://f2ds.eosc-pillar.eu>\n\
+              dct:isPartOf <'+ environment.fdpUrl +'>\n\
             }'
       this.parserService.getXmlResult(query1).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
       this.stats.push(this.results[0]["triples"].value)
@@ -29,7 +29,7 @@ export class StatsComponent implements OnInit {
       let query2='query=prefix dct: <http://purl.org/dc/terms/>\n\
       SELECT (COUNT(?s) AS ?triples) \n\
       WHERE { ?s a <http://www.w3.org/ns/dcat#Dataset>;\n\
-              dct:isPartOf <'+ environment.fdpUrl +'>\n\
+              dct:isPartOf* <'+ environment.fdpUrl +'>\n\
             }'
       this.parserService.getXmlResult(query2).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);});
       this.stats.push(this.results[0]["triples"].value); }})
-- 
GitLab