[Trunk | Library]: Add deletedByInference (other versions) in software, dataset, other landing pages

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56598 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-07-17 19:48:19 +00:00
parent e490cc81fe
commit 7f08d988c5
14 changed files with 144 additions and 63 deletions

View File

@ -185,6 +185,16 @@
</i-frame> </i-frame>
</div> </div>
</li> </li>
<li (click)="activeTab='Other Versions'" *ngIf="properties.environment == 'development' && datasetInfo.deletedByInferenceIds">
<a class="uk-accordion-title" href="#">
Other Versions
({{datasetInfo.deletedByInferenceIds.length | number}})
</a>
<div *ngIf="activeTab=='Other Versions'" class="uk-accordion-content">
<deletedByInference [id]="datasetId" [ids]="datasetInfo.deletedByInferenceIds" [type]="'research data'"></deletedByInference>
</div>
</li>
</ul> </ul>
</div> </div>

View File

@ -26,6 +26,7 @@ import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2j
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module";
@NgModule({ @NgModule({
imports: [ imports: [
@ -33,7 +34,7 @@ import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule ShowAuthorsModule, DeletedByInferenceModule
], ],
declarations: [ declarations: [
DatasetComponent DatasetComponent

View File

@ -129,6 +129,16 @@ export class DatasetService {
// ['result']['metadata']['oaf:entity']['oaf:result']['children'] // ['result']['metadata']['oaf:entity']['oaf:result']['children']
if(data[3] != null) { if(data[3] != null) {
if(data[3].hasOwnProperty("result")) {
this.datasetInfo.deletedByInferenceIds = [];
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1;
for(let i=0; i<length; i++) {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.datasetInfo.deletedByInferenceIds.push(result.objidentifier);
}
}
if(data[3].hasOwnProperty("instance")) { if(data[3].hasOwnProperty("instance")) {
this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[], this.datasetInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
"collectedName": string, "collectedId": string, "collectedName": string, "collectedId": string,

View File

@ -63,10 +63,6 @@ import {zip} from 'rxjs';
<span *ngIf="result['fundedByProjects'].length > 15">...</span> <span *ngIf="result['fundedByProjects'].length > 15">...</span>
</div> </div>
<!--div class="uk-margin-top" *ngIf="result.hostedBy_collectedFrom && result.hostedBy_collectedFrom.length > 0">
<availableOn [availableOn]="result.hostedBy_collectedFrom"></availableOn>
</div-->
<div *ngIf="result.hostedBy_collectedFrom != undefined"> <div *ngIf="result.hostedBy_collectedFrom != undefined">
<span class="uk-text-bold"> Collected From: </span> <span class="uk-text-bold"> Collected From: </span>
<span *ngFor="let available of result.hostedBy_collectedFrom let i=index"> <span *ngFor="let available of result.hostedBy_collectedFrom let i=index">
@ -145,7 +141,7 @@ export class DeletedByInferenceComponent {
getDeletedByInference() { getDeletedByInference() {
this.results = []; this.results = [];
this.status = this.errorCodes.LOADING; this.status = this.errorCodes.LOADING;
/*
if(this.ids) { if(this.ids) {
var allRequests = []; var allRequests = [];
for(let id of this.ids) { for(let id of this.ids) {
@ -169,6 +165,22 @@ export class DeletedByInferenceComponent {
} }
); );
} }
*/
this._deletedByInferenceService.getDeletedByInferenceResults(this.id, String(this.ids.length), this.properties).subscribe(
data => {
this.results = data;
this.status = this.errorCodes.DONE;
},
error => {
if(error.status == '404') {
this.status = this.errorCodes.NOT_FOUND;
} else if(error.status == '500') {
this.status = this.errorCodes.ERROR;
} else {
this.status = this.errorCodes.NOT_AVAILABLE;
}
}
);
} }
public totalPages(totalResults: number): number { public totalPages(totalResults: number): number {

View File

@ -4,6 +4,7 @@ import {DeletedByInferenceResult} from '../../../utils/entities/deletedByInferen
import {EnvProperties} from '../../../utils/properties/env-properties'; import {EnvProperties} from '../../../utils/properties/env-properties';
import {ParsingFunctions} from '../parsingFunctions.class'; import {ParsingFunctions} from '../parsingFunctions.class';
import {map} from "rxjs/operators"; import {map} from "rxjs/operators";
import {DeletedByInferenceOrganization} from "../../../utils/entities/deletedByInferenceOrganization";
@Injectable() @Injectable()
export class DeletedByInferenceService { export class DeletedByInferenceService {
@ -15,92 +16,92 @@ export class DeletedByInferenceService {
public parsingFunctions: ParsingFunctions; public parsingFunctions: ParsingFunctions;
getDeletedByInferencePublications (id: string, properties:EnvProperties):any { getDeletedByInferenceResults (id: string, size: string, properties:EnvProperties):any {
let url = properties.searchAPIURLLAst + 'deletedByInferencePublications/' +id+"?format=json"; let url = properties.searchAPIURLLAst + 'deletedByInferenceResults/' +id+"?format=json&size="+size;
let key = url; let key = url;
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json()) //.map(res => <any> res.json())
.pipe(map(res => res['result']['metadata']['oaf:entity'])) .pipe(map(res => res['results']))
.pipe(map(res => this.parseDeletedByInferencePublications(res, properties))); .pipe(map(res => this.parseDeletedByInferenceResults(res, properties)));
} }
parseDeletedByInferencePublications (result: any, properties: EnvProperties): DeletedByInferenceResult { parseDeletedByInferenceResults (_results: any, properties: EnvProperties): DeletedByInferenceResult[] {
/*title, authors, abstract, List of projects, PIDs, /*title, authors, abstract, List of projects, PIDs,
collectedfrom (link pointing to the download url), access rights*/ collectedfrom (link pointing to the download url), access rights*/
//let publications: DeletedByInferenceResult[] = []; let results: DeletedByInferenceResult[] = [];
//if(results) { if(_results) {
let publication : DeletedByInferenceResult; let result : DeletedByInferenceResult;
//let length = Array.isArray(results) ? results.length : 1; let length = Array.isArray(_results) ? _results.length : 1;
//for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
//var result = Array.isArray(results) ? results[i] : results; var _result = Array.isArray(_results) ? _results[i]['result']['metadata']['oaf:entity'] : _results['result']['metadata']['oaf:entity'];
publication = new DeletedByInferenceResult(); result = new DeletedByInferenceResult();
if(result) { if(_result) {
if(result['oaf:result']) { if(_result['oaf:result']) {
let data = result['oaf:result']; let data = _result['oaf:result'];
var date:string = (data.dateofacceptance)+""; // transform to string in case it is an integer var date:string = (data.dateofacceptance)+""; // transform to string in case it is an integer
publication.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date; result.date = (date && (date).indexOf('-') !== -1)?date.split('-')[0]:date;
publication.dateofacceptance = data.dateofacceptance; result.dateofacceptance = data.dateofacceptance;
publication.embargoEndDate = data.embargoenddate; result.embargoEndDate = data.embargoenddate;
if(!Array.isArray(data.description)) { if(!Array.isArray(data.description)) {
publication.description = data.description; result.description = data.description;
} else { } else {
publication.description = data.description[0]; result.description = data.description[0];
} }
if(publication.description && publication.description.length > this.sizeOfDescription) { if(result.description && result.description.length > this.sizeOfDescription) {
publication.description = publication.description.substring(0, this.sizeOfDescription) + "..."; result.description = result.description.substring(0, this.sizeOfDescription) + "...";
} }
if(data['bestaccessright'] && data['bestaccessright'].hasOwnProperty("classid")) { if(data['bestaccessright'] && data['bestaccessright'].hasOwnProperty("classid")) {
publication.accessMode = data['bestaccessright'].classid; result.accessMode = data['bestaccessright'].classid;
} }
} }
if(result['oaf:result'] && result['oaf:result']['title']) { if(_result['oaf:result'] && _result['oaf:result']['title']) {
let title = result['oaf:result']['title']; let title = _result['oaf:result']['title'];
if(Array.isArray(title)) { if(Array.isArray(title)) {
publication.title = title[0].content; result.title = title[0].content;
} else { } else {
publication.title = title.content; result.title = title.content;
} }
} }
if(result['oaf:result'] && result['oaf:result']['language']) { if(_result['oaf:result'] && _result['oaf:result']['language']) {
publication.languages = this.parsingFunctions.parseLanguages(result['oaf:result']['language']); result.languages = this.parsingFunctions.parseLanguages(_result['oaf:result']['language']);
} }
if(result['oaf:result'] && result['oaf:result']['country']) { if(_result['oaf:result'] && _result['oaf:result']['country']) {
publication.countries = this.parsingFunctions.parseCountries(result['oaf:result']['country']); result.countries = this.parsingFunctions.parseCountries(_result['oaf:result']['country']);
} }
if(result['oaf:result'] && result['oaf:result']['rels'] && result['oaf:result']['rels']['rel']) { if(_result['oaf:result'] && _result['oaf:result']['rels'] && _result['oaf:result']['rels']['rel']) {
let relation; let relation;
let length = Array.isArray(result['oaf:result']['rels']['rel']) ? result['oaf:result']['rels']['rel'].length : 1; let length = Array.isArray(_result['oaf:result']['rels']['rel']) ? _result['oaf:result']['rels']['rel'].length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
relation = Array.isArray(result['oaf:result']['rels']['rel']) ? result['oaf:result']['rels']['rel'][i] : result['oaf:result']['rels']['rel']; relation = Array.isArray(_result['oaf:result']['rels']['rel']) ? _result['oaf:result']['rels']['rel'][i] : _result['oaf:result']['rels']['rel'];
if(relation.hasOwnProperty("to")) { if(relation.hasOwnProperty("to")) {
if(relation['to'].class == "isProducedBy") { if(relation['to'].class == "isProducedBy") {
publication.fundedByProjects = this.parsingFunctions.parseFundingByProjects(publication.fundedByProjects, relation, publication.projectsProvenanceVocabulary); result.fundedByProjects = this.parsingFunctions.parseFundingByProjects(result.fundedByProjects, relation, result.projectsProvenanceVocabulary);
} }
} }
} }
} }
if(result['oaf:result'] && result['oaf:result']['children']) { if(_result['oaf:result'] && _result['oaf:result']['children']) {
let children = result['oaf:result']['children']; let children = _result['oaf:result']['children'];
if(children.hasOwnProperty("instance")) { if(children.hasOwnProperty("instance")) {
publication.types = new Array<string>(); result.types = new Array<string>();
let types = new Set<string>(); let types = new Set<string>();
publication.hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>(); result.hostedBy_collectedFrom = new Array<{"downloadName": string, "downloadUrl": string[], "collectedName": string, "collectedId": string, "accessMode": string[], "bestAccessMode": string, "type": string, "year":string}>();
let counter = 0; let counter = 0;
let instance; let instance;
@ -110,7 +111,7 @@ export class DeletedByInferenceService {
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
instance = Array.isArray(children['instance']) ? children['instance'][i] : children['instance']; instance = Array.isArray(children['instance']) ? children['instance'][i] : children['instance'];
this.parsingFunctions.parseTypes(publication.types, types, instance); this.parsingFunctions.parseTypes(result.types, types, instance);
if(instance.hasOwnProperty("webresource")) { if(instance.hasOwnProperty("webresource")) {
let url; let url;
@ -121,23 +122,23 @@ export class DeletedByInferenceService {
} }
if(instance.hasOwnProperty("hostedby")) { if(instance.hasOwnProperty("hostedby")) {
counter = this.parsingFunctions.parseHostedBy_collectedFrom(publication.hostedBy_collectedFrom, instance, result['oaf:result'], url, counter, publication.accessMode); counter = this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, _result['oaf:result'], url, counter, result.accessMode);
} }
} }
} }
} }
} }
if(result['oaf:result'] && result['oaf:result']['pid']) { if(_result['oaf:result'] && result['oaf:result']['pid']) {
publication.identifiers = this.parsingFunctions.parseIdentifiers(result['oaf:result']['pid']); result.identifiers = this.parsingFunctions.parseIdentifiers(_result['oaf:result']['pid']);
} }
if(result['oaf:result'] && result['oaf:result']['creator']) { if(_result['oaf:result'] && _result['oaf:result']['creator']) {
if(publication.authors == undefined) { if(result.authors == undefined) {
publication.authors = new Array<{"fullName": string, "orcid": string}>(); result.authors = new Array<{"fullName": string, "orcid": string}>();
} }
let authors = result['oaf:result']['creator']; let authors = _result['oaf:result']['creator'];
let length = Array.isArray(authors) ? authors.length : 1; let length = Array.isArray(authors) ? authors.length : 1;
for(let i=0; i<length; i++) { for(let i=0; i<length; i++) {
@ -146,19 +147,19 @@ export class DeletedByInferenceService {
/*if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) { /*if (author.ORCID && author.ORCID.indexOf(properties.orcidURL) != -1) {
author.ORCID = author.ORCID.substr(properties.orcidURL.length); author.ORCID = author.ORCID.substr(properties.orcidURL.length);
}*/ }*/
publication['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID}; result['authors'][author.rank] = {"fullName": author.content, "orcid": author.ORCID};
} }
} }
publication.authors = publication.authors.filter(function (item) { result.authors = result.authors.filter(function (item) {
return (item != undefined && item.fullName != undefined); return (item != undefined && item.fullName != undefined);
}); });
} }
//} }
//publications.push(publication); results.push(result);
//} }
} }
return publication; return results;
} }
} }

View File

@ -132,6 +132,15 @@
</i-frame> </i-frame>
</div> </div>
</li> </li>
<li (click)="activeTab='Other Versions'" *ngIf="properties.environment == 'development' && orpInfo.deletedByInferenceIds">
<a class="uk-accordion-title" href="#">
Other Versions
({{orpInfo.deletedByInferenceIds.length | number}})
</a>
<div *ngIf="activeTab=='Other Versions'" class="uk-accordion-content">
<deletedByInference [id]="orpId" [ids]="orpInfo.deletedByInferenceIds" [type]="'other research products'"></deletedByInference>
</div>
</li>
</ul> </ul>
</div> </div>

View File

@ -23,6 +23,7 @@ import {IsRouteEnabled} from '../../error/isRouteEnabled.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module";
@NgModule({ @NgModule({
@ -30,7 +31,7 @@ import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
CommonModule, FormsModule, SharedModule, RouterModule, LandingModule, CommonModule, FormsModule, SharedModule, RouterModule, LandingModule,
CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule, CiteThisModule, ResultLandingModule, MetricsModule, IFrameModule, PagingModule,
AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule, AltMetricsModule, ConfigurationServiceModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule ShowAuthorsModule, DeletedByInferenceModule
], ],
declarations: [ declarations: [
OrpComponent OrpComponent

View File

@ -105,6 +105,16 @@ export class OrpService {
} }
if(data[3] != null) { if(data[3] != null) {
if(data[3].hasOwnProperty("result")) {
this.orpInfo.deletedByInferenceIds = [];
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1;
for(let i=0; i<length; i++) {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.orpInfo.deletedByInferenceIds.push(result.objidentifier);
}
}
if(data[3].hasOwnProperty("instance")) { if(data[3].hasOwnProperty("instance")) {
this.orpInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[], this.orpInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
"collectedName": string, "collectedId": string, "collectedName": string, "collectedId": string,

View File

@ -161,6 +161,16 @@
</i-frame> </i-frame>
</div> </div>
</li> </li>
<li (click)="activeTab='Other Versions'" *ngIf="properties.environment == 'development' && softwareInfo.deletedByInferenceIds">
<a class="uk-accordion-title" href="#">
Other Versions
({{softwareInfo.deletedByInferenceIds.length | number}})
</a>
<div *ngIf="activeTab=='Other Versions'" class="uk-accordion-content">
<deletedByInference [id]="softwareId" [ids]="softwareInfo.deletedByInferenceIds" [type]="'software'"></deletedByInference>
</div>
</li>
</ul> </ul>
</div> </div>

View File

@ -20,12 +20,13 @@ import { FreeGuard } from'../../login/freeGuard.guard';
import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module'; import {Schema2jsonldModule} from '../../sharedComponents/schema2jsonld/schema2jsonld.module';
import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module'; import { SEOServiceModule } from '../../sharedComponents/SEO/SEOService.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module"; import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {DeletedByInferenceModule} from "../landing-utils/deletedByInference/deletedByInference.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule, CommonModule, FormsModule, LandingModule, RouterModule, CiteThisModule, PagingModule,
ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule, ResultLandingModule, IFrameModule, MetricsModule, AltMetricsModule, Schema2jsonldModule, SEOServiceModule,
ShowAuthorsModule ShowAuthorsModule, DeletedByInferenceModule
], ],
declarations: [ declarations: [
SoftwareComponent SoftwareComponent

View File

@ -119,6 +119,16 @@ export class SoftwareService {
} }
if(data[3] != null) { if(data[3] != null) {
if(data[3].hasOwnProperty("result")) {
this.softwareInfo.deletedByInferenceIds = [];
let length = Array.isArray(data[3]['result']) ? data[3]['result'].length : 1;
for(let i=0; i<length; i++) {
let result = Array.isArray(data[3]['result']) ? data[3]['result'][i] : data[3]['result'];
this.softwareInfo.deletedByInferenceIds.push(result.objidentifier);
}
}
if(data[3].hasOwnProperty("instance")) { if(data[3].hasOwnProperty("instance")) {
this.softwareInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[], this.softwareInfo.hostedBy_collectedFrom = new Array<{ "downloadName": string, "downloadUrl": string[],
"collectedName": string, "collectedId": string, "collectedName": string, "collectedId": string,

View File

@ -49,4 +49,6 @@ export class DatasetInfo {
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[]; contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
record; record;
references: { "name": string, "url": string}[]; references: { "name": string, "url": string}[];
deletedByInferenceIds: string[];
} }

View File

@ -47,4 +47,6 @@ export class OrpInfo {
contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[]; contexts: { "labelContext": string, "labelCategory": string, "labelConcept": string, "inline": boolean}[];
references: { "name": string, "url": string}[]; references: { "name": string, "url": string}[];
record; record;
deletedByInferenceIds: string[];
} }

View File

@ -49,4 +49,6 @@ export class SoftwareInfo {
record; record;
//softwareType: string; //softwareType: string;
programmingLanguages: string[]; programmingLanguages: string[];
deletedByInferenceIds: string[];
} }