Skip to content
Snippets Groups Projects
Commit 7aab623f authored by Baptiste Toulemonde's avatar Baptiste Toulemonde
Browse files

datasets descriptions

parent 352f14b8
No related branches found
No related tags found
1 merge request!7delete fdp & smartharvester settings: config from environement and get user...
......@@ -39,6 +39,7 @@ import { NbLayoutModule, NbThemeModule, NbTooltipModule, NbSpinnerModule, NbSele
import { NbAuthModule } from '@nebular/auth/auth.module';
import { NbDummyAuthStrategy } from '@nebular/auth/strategies/dummy/dummy-strategy';
import { DashboardComponent } from './dashboard/dashboard.component';
import { TreeComponent } from './mapping/tree/tree.component';
@NgModule({
......@@ -55,7 +56,8 @@ import { DashboardComponent } from './dashboard/dashboard.component';
SearchComponent,
StatsComponent,
DashboardComponent,
MappingComponent
MappingComponent,
TreeComponent,
],
imports: [
BrowserModule,
......
......@@ -20,7 +20,7 @@ export class DatasetsComponent implements OnInit {
Object = Object;
urlrepo = "dataverse.ird.fr";
// urlrepo = "data.inrae.fr";
// urlrepo = "data.inrae.fr";
constructor(
private appConfig: AppConfiguration,
......@@ -103,7 +103,7 @@ export class DatasetsComponent implements OnInit {
for (var i = 0; i < item['datasetVersion']['metadataBlocks']['citation']['fields'].length; i++) {
if (item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['typeName'] == "dsDescription") {
description = JSON.stringify(item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['value']);
description = JSON.stringify(item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['value'][0]['dsDescriptionValue']['value']);
}
if (item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['typeName'] == "title") {
name = JSON.stringify( item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['value'] );
......@@ -117,12 +117,11 @@ export class DatasetsComponent implements OnInit {
@prefix language: <http://id.loc.gov/vocabulary/iso639-1/>.\n\
@prefix s: <'+ this.appConfig.fdpurl + '/>.\n\
@prefix c: <'+ this.appConfig.fdpurl + '/catalog/>.\n\
\n\
s:new\n\
a dcat:Dataset, dcat:Resource;\n\
dct:description '+ description + ';\n\
dct:description ' + description + ';\n\
dct:hasVersion "1.0";\n\
dct:isPartOf c:a21f9b06-b7e7-43c0-869d-d81f09053383;\n\
dct:isPartOf <http://fdp-api.f2ds.svc.cluster.local/catalog/e5f49dbf-c976-4ca7-b4ee-7cc90923d9f3>;\n\
dct:language language:en;\n\
dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\
dct:title '+ name + ';\n\
......@@ -130,7 +129,7 @@ export class DatasetsComponent implements OnInit {
console.log(data);
// return this.dataSetService.createDataSet(data);
//return this.dataSetService.createDataSet(data);
}
......@@ -152,8 +151,8 @@ export class DatasetsComponent implements OnInit {
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 ffd: <https://ffds.eosc-pillar.eu/>.\n\
@prefix d: <https://ffds.eosc-pillar.eu/dataset/>.\n\
@prefix ffd: <https://f2ds.eosc-pillar.eu/>.\n\
@prefix d: <https://f2ds.eosc-pillar.eu/dataset/>.\n\
@prefix GVW: <https://dataverse.ird.fr/dataset.xhtml?persistentId=doi:10.23708/GVWCA0#>.\n\
\n\
ffd:new\n\
......
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { AppConfiguration } from 'src/app/AppConfiguration';
import { AuthService } from 'src/app/authentication/services/auth.service';
import { ParseXmlService } from '../../services/parse-xml.service';
......@@ -28,7 +29,7 @@ export class DatasetCrudService {
})
};
let resultat = this.http.post(this.appConfig.fdpurl+"/catalog", data, httpOptions ).subscribe( (r)=>{console.log('reponse: ', r)}) ;
let resultat = this.http.post(this.appConfig.fdpurl+"/dataset", data, httpOptions ).subscribe( (r)=>{console.log('reponse: ', r)}) ;
if (resultat){
console.log("resultat: " + JSON.stringify(resultat));
return JSON.stringify(resultat);
......@@ -78,6 +79,10 @@ export class DatasetCrudService {
return exist
}
getLocally<T = any>(path: string): Observable<T> {
console.log('On getLocally using filepath : ', `${path}`);
return this.http.get<T>(`${path}`);
}
}
......@@ -2,7 +2,9 @@
<div class="card-col">
<nb-card size="giant">
<nb-card-header>Dataset metadata</nb-card-header>
<nb-card-body></nb-card-body>
<nb-card-body>
<app-tree [items]="Object.keys(itemsdataset)" [itemsDataset]="itemsdataset"></app-tree>
</nb-card-body>
</nb-card>
</div>
<div class="card-col">
......
:host {
display: block;
max-height: 25rem;
overflow-x: hidden;
overflow-y: auto;
}
.card-row {
display: flex;
flex: 1 0 calc(100%);
margin: 0 -0.5rem;
}
.card-col {
flex: 1 0 calc(50% - 1rem);
width: 50%;
flex: calc(50% );
margin: 0 0.5rem;
}
\ No newline at end of file
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { FileSaverService } from 'ngx-filesaver';
import { AppConfiguration } from '../AppConfiguration';
import { DatasetCrudService } from '../datasets/services/dataset-crud.service';
@Component({
selector: 'app-mapping',
......@@ -7,9 +13,166 @@ import { Component, OnInit } from '@angular/core';
})
export class MappingComponent implements OnInit {
constructor() { }
itemsdatasets: any;
itemsdataset: Object;
fields : Map<number, string[]>;
Object = Object;
urlrepo = "dataverse.ird.fr";
// urlrepo = "data.inrae.fr";
constructor(
private appConfig: AppConfiguration,
private dataSetService: DatasetCrudService
) { }
ngOnInit() {
this.itemsdataset = [];
this.listdatasets();
}
listdatasets() {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "Application/json");
var myInit = { method: 'GET', headers: myHeaders };
//appeler smart havester pour récuperer l'api à lancer
var myRequest = new Request('https://' + this.urlrepo + '/api/search?q=*&per_page=5&type=dataset&start=50&show_facets=true&show_my_data=true', myInit);
ngOnInit(): void {
fetch(myRequest, myInit)
.then(response => {
response.json()
.then(data => {
this.itemsdatasets = data['data']['items'];
for (var i = 0; i < this.itemsdatasets.length; i++) {
if (!this.dataSetService.findDataSetByTitle(this.itemsdatasets[i]['name'])) {
if (data['data']['items'][i]['global_id']) {
this.populatecatalogue(data['data']['items'][i]['global_id']);
}
}
}
});
});
return null;
}
populatecatalogue(id: string) {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "Application/json");
var myInit = { method: 'GET', headers: myHeaders };
//appeler smart havester pour récuperer l'api à lancer
var myRequest = new Request('https://' + this.urlrepo + '/api/datasets/export?exporter=dataverse_json&persistentId=' + id, myInit);
fetch(myRequest, myInit)
.then(response => {
response.json()
.then(data => {
this.itemsdataset = data;
//this.createdataset(this.itemsdataset);
//this.createdistribution(this.itemsdataset);
});
});
}
createdataset(item: any) {
//console.log(item);
let data: string;
let description = "";
let name = "";
let url: string;
for (var i = 0; i < item['datasetVersion']['metadataBlocks']['citation']['fields'].length; i++) {
if (item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['typeName'] == "dsDescription") {
description = JSON.stringify(item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['value']);
}
if (item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['typeName'] == "title") {
name = JSON.stringify(item['datasetVersion']['metadataBlocks']['citation']['fields'][i]['value']);
}
}
url = JSON.stringify(item['persistentUrl']);
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.appConfig.fdpurl + '/>.\n\
@prefix c: <'+ this.appConfig.fdpurl + '/catalog/>.\n\
\n\
s:new\n\
a dcat:Dataset, dcat:Resource;\n\
dct:description '+ description + ';\n\
dct:hasVersion "1.0";\n\
dct:isPartOf c:e5f49dbf-c976-4ca7-b4ee-7cc90923d9f3;\n\
dct:language language:en;\n\
dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\
dct:title '+ name + ';\n\
dcat:keyword '+ url + '.\n'
console.log('data: ' + data);
return this.dataSetService.createDataSet(data);
}
createdistribution(item: any) {
// si file alors download url https://dataverse.ird.fr/api/access/datafile/['files']['dataFile'][i]['id']]
console.log(item);
let data: string;
let description: string;
description = JSON.stringify(item['description']);
let name: string;
name = JSON.stringify(item['name']);
let url: string;
url = JSON.stringify(item['url']);
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 ffd: <https://f2ds.eosc-pillar.eu/>.\n\
@prefix d: <https://f2ds.eosc-pillar.eu/dataset/>.\n\
@prefix GVW: <https://dataverse.ird.fr/dataset.xhtml?persistentId=doi:10.23708/GVWCA0#>.\n\
\n\
ffd:new\n\
a dcat:Distribution, dcat:Resource;\n\
dct:description "Botinelli_VNM_2016.png ";\n\
dct:hasVersion "v1.0";\n\
dct:isPartOf d:e5f49dbf-c976-4ca7-b4ee-7cc90923d9f3;\n\
dct:language language:fr;\n\
dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\
dct:title "Botinelli_VNM_2016.png ";\n\
dcat:accessURL GVW:;\n\
dcat:downloadURL\n\
<https://dataverse.ird.fr/api/access/datafile/262?imageThumb=400>;\n\
dcat:format "png";\n\
dcat:mediaType "png".'
return this.dataSetService.createDistribution(data);
}
}
<div *ngFor="let item of items">
<ul>
<li>
<label>
{{item}}
</label>
<input *ngIf="!isObject(itemsDataset[item])" type="text" value="{{itemsDataset[item]}}" disabled >
</li>
</ul>
<ul *ngIf="isObject(itemsDataset[item])">
<app-tree [items]="Object.keys(itemsDataset[item])" [itemsDataset]="itemsDataset[item]"></app-tree>
</ul>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TreeComponent } from './tree.component';
describe('TreeComponent', () => {
let component: TreeComponent;
let fixture: ComponentFixture<TreeComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ TreeComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(TreeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'app-tree',
templateUrl: './tree.component.html',
styleUrls: ['./tree.component.scss']
})
export class TreeComponent implements OnInit {
@Input() items;
@Input() itemsDataset;
Object = Object;
constructor() { }
ngOnInit(): void {
}
isObject(object: Object): boolean{
if(typeof object === 'object'){
return true;
} else {
return false;
}
}
}
......@@ -110,7 +110,7 @@ repository:\n\
a dcat:Catalog, dcat:Resource;\n\
dct:description "'+ this.Form.value.repodescription + '";\n\
dct:hasVersion "'+ this.Form.value.repoversion + '";\n\
dct:isPartOf <'+ this.appConfig.fdpurl + '>;\n\
dct:isPartOf <http://146.59.2.80>;\n\
dcat:keyword "'+ this.Form.value.repotype + '";\n\
dct:title "'+ this.Form.value.reponame + '".\n'
......
{
"description": {
"identier": "dct:descritpion",
"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."
},
"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."
},
"contactPoint": {
"identifier": "dcat:contactPoint",
"usageNote": "Recommended property.This property contains contact information that can be used for sending comments about the Dataset."
},
"distribution": {
"identifier": "dcat:distribution",
"usageNote": "Recommended property. This property links the Dataset to an available Distribution."
},
"keyword": {
"identifier": "dcat:keyword",
"usageNote": "Recommended property. This property contains a keyword or tag describing the Dataset."
},
"publisher": {
"identifier": "dct:publisher",
"usageNote": "Recommended property. This property refers to an entity (organisation) responsible for making the Dataset available."
},
"spatial": {
"identifier": "dct:spatial",
"usageNote": "Recommended property. This property refers to a geographic region that is covered by the Dataset. "
},
"theme": {
"identifier": "dcat:theme",
"usageNote": "Recommended property. This property refers to a category of the Dataset. A Dataset may be associated with multiple themes. Subproperty of dct:subject."
},
"temporal": {
"identifier": "dct:temporal",
"usageNote": "Recommended property. This property refers to a temporal period that the Dataset covers."
},
"conformsTo": {
"identifier": "dct:conformsTo",
"usageNote": "Optional property. This property refers to an implementing rule or other specification."
},
"accrualPeriodicity": {
"identifier": "dct:accrualPeriodicity",
"usageNote": "Optional property. This property refers to the frequency at which Dataset is updated."
},
"identifier": {
"identifier": "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."
},
"landingPage": {
"identifier": "dcat:landingPage",
"usageNote": "Optional property. This property refers to a web page that provides access to the Dataset, its Distributions and/or additional information."
},
"language": {
"identifier": "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."
},
"other identifier": {
"identifier": "adms:identifier",
"usageNote": "Optional property. This property contains the date of formal issuance (e.g., publication) of the Dataset."
},
"issued": {
"identifier": "dct:issued",
"usageNote": "Optional property. This property contains the date of formal issuance (e.g., publication) of the Dataset."
},
"modified": {
"identifier": "dct:modified",
"usageNote": "Optional property. This property contains the most recent date on which the Dataset was changed or modified."
},
"provenance": {
"identifier": "dct:provenance",
"usageNote": "Optional property. This property contains a statement about the lineage of a Dataset."
},
"sample": {
"identifier": "adms:sample",
"usageNote": "Optional property. This property refers to a sample distribution of the dataset."
},
"source": {
"identifier": "dct:source",
"usageNote": "Optional property. This property refers to a related Dataset from which the described Dataset is derived."
},
"type": {
"identifier": "dct:type",
"usageNote": "Optional property. This property refers to the type of the Dataset. A controlled vocabulary for the values has not been established."
},
"relation": {
"identifier": "dct:relation",
"usageNote": "Optional property. This property refers to a related resource."
},
"versionInfo": {
"identifier": "owl:versionInfo",
"usageNote": "Optional property. This property contains a version number or other version designation of the Dataset."
},
"versionNotes": {
"identifier": "adms:versionNotes",
"usageNote": "Optional property. This property contains a description of the differences between this version and a previous version of the Dataset."
},
"isVersionOf": {
"identifier": "dct:isVersionOf",
"usageNote": "Optional property. This property refers to a related Dataset of which the described Dataset is a version, edition, or adaptation."
},
"hasVersion": {
"identifier": "dct:hasVersion",
"usageNote": "Optional property.This property refers to a related Dataset that is a version, edition, or adaptation of the described Dataset."
},
"page": {
"identifier": "foaf:page",
"usageNote": "Optional property. This property refers to a page or document about this Dataset."
},
"accessRights": {
"identifier": "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."
},
"creator": {
"identifier": "dct:creator",
"usageNote": "Optional property. This property refers to an entity primarily responsible for making the resource."
},
"qualifiedAttribution": {
"identifier": "prov:qualifiedAttribution",
"usageNote": "Optional property. This property refers to the link to an Agent having some form of responsibility for the resource. "
},
"wasGeneratedBy": {
"identifier": "prov:wasGeneratedBy",
"usageNote": "Optional property. This property refers to an activity that generated, or provides the business context for, the creation of the dataset."
},
"temporalResolution": {
"identifier": "dcat:temporalResolution",
"usageNote": "This property refers to the minimum time period resolvable in the dataset."
},
"spatialResolutionInMeters": {
"identifier": "dcat:spatialResolutionInMeters",
"usageNote": "Optional property. This property refers to the minimum spatial separation resolvable in a dataset, measured in meters. "
},
"qualifiedRelation": {
"identifier": "dcat:qualifiedRelation",
"usageNote": "Optional property. This property provides a link to a description of a relationship with another resource."
},
"isReferencedBy": {
"identifier": "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."
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment