From a8b361815ea2d533cb9fec194ef9d756d9ba0ed1 Mon Sep 17 00:00:00 2001 From: Baptiste Toulemonde <toulemonde@cines.fr> Date: Wed, 16 Feb 2022 17:07:33 +0100 Subject: [PATCH] fix sort dcat properties and request to post to smartharvester --- src/app/mapping/class/requestMapping.ts | 4 +- src/app/mapping/mapping.component.html | 6 +- src/app/mapping/mapping.component.ts | 4 +- src/app/mapping/service/mapping.service.ts | 4 +- src/assets/geodcat.json | 274 ++++++++++----------- 5 files changed, 146 insertions(+), 146 deletions(-) diff --git a/src/app/mapping/class/requestMapping.ts b/src/app/mapping/class/requestMapping.ts index 327667622..1ee7bfc81 100644 --- a/src/app/mapping/class/requestMapping.ts +++ b/src/app/mapping/class/requestMapping.ts @@ -2,13 +2,11 @@ export class RequestMapping { urls: string[]; paths: Path[]; fdpToken: string; - isJsonPath: boolean; - constructor (urls: string[], paths: Path[], fdpToken: string, isJsonPath: boolean) { + constructor (urls: string[], paths: Path[], fdpToken: string) { this.urls = urls; this.paths = paths; this.fdpToken = fdpToken; - this.isJsonPath = isJsonPath; } } diff --git a/src/app/mapping/mapping.component.html b/src/app/mapping/mapping.component.html index 363c9e172..dfc5f8d47 100644 --- a/src/app/mapping/mapping.component.html +++ b/src/app/mapping/mapping.component.html @@ -16,18 +16,20 @@ <p>Upload Or fill out the form with the path corresponding to the dcat property and save a new file for next mappings:</p> + <button class="button-center" nbButton status="primary" (click)="openFileInputDialog()"> <nb-icon icon="upload-outline"></nb-icon>Import file </button> <input type="file" id="file" (change)="importJson($event)" accept=".json, .tsv" /> </div> + <div class="row"> + <nb-checkbox (checkedChange)="toggleJsonPath($event)">Use jsonpath to describe the mapping</nb-checkbox> + </div> <div class="card-row"> <div class="card-col"> <nb-card size="giant"> <nb-card-header>Dataset</nb-card-header> <nb-card-body> - <nb-checkbox (checkedChange)="toggleJsonPath($event)">Use jsonpath to describe the mapping</nb-checkbox> - <ng-container *ngFor="let dataset of datasets ; let index = index; trackBy: trackByIndex"> <nb-form-field> <div class="row"> diff --git a/src/app/mapping/mapping.component.ts b/src/app/mapping/mapping.component.ts index 27050e9c5..d856f73d6 100644 --- a/src/app/mapping/mapping.component.ts +++ b/src/app/mapping/mapping.component.ts @@ -151,14 +151,14 @@ export class MappingComponent implements OnInit { } - let data: RequestMapping = new RequestMapping(this.urls, paths, this.tokenStorage.getFDPToken(), this.isJsonPath); + let data: RequestMapping = new RequestMapping(this.urls, paths, this.tokenStorage.getFDPToken()); let postedDatasets = []; let notPostedDatasets = []; this.loading = true; const requestPromises: Promise<any>[] = []; - let requestPromise = this.mappingService.postToFdpFropSmartharvester(this.catalogId, data).then( resp => { + let requestPromise = this.mappingService.postToFdpFropSmartharvester(this.catalogId, data, this.isJsonPath).then( resp => { if (resp) { console.log(resp); resp.json().then((data: any) => { diff --git a/src/app/mapping/service/mapping.service.ts b/src/app/mapping/service/mapping.service.ts index fd3834a8b..3f95a4e70 100644 --- a/src/app/mapping/service/mapping.service.ts +++ b/src/app/mapping/service/mapping.service.ts @@ -155,14 +155,14 @@ export class MappingService { return result; } - async postToFdpFropSmartharvester(catalogId: string, data: RequestMapping): Promise<any> { + async postToFdpFropSmartharvester(catalogId: string, data: RequestMapping, isJsonpath: boolean): Promise<any> { if(this.fds2Token) { const httpOptions = new Headers(); httpOptions.append('Content-Type', 'application/json'); httpOptions.append('Accept', 'application/json'); httpOptions.append('Authorization', `Bearer ${this.fds2Token}`) - let url = `${this.smartHarvesterUrl}/harvester/api/transform/publish?fdpUrl=${this.fdpUrl}&catalogId=${catalogId}`; + let url = `${this.smartHarvesterUrl}/harvester/api/transform/publish?fdpUrl=${this.fdpUrl}&catalogId=${catalogId}&isJsonpath=${isJsonpath}`; const myInit = { method: 'POST', body: JSON.stringify(data), headers: httpOptions}; const myRequest = new Request(url, myInit); diff --git a/src/assets/geodcat.json b/src/assets/geodcat.json index 5f235ddba..8aaf3d6b9 100644 --- a/src/assets/geodcat.json +++ b/src/assets/geodcat.json @@ -6,13 +6,6 @@ "card": "1..1", "geodcat": false }, - { - "property": "has Version", - "uri": "dct:hasVersion", - "usageNote": "Optional property.This property refers to a related Dataset that is a version, edition, or adaptation of the described Dataset.", - "card": "0..n", - "geodcat": false - }, { "property": "description", "uri": "dct:description", @@ -20,6 +13,27 @@ "card": "1..n", "geodcat": false }, + { + "property": "other identifier", + "uri": "adms:identifier", + "usageNote": "Optional property. This property refers to a secondary identifier of the Dataset, such as MAST/ADS[1], DataCite[2], DOI[3], EZID[4] or W3ID[5].", + "card": "0..n", + "geodcat": false + }, + { + "property": "sample", + "uri": "adms:sample", + "usageNote": "Optional property. This property refers to a sample distribution of the dataset.", + "card": "0..n", + "geodcat": false + }, + { + "property": "version notes", + "uri": "adms:versionNotes", + "usageNote": "Optional property. This property contains a description of the differences between this version and a previous version of the Dataset.", + "card": "0..n", + "geodcat": false + }, { "property": "contact point", "uri": "dcat:contactPoint", @@ -42,16 +56,30 @@ "geodcat": false }, { - "property": "publisher", - "uri": "dct:publisher", - "usageNote": "Recommended property. This property refers to an entity (organisation) responsible for making the Dataset available.", - "card": "0..1", + "property": "landing page", + "uri": "dcat:landingPage", + "usageNote": "Optional property. This property refers to a web page that provides access to the Dataset, its Distributions and/or additional information.", + "card": "0..n", "geodcat": false }, { - "property": "spatial/geographical coverage", - "uri": "dct:spatial", - "usageNote": "Recommended property. This property refers to a geographic region that is covered by the Dataset. ", + "property": "qualified Relation", + "uri": "dcat:qualifiedRelation", + "usageNote": "Optional property. This property provides a link to a description of a relationship with another resource.", + "card": "0..n", + "geodcat": false + }, + { + "property": "spatial resolution in metres", + "uri": "dcat:spatialResolutionInMeters", + "usageNote": "Optional property. This property refers to the minimum spatial separation resolvable in a dataset, measured in meters. ", + "card": "0..n", + "geodcat": false + }, + { + "property": "temporal resolution", + "uri": "dcat:temporalResolution", + "usageNote": "This property refers to the minimum time period resolvable in the dataset.", "card": "0..n", "geodcat": false }, @@ -63,10 +91,17 @@ "geodcat": false }, { - "property": "temporal coverage", - "uri": "dct:temporal", - "usageNote": "Recommended property. This property refers to a temporal period that the Dataset covers.", - "card": "0..n", + "property": "access rights", + "uri": "dct:accessRights", + "usageNote": "Optional property. This property refers to information that indicates whether the Dataset is open data, has access restrictions or is not public. A controlled vocabulary with three members (:public, :restricted, :non-public) will be created and maintained by the Publications Office of the EU.", + "card": "0..1", + "geodcat": false + }, + { + "property": "frequency", + "uri": "dct:accrualPeriodicity", + "usageNote": "Optional property. This property refers to the frequency at which Dataset is updated.", + "card": "0..1", "geodcat": false }, { @@ -84,37 +119,30 @@ "geodcat": true }, { - "property": "frequency", - "uri": "dct:accrualPeriodicity", - "usageNote": "Optional property. This property refers to the frequency at which Dataset is updated.", + "property": "creator", + "uri": "dct:creator", + "usageNote": "Optional property. This property refers to an entity primarily responsible for making the resource.", "card": "0..1", "geodcat": false }, { - "property": "identifier", - "uri": "dct:identifier", - "usageNote": "Optional property. This property contains the main identifier for the Dataset, e.g. the URI or other unique identifier in the context of the Catalogue.", - "card": "0..n", - "geodcat": false - }, - { - "property": "landing page", - "uri": "dcat:landingPage", - "usageNote": "Optional property. This property refers to a web page that provides access to the Dataset, its Distributions and/or additional information.", + "property": "has Version", + "uri": "dct:hasVersion", + "usageNote": "Optional property.This property refers to a related Dataset that is a version, edition, or adaptation of the described Dataset.", "card": "0..n", "geodcat": false }, { - "property": "language", - "uri": "dct:language", - "usageNote": "Optional property. This property refers to a language of the Dataset. This property can be repeated if there are multiple languages in the Dataset.", + "property": "identifier", + "uri": "dct:identifier", + "usageNote": "Optional property. This property contains the main identifier for the Dataset, e.g. the URI or other unique identifier in the context of the Catalogue.", "card": "0..n", "geodcat": false }, { - "property": "other identifier", - "uri": "adms:identifier", - "usageNote": "Optional property. This property refers to a secondary identifier of the Dataset, such as MAST/ADS[1], DataCite[2], DOI[3], EZID[4] or W3ID[5].", + "property": "is reference by", + "uri": "dct:isReferencedBy", + "usageNote": "Optional property. This property refers to a related resource, such as a publication, that references, cites, or otherwise points to the dataset.", "card": "0..n", "geodcat": false }, @@ -126,52 +154,38 @@ "geodcat": false }, { - "property": "rights holder", - "uri": "dct:rightsHolder", - "usageNote": "Optional property. This property refers to an Agent (organisation) holding rights on the Dataset.", + "property": "is Version Of", + "uri": "dct:isVersionOf", + "usageNote": "Optional property. This property refers to a related Dataset of which the described Dataset is a version, edition, or adaptation.", "card": "0..n", - "geodcat": true - }, - { - "property": "update/modification date", - "uri": "dct:modified", - "usageNote": "Optional property. This property contains the most recent date on which the Dataset was changed or modified.", - "card": "0..1", "geodcat": false }, { - "property": "provenance", - "uri": "dct:provenance", - "usageNote": "Optional property. This property contains a statement about the lineage of a Dataset.", + "property": "language", + "uri": "dct:language", + "usageNote": "Optional property. This property refers to a language of the Dataset. This property can be repeated if there are multiple languages in the Dataset.", "card": "0..n", "geodcat": false }, { - "property": "sample", - "uri": "adms:sample", - "usageNote": "Optional property. This property refers to a sample distribution of the dataset.", - "card": "0..n", + "property": "update/modification date", + "uri": "dct:modified", + "usageNote": "Optional property. This property contains the most recent date on which the Dataset was changed or modified.", + "card": "0..1", "geodcat": false }, { - "property": "source", - "uri": "dct:source", - "usageNote": "Optional property. This property refers to a related Dataset from which the described Dataset is derived.", - "card": "0..n", + "property": "publisher", + "uri": "dct:publisher", + "usageNote": "Recommended property. This property refers to an entity (organisation) responsible for making the Dataset available.", + "card": "0..1", "geodcat": false }, { - "property": "topic category", - "uri": "dct:subject", - "usageNote": "Optional property. In GeoDCAT-AP, this property SHOULD take as value one of the URIs of the \"Topic categories in accordance with EN ISO 19115\" code list operated by the INSPIRE Registry [INSPIRE-TC].", + "property": "provenance", + "uri": "dct:provenance", + "usageNote": "Optional property. This property contains a statement about the lineage of a Dataset.", "card": "0..n", - "geodcat": true - }, - { - "property": "type", - "uri": "dct:type", - "usageNote": "Optional property. This property refers to the type of the Dataset. A controlled vocabulary for the values has not been established.", - "card": "0..1", "geodcat": false }, { @@ -182,73 +196,45 @@ "geodcat": false }, { - "property": "version", - "uri": "owl:versionInfo", - "usageNote": "Optional property. This property contains a version number or other version designation of the Dataset.", - "card": "0..1", - "geodcat": false - }, - { - "property": "version notes", - "uri": "adms:versionNotes", - "usageNote": "Optional property. This property contains a description of the differences between this version and a previous version of the Dataset.", + "property": "rights holder", + "uri": "dct:rightsHolder", + "usageNote": "Optional property. This property refers to an Agent (organisation) holding rights on the Dataset.", "card": "0..n", - "geodcat": false + "geodcat": true }, { - "property": "is Version Of", - "uri": "dct:isVersionOf", - "usageNote": "Optional property. This property refers to a related Dataset of which the described Dataset is a version, edition, or adaptation.", + "property": "spatial/geographical coverage", + "uri": "dct:spatial", + "usageNote": "Recommended property. This property refers to a geographic region that is covered by the Dataset. ", "card": "0..n", "geodcat": false }, { - "property": "documentation", - "uri": "foaf:page", - "usageNote": "Optional property. This property refers to a page or document about this Dataset.", + "property": "source", + "uri": "dct:source", + "usageNote": "Optional property. This property refers to a related Dataset from which the described Dataset is derived.", "card": "0..n", "geodcat": false }, { - "property": "access rights", - "uri": "dct:accessRights", - "usageNote": "Optional property. This property refers to information that indicates whether the Dataset is open data, has access restrictions or is not public. A controlled vocabulary with three members (:public, :restricted, :non-public) will be created and maintained by the Publications Office of the EU.", - "card": "0..1", - "geodcat": false - }, - { - "property": "creator", - "uri": "dct:creator", - "usageNote": "Optional property. This property refers to an entity primarily responsible for making the resource.", - "card": "0..1", - "geodcat": false - }, - { - "property": "qualified attribution", - "uri": "prov:qualifiedAttribution", - "usageNote": "Optional property. This property refers to the link to an Agent having some form of responsibility for the resource. ", + "property": "topic category", + "uri": "dct:subject", + "usageNote": "Optional property. In GeoDCAT-AP, this property SHOULD take as value one of the URIs of the \"Topic categories in accordance with EN ISO 19115\" code list operated by the INSPIRE Registry [INSPIRE-TC].", "card": "0..n", - "geodcat": false + "geodcat": true }, { - "property": "was generated by", - "uri": "prov:wasGeneratedBy", - "usageNote": "Optional property. This property refers to an activity that generated, or provides the business context for, the creation of the dataset.", + "property": "temporal coverage", + "uri": "dct:temporal", + "usageNote": "Recommended property. This property refers to a temporal period that the Dataset covers.", "card": "0..n", "geodcat": false }, { - "property": "was used by", - "uri": "prov:wasUsedBy", - "usageNote": "Optional property. This property refers to an Activity that used the Dataset. In GeoDCAT-AP, this property MAY be used to specify a testing Activity over a Dataset, against a given Standard, producing as output a conformance degree.", - "card": "0..n", - "geodcat": true - }, - { - "property": "temporal resolution", - "uri": "dcat:temporalResolution", - "usageNote": "This property refers to the minimum time period resolvable in the dataset.", - "card": "0..n", + "property": "type", + "uri": "dct:type", + "usageNote": "Optional property. This property refers to the type of the Dataset. A controlled vocabulary for the values has not been established.", + "card": "0..1", "geodcat": false }, { @@ -259,23 +245,9 @@ "geodcat": true }, { - "property": "spatial resolution in metres", - "uri": "dcat:spatialResolutionInMeters", - "usageNote": "Optional property. This property refers to the minimum spatial separation resolvable in a dataset, measured in meters. ", - "card": "0..n", - "geodcat": false - }, - { - "property": "spatial resolution as text", - "uri": "rdfs:comment", - "usageNote": "Optional property. This property MAY be used to express spatial resolution as free-text, when it cannot be specified via dqv:hasQualityMeasurement and dcat:spatialResolutionInMeters. ", - "card": "0..n", - "geodcat": true - }, - { - "property": "is reference by", - "uri": "dct:isReferencedBy", - "usageNote": "Optional property. This property refers to a related resource, such as a publication, that references, cites, or otherwise points to the dataset.", + "property": "documentation", + "uri": "foaf:page", + "usageNote": "Optional property. This property refers to a page or document about this Dataset.", "card": "0..n", "geodcat": false }, @@ -329,10 +301,38 @@ "geodcat": true }, { - "property": "qualified Relation", - "uri": "dcat:qualifiedRelation", - "usageNote": "Optional property. This property provides a link to a description of a relationship with another resource.", + "property": "version", + "uri": "owl:versionInfo", + "usageNote": "Optional property. This property contains a version number or other version designation of the Dataset.", + "card": "0..1", + "geodcat": false + }, + { + "property": "qualified attribution", + "uri": "prov:qualifiedAttribution", + "usageNote": "Optional property. This property refers to the link to an Agent having some form of responsibility for the resource. ", + "card": "0..n", + "geodcat": false + }, + { + "property": "was generated by", + "uri": "prov:wasGeneratedBy", + "usageNote": "Optional property. This property refers to an activity that generated, or provides the business context for, the creation of the dataset.", "card": "0..n", "geodcat": false + }, + { + "property": "was used by", + "uri": "prov:wasUsedBy", + "usageNote": "Optional property. This property refers to an Activity that used the Dataset. In GeoDCAT-AP, this property MAY be used to specify a testing Activity over a Dataset, against a given Standard, producing as output a conformance degree.", + "card": "0..n", + "geodcat": true + }, + { + "property": "spatial resolution as text", + "uri": "rdfs:comment", + "usageNote": "Optional property. This property MAY be used to express spatial resolution as free-text, when it cannot be specified via dqv:hasQualityMeasurement and dcat:spatialResolutionInMeters. ", + "card": "0..n", + "geodcat": true } ] \ No newline at end of file -- GitLab