Commit 22b1004f authored by Administrator's avatar Administrator
Browse files

create datastets

parent 2967cf30
......@@ -30,6 +30,7 @@ export class DatasetsComponent implements OnInit {
var myHeaders = new Headers();
myHeaders.append("Content-Type", "Application/json");
var myInit = { method: 'GET', headers: myHeaders};
//appler smart havester pour récuprer l'api à lancer
var myRequest = new Request('https://data.inra.fr/api/search?q=*&type=dataset&start=60000&show_entity_ids=true',myInit);
fetch(myRequest, myInit)
......@@ -39,7 +40,7 @@ export class DatasetsComponent implements OnInit {
this.dataresult =JSON.stringify(data['data']['total_count']);
this.itemsdatasets = data['data']['items'];
for (var i = 0; i < this.itemsdatasets.length; i++) {
this.createdataset((JSON.stringify(data['data']['items'][i]['entity_id'])));
this.createdataset(data['data']['items'][i]);
}
});
});
......@@ -47,9 +48,15 @@ export class DatasetsComponent implements OnInit {
}
createdataset(id: String) {
console.log(id);
let data: string;
createdataset(item: any) {
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\
......@@ -60,13 +67,13 @@ data ='\
\n\
s:new\n\
a dcat:Dataset, dcat:Resource;\n\
dct:description "descr";\n\
dct:description '+ description +';\n\
dct:hasVersion "1.0";\n\
dct:isPartOf c:186e50ee-339d-4bae-818f-969977f6e57a;\n\
dct:language language:en;\n\
dct:license <http://rdflicense.appspot.com/rdflicense/cc-by-nc-nd3.0>;\n\
dct:title "data1";\n\
dcat:keyword "toto".\n'
dct:title '+ name +';\n\
dcat:keyword '+ url +'.\n'
const httpOptions = {
headers: new HttpHeaders({
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment