diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 0eefb4662e7e4c726036a862aedf7521a923ac65..8ffa3622296cc788340a013035d88209308fac67 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,7 +4,6 @@ import { UserComponent } from './user/user.component'; import { RepositoryComponent } from './repository/repository.component'; import { AccessapiComponent } from './accessapi/accessapi.component'; import { DatasetsComponent } from './datasets/datasets.component'; -import { PublishComponent } from './publish/publish.component'; import { SettingfdpComponent } from './settingfdp/settingfdp.component'; import { SettingsmartapiComponent } from './settingsmartapi/settingsmartapi.component'; import { RepositoryinfoComponent } from './repositoryinfo/repositoryinfo.component'; @@ -22,6 +21,7 @@ export interface ICustomRoute extends Route { name?: string; } + const routes: ICustomRoute[] = [ { path: '', redirectTo: '/auth/signin', pathMatch: 'full' }, { path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuardService], @@ -32,7 +32,6 @@ const routes: ICustomRoute[] = [ { path: 'repositoryinfo', component: RepositoryinfoComponent }, { path: 'accessapi', component: AccessapiComponent }, { path: 'datasets', component: DatasetsComponent }, - { path: 'publish', component: PublishComponent }, { path: 'stats', component: StatsComponent }, { path: 'settingfdp', component: SettingfdpComponent }, { path: 'settingsmartharvester', component: SettingsmartapiComponent }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 57e990f6f62f2821091e221ac1f37e52675a1f75..55e84899a5e393fe0775a18b0fb8e6df68c64ef3 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,7 +13,6 @@ import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { RepositoryComponent } from './repository/repository.component'; import { AccessapiComponent } from './accessapi/accessapi.component'; import { DatasetsComponent } from './datasets/datasets.component'; -import { PublishComponent } from './publish/publish.component'; import { SettingfdpComponent } from './settingfdp/settingfdp.component'; import { SettingsmartapiComponent } from './settingsmartapi/settingsmartapi.component'; import { UserComponent } from './user/user.component'; @@ -49,7 +48,6 @@ import { DashboardComponent } from './dashboard/dashboard.component'; RepositoryComponent, AccessapiComponent, DatasetsComponent, - PublishComponent, SettingfdpComponent, SettingsmartapiComponent, UserComponent, diff --git a/src/app/datasets/datasets.component.ts b/src/app/datasets/datasets.component.ts index a63f446a7f4797beff2e996533783de692fc1043..59cac69aa0b9a8b54029b221fac0d2fd44a12b75 100644 --- a/src/app/datasets/datasets.component.ts +++ b/src/app/datasets/datasets.component.ts @@ -40,7 +40,7 @@ export class DatasetsComponent implements OnInit { // https://data.inrae.fr/api/search?q=*&per_page=10&type=dataset&start=16000&show_entity_ids=true&show_my_data=true // var myRequest = new Request(this.appConfig.smartapiurl+'harvest/allurls',myInit); - var myRequest = new Request('https://dataverse.ird.fr/api/search?q=*&per_page=100&show_facets=true&show_my_data=true', myInit); + var myRequest = new Request('https://dataverse.ird.fr/api/search?q=*&per_page=20&show_facets=true&show_my_data=true', myInit); fetch(myRequest, myInit) .then(response => { @@ -50,7 +50,9 @@ export class DatasetsComponent implements OnInit { this.itemsdatasets = data['data']['items']; console.log(this.itemsdatasets); for (var i = 0; i < this.itemsdatasets.length; i++) { - this.createdataset(data['data']['items'][i]); + this.dataSetService.findDataSetByTitle(data['data']['items'][i]['name']) ; + //this.createdataset(data['data']['items'][i]); + } }); }); diff --git a/src/app/datasets/services/dataset-crud.service.ts b/src/app/datasets/services/dataset-crud.service.ts index 1f134dd0b370d40efc8acfbf461be7f26f40f43c..545ef60013bb6f93133d8d045d8d61074db51401 100644 --- a/src/app/datasets/services/dataset-crud.service.ts +++ b/src/app/datasets/services/dataset-crud.service.ts @@ -2,6 +2,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { AppConfiguration } from 'src/app/AppConfiguration'; import { AuthService } from 'src/app/authentication/services/auth.service'; +import { ParseXmlService } from '../../services/parse-xml.service'; + @Injectable({ providedIn: 'root' @@ -9,7 +11,8 @@ import { AuthService } from 'src/app/authentication/services/auth.service'; export class DatasetCrudService { fds2Token: string - constructor(private http: HttpClient,private appConfig: AppConfiguration, private authService: AuthService) { } + public results: string[] = []; + constructor(private http: HttpClient,private appConfig: AppConfiguration, private authService: AuthService, private parserService: ParseXmlService) { } createDataSet(data:string){ @@ -33,4 +36,17 @@ export class DatasetCrudService { return "The repository has not been published" } } + + findDataSetByTitle(title:string){ + + let query1='query=PREFIX dcterms: <http://purl.org/dc/terms/> SELECT * WHERE { ?uri dcterms:title "'+ title +'". }' + this.parserService.getXmlResult(query1).subscribe(data=>{if (data){this.results = []; data.results.bindings.forEach(element => { this.results.push(element);}); + if (this.results[0]) { + console.log(this.results[0]['uri'].value.substring(36,72)) + } + }}); + } + + + } diff --git a/src/app/publish/publish.component.html b/src/app/publish/publish.component.html deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/app/publish/publish.component.scss b/src/app/publish/publish.component.scss deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/src/app/publish/publish.component.spec.ts b/src/app/publish/publish.component.spec.ts deleted file mode 100644 index 2c37e9751d39cf0b0432c1eabb1d21780927ef41..0000000000000000000000000000000000000000 --- a/src/app/publish/publish.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { PublishComponent } from './publish.component'; - -describe('PublishComponent', () => { - let component: PublishComponent; - let fixture: ComponentFixture<PublishComponent>; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ PublishComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(PublishComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/publish/publish.component.ts b/src/app/publish/publish.component.ts deleted file mode 100644 index 1e050fac53253010dbf70860727722252d4fb9de..0000000000000000000000000000000000000000 --- a/src/app/publish/publish.component.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - - -@Component({ - selector: 'app-publish', - templateUrl: './publish.component.html', - styleUrls: ['./publish.component.scss'] -}) -export class PublishComponent implements OnInit { - - - constructor() { } - - ngOnInit() { - } - - -}