Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFDS-register-front
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dad
FFDS-register-front
Commits
2967cf30
Commit
2967cf30
authored
4 years ago
by
Administrator
Browse files
Options
Downloads
Patches
Plain Diff
create datastets
parent
55030dce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/datasets/datasets.component.ts
+37
-3
37 additions, 3 deletions
src/app/datasets/datasets.component.ts
with
37 additions
and
3 deletions
src/app/datasets/datasets.component.ts
+
37
−
3
View file @
2967cf30
...
...
@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
AppConfiguration
}
from
'
../AppConfiguration
'
;
import
{
FileSaverService
}
from
'
ngx-filesaver
'
;
import
{
environment
}
from
'
src/environments/environment.prod
'
;
@
Component
({
...
...
@@ -28,9 +29,7 @@ export class DatasetsComponent implements OnInit {
listdatasets
()
{
var
myHeaders
=
new
Headers
();
myHeaders
.
append
(
"
Content-Type
"
,
"
Application/json
"
);
var
myInit
=
{
method
:
'
GET
'
,
headers
:
myHeaders
};
var
myRequest
=
new
Request
(
'
https://data.inra.fr/api/search?q=*&type=dataset&start=60000&show_entity_ids=true
'
,
myInit
);
fetch
(
myRequest
,
myInit
)
...
...
@@ -38,13 +37,48 @@ export class DatasetsComponent implements OnInit {
response
.
json
()
.
then
(
data
=>
{
this
.
dataresult
=
JSON
.
stringify
(
data
[
'
data
'
][
'
total_count
'
]);
this
.
itemsdatasets
=
data
[
'
data
'
][
'
items
'
];
this
.
itemsdatasets
=
data
[
'
data
'
][
'
items
'
];
for
(
var
i
=
0
;
i
<
this
.
itemsdatasets
.
length
;
i
++
)
{
this
.
createdataset
((
JSON
.
stringify
(
data
[
'
data
'
][
'
items
'
][
i
][
'
entity_id
'
])));
}
});
});
return
null
;
}
createdataset
(
id
:
String
)
{
console
.
log
(
id
);
let
data
:
string
;
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: <http://sandbox9.cines.fr/>.
\n\
@prefix c: <http://sandbox9.cines.fr/catalog/>.
\n\
\n\
s:new
\n\
a dcat:Dataset, dcat:Resource;
\n\
dct:description "descr";
\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
'
const
httpOptions
=
{
headers
:
new
HttpHeaders
({
'
Accept
'
:
'
text/turtle
'
,
'
Content-Type
'
:
'
text/turtle
'
,
'
Authorization
'
:
'
Bearer
'
+
environment
.
token
})
};
return
this
.
http
.
post
(
this
.
appConfig
.
fdpurl
+
"
/dataset
"
,
data
,
httpOptions
).
subscribe
(
(
r
)
=>
{
console
.
log
(
'
got r
'
,
r
)})
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment