import {Injectable} from '@angular/core'; import {HttpClient} from "@angular/common/http"; import {ResultLandingInfo} from '../../../utils/entities/resultLandingInfo'; import {EnvProperties} from '../../../utils/properties/env-properties'; import {ParsingFunctions} from '../../landing-utils/parsingFunctions.class'; import {map} from "rxjs/operators"; import {HostedByCollectedFrom} from "../../../utils/result-preview/result-preview"; @Injectable() export class DeletedByInferenceService { private sizeOfDescription: number = 270; constructor(private http: HttpClient ) { this.parsingFunctions = new ParsingFunctions(); } public parsingFunctions: ParsingFunctions; getDeletedByInferenceResults (id: string, size: string, properties:EnvProperties):any { let url = properties.searchAPIURLLAst + 'deletedByInferenceResults/' +id+"?format=json&size="+size; let key = url; return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) //.map(res => res.json()) .pipe(map(res => res['results'])) .pipe(map(res => this.parseDeletedByInferenceResults(res))); } parseDeletedByInferenceResults (_results: any): ResultLandingInfo[] { /*title, authors, abstract, List of projects, PIDs, collectedfrom (link pointing to the download url), access rights*/ let results: ResultLandingInfo[] = []; if(_results) { let result : ResultLandingInfo; let length = Array.isArray(_results) ? _results.length : 1; for(let i=0; i(); let types = new Set(); result.hostedBy_collectedFrom = new Array(); let counter = 0; let instance; let length = Array.isArray(children['instance']) ? children['instance'].length : 1; for(let i=0; i(); } let authors = _result['oaf:result']['creator']; let length = Array.isArray(authors) ? authors.length : 1; for(let i=0; i