-
{{available.type}}
-
.
-
{{available.year}}
+
0 || instance.years?.length > 0">
+ 0" class="uk-text-capitalize">{{instance.types.join(" . ")}}
+ 0 && instance.years?.length > 0"> .
+ 0">{{instance.years.join(" . ")}}
-
diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts
index 2179b519..30eec877 100644
--- a/landingPages/landing-utils/parsingFunctions.class.ts
+++ b/landingPages/landing-utils/parsingFunctions.class.ts
@@ -158,31 +158,23 @@ export class ParsingFunctions {
hostedBy_collectedFrom = [];
}
let available: HostedByCollectedFrom = {
- downloadName: "",
- downloadUrl: null,
- collectedName: "",
- collectedId: "",
- accessMode: null,
- bestAccessMode: null,
- type: "",
- year: "",
- icon: ""
+ downloadNames: [],
+ downloadUrl: "",
+ collectedNamesAndIds: null,
+ accessRight: "",
+ types: [],
+ years: [],
+ accessRightIcon: ""
};
-
- if (journal && journal.journal) {
- available.downloadName = publisher + "/ " + journal['journal'];
- } else {
- available.downloadName = publisher;
- }
-
- let url = properties.doiURL + identifiers.get("doi")[0];
-
- available.downloadUrl = new Array
();
- available.accessMode = new Array();
-
- available.downloadUrl.push(url);
- available.icon = this.unknown;
+ if (journal && journal.journal) {
+ available.downloadNames.push(publisher + "/ " + journal['journal']);
+ } else {
+ available.downloadNames.push(publisher);
+ }
+
+ available.downloadUrl = properties.doiURL + identifiers.get("doi")[0];;
+ available.accessRightIcon = this.unknown;
/*
if(title != undefined && title['url'] == "") {
title['url'] = url;
@@ -253,116 +245,105 @@ export class ParsingFunctions {
mapStructure.get(key)['accessMode'].push("");
}
}
-
-
+
parseHostedBy_collectedFrom(hostedBy_collectedFrom: HostedByCollectedFrom[],
- instance: any, data: any, url: string, counter: number/*,
- title: { "name": string, "url": string, "accessMode": string}*/, accessMode: string): number {
- let available: HostedByCollectedFrom = {
- "downloadName": "",
- "downloadUrl": null,
- "collectedName": "",
- "collectedId": "",
- "accessMode": null,
- "bestAccessMode": null,
- "type": "",
- "year": "",
- "icon": ""
- };
-
- if (instance['hostedby'].name && instance['hostedby'].name != "other resources" && instance['hostedby'].name != "Unknown Repository") {
- available.downloadName = instance['hostedby'].name;
- } else {
- // if (data != null && data.hasOwnProperty("source")) {
- // let downloadName: string;
- // if (Array.isArray(data.source)) {
- //
- // if (counter == data.source.length) {
- // counter--;
- // }
- // downloadName = data['source'][counter];
- // } else {
- // downloadName = data['source'];
- // }
- // if (downloadName) {
- // counter++;
- // available.downloadName = downloadName;
- // }
- // }
- //
- // }
- //
- // if(!available.downloadName) {
- available.downloadName = url.substring(0, 30) + '...'; // substring(from, to);
+ instance: any, url: string, globalAccessRight: string) {
+ if(!url) {
+ return;
}
- if (available.downloadName) {
- if (instance.hasOwnProperty("collectedfrom")) {
- available.collectedId = instance['collectedfrom'].id;
- available.collectedName = instance['collectedfrom'].name;
- }
-
- if (instance.hasOwnProperty("instancetype") && instance['instancetype'].classname) {
- available.type = instance['instancetype'].classname;
- }
-
- if (instance.hasOwnProperty("dateofacceptance")) {
- var date: string = (instance.dateofacceptance) + ""; // transform to string in case it is an integer
- available.year = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;
- }
-
- available.accessMode = new Array();
- available.downloadUrl = new Array();
- available['downloadUrl'].push(url);
- if(url.includes("doi.org/")) {
- this.instanceWithDoiExists = true;
- }
- if (instance.hasOwnProperty("accessright")) {
- if (url) {
- available['accessMode'].push(instance['accessright'].classname);
+ let available: HostedByCollectedFrom = {
+ "downloadNames": [],
+ "downloadUrl": null,
+ "collectedNamesAndIds": new Map(),
+ "accessRight": null,
+ "accessRightIcon": "",
+ "types": [],
+ "years": []
+ };
+
+ if (instance.hasOwnProperty("hostedby")) {
+ let downloadNames: Set = new Set();
+ let length = Array.isArray(instance['hostedby']) ? instance['hostedby'].length : 1;
+ for (let i = 0; i < length; i++) {
+ let hostedBy = Array.isArray(instance['hostedby']) ? instance['hostedby'][i] : instance['hostedby'];
+ if (hostedBy.name && hostedBy.name != "other resources" && hostedBy.name != "Unknown Repository") {
+ downloadNames.add(hostedBy.name);
}
-
- if (this.changeBestAccessMode(available.bestAccessMode, instance['accessright'])) {
- available.bestAccessMode = instance['accessright'].classname;
- /*
- if(title != undefined) {
- if(this.changeBestAccessMode(title['accessMode'], instance['accessright'])) {
- title['accessMode'] = instance['accessright'].classid;
- title['url'] = url;
- }
- }
- */
- if (this.changeBestAccessMode(accessMode, instance['accessright'])) {
- accessMode = instance['accessright'].classname;
+ }
+ available.downloadNames = Array.from(downloadNames);
+
+ if (available.downloadNames.length == 0) {
+ available.downloadNames.push(url.substring(0, 30) + '...'); // substring(from, to);
+ }
+ }
+
+ if (instance.hasOwnProperty("collectedfrom")) {
+ let length = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'].length : 1;
+ for (let i = 0; i < length; i++) {
+ let collectedFrom = Array.isArray(instance['collectedfrom']) ? instance['collectedfrom'][i] : instance['collectedfrom'];
+ if(collectedFrom.name && collectedFrom.id) {
+ available.collectedNamesAndIds.set(collectedFrom.name, collectedFrom.id);
+ }
+ }
+ }
+
+ if (instance.hasOwnProperty("instancetype")) {
+ let types: Set = new Set();
+ let length = Array.isArray(instance['instancetype']) ? instance['instancetype'].length : 1;
+ for (let i = 0; i < length; i++) {
+ let instanceType = Array.isArray(instance['instancetype']) ? instance['instancetype'][i] : instance['instancetype'];
+ if(instanceType.classname && instanceType.classname.toLowerCase() !== "unknown") {
+ types.add(instanceType.classname);
+ }
+ }
+ available.types = Array.from(types);
+ }
+
+ if (instance.hasOwnProperty("dateofacceptance")) {
+ let years: Set = new Set();
+ let length = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'].length : 1;
+ for (let i = 0; i < length; i++) {
+ let dateOfAcceptance = Array.isArray(instance['dateofacceptance']) ? instance['dateofacceptance'][i] : instance['dateofacceptance'];
+ let date: string = (dateOfAcceptance) + ""; // transform to string in case it is an integer
+ years.add((date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date);
+ }
+ available.years = Array.from(years);
+ }
+
+ available['downloadUrl'] = url;
+ if(url.includes("doi.org/")) {
+ this.instanceWithDoiExists = true;
+ }
+
+ if (instance.hasOwnProperty("accessright")) {
+ let length = Array.isArray(instance['accessright']) ? instance['accessright'].length : 1;
+ for (let i = 0; i < length; i++) {
+ let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
+
+ if (this.changeBestAccessMode(available.accessRight, accessRight)) {
+ available.accessRight = accessRight.classname;
+ if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
+ globalAccessRight = accessRight.classname;
}
}
- /*
- if(title != undefined) {
- if(!title['url']) {
- title['url'] = url;
- }
- }
- */
- } else if (url) {
- available['accessMode'].push("");
}
- if (available.bestAccessMode) {
- if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) {
- available.icon = this.open;
- } else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) {
- available.icon = this.unknown;
- } else {
- available.icon = this.closed;
- }
- } else {
- available.icon = this.unknown;
- }
-
- hostedBy_collectedFrom.push(available);
}
-
- return counter;
+
+ if (available.accessRight) {
+ if (available.accessRight.toLowerCase().indexOf('open') !== -1) {
+ available.accessRightIcon = this.open;
+ } else if (available.accessRight.toLowerCase().indexOf('not available') !== -1) {
+ available.accessRightIcon = this.unknown;
+ } else {
+ available.accessRightIcon = this.closed;
+ }
+ } else {
+ available.accessRightIcon = this.unknown;
+ }
+
+ hostedBy_collectedFrom.push(available);
}
// publication & dataset landing : for downloadFrom and publishedIn
diff --git a/landingPages/result/deletedByInference/deletedByInference.service.ts b/landingPages/result/deletedByInference/deletedByInference.service.ts
index 9250c601..03e8537f 100644
--- a/landingPages/result/deletedByInference/deletedByInference.service.ts
+++ b/landingPages/result/deletedByInference/deletedByInference.service.ts
@@ -121,7 +121,7 @@ export class DeletedByInferenceService {
}
if(instance.hasOwnProperty("hostedby")) {
- counter = this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, _result['oaf:result'], url, counter, result.accessMode);
+ this.parsingFunctions.parseHostedBy_collectedFrom(result.hostedBy_collectedFrom, instance, url, result.accessMode);
}
}
}
diff --git a/landingPages/result/resultLanding.component.ts b/landingPages/result/resultLanding.component.ts
index e586c1a5..ccdb08b8 100644
--- a/landingPages/result/resultLanding.component.ts
+++ b/landingPages/result/resultLanding.component.ts
@@ -358,6 +358,7 @@ export class ResultLandingComponent {
return;
}
this.resultLandingInfo = null;
+ this.hasAltMetrics = false;
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
data => {
this.resultLandingInfo = data;
@@ -689,7 +690,9 @@ export class ResultLandingComponent {
|| (resultLandingInfo.description && this.hasKeyword(resultLandingInfo.description,abstract_words))
) &&
((resultLandingInfo.publisher && resultLandingInfo.publisher.toLowerCase() == "zenodo") ||
- resultLandingInfo.hostedBy_collectedFrom.filter( value => {return value.downloadName && value.downloadName.toLowerCase().indexOf("zenodo")!=-1}).length > 0));
+ resultLandingInfo.hostedBy_collectedFrom.filter(value => {
+ return value.downloadNames && value.downloadNames.filter(name => {return name && name.toLowerCase().indexOf("zenodo") != 1}).length > 0
+ }).length > 0));
// console.log("spam content " + allow)
//common titles/ description / authors
let common_titles = ["introduction", "editorial", "book reviews", "preface", "reviews", "none", "book review", "foreword", "conclusion", "review", "reply","einleitung","short notices","erratum","discussion", "letters to the editor","letter to the editor","reviews of books",":{unav)","editorial board"];
diff --git a/landingPages/result/resultLanding.service.ts b/landingPages/result/resultLanding.service.ts
index 2c014a97..700be798 100644
--- a/landingPages/result/resultLanding.service.ts
+++ b/landingPages/result/resultLanding.service.ts
@@ -241,40 +241,58 @@ export class ResultLandingService {
let url;
if(!Array.isArray(instance['webresource'])) {
url = instance['webresource'].url;
- if(url.includes('&')) {
- let regExp = /&/gmu;
- let newUrl = url.replace(regExp, '&');
- url = newUrl;
- }
} else {
url = instance['webresource'][0].url;
- if(url.includes('&')) {
- let regExp = /&/gmu;
- let newUrl = url.replace(regExp, '&');
- url = newUrl;
- }
+ }
+ if(url.includes('&')) {
+ let regExp = /&/gmu;
+ let newUrl = url.replace(regExp, '&');
+ url = newUrl;
}
/**********************************************************/
if(instance.hasOwnProperty("hostedby")) {
- counter = this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, data[0], url, counter/*, this.resultLandingInfo.title*/, this.resultLandingInfo.accessMode);
+ this.parsingFunctions.parseHostedBy_collectedFrom(this.resultLandingInfo.hostedBy_collectedFrom, instance, url, this.resultLandingInfo.accessMode);
}
/**********************************************************/
}
}
+
/* Order Download from via openness*/
this.resultLandingInfo.hostedBy_collectedFrom.sort((a, b) => {
- if(a.bestAccessMode && a.bestAccessMode.toLowerCase() === 'open access') {
- return -1;
- } else if(b.bestAccessMode && b.bestAccessMode.toLowerCase() === 'open access') {
- return 1;
- } else if(!a.bestAccessMode || a.bestAccessMode.toLowerCase() !== 'not available') {
- return 1;
- } else if(!b.bestAccessMode || b.bestAccessMode.toLowerCase() !== 'not available') {
- return -1;
- } else {
+ let firstAccessRight: string = (a.accessRight ? a.accessRight.toLowerCase() : null);
+ let secondAccessRight: string = (b.accessRight ? b.accessRight.toLowerCase() : null);
+
+ if (firstAccessRight === secondAccessRight) {
return 0;
+ } else {
+ if (firstAccessRight === 'open access') {
+ return -1;
+ } else if (secondAccessRight === 'open access') {
+ return 1;
+ } else if (firstAccessRight === "open source") {
+ return -1;
+ } else if (secondAccessRight === "open source") {
+ return 1;
+ } else if (firstAccessRight === "embargo") {
+ return -1;
+ } else if (secondAccessRight === "embargo") {
+ return 1;
+ } else if (firstAccessRight === "restricted") {
+ return -1;
+ } else if (secondAccessRight === "restricted") {
+ return 1;
+ } else if (firstAccessRight === "closed access") {
+ return -1;
+ } else if (secondAccessRight === "closed access") {
+ return 1;
+ } else if (firstAccessRight === "not available") {
+ return -1;
+ } else if (secondAccessRight === "not available") {
+ return 1;
+ }
}
+ return 0;
});
}
diff --git a/utils/result-preview/result-preview.component.html b/utils/result-preview/result-preview.component.html
index 615e6013..dd1ccfcb 100644
--- a/utils/result-preview/result-preview.component.html
+++ b/utils/result-preview/result-preview.component.html
@@ -254,41 +254,29 @@
0"
class="uk-margin-small-bottom download-from">
diff --git a/utils/result-preview/result-preview.ts b/utils/result-preview/result-preview.ts
index a4c2b54b..b1d5d860 100644
--- a/utils/result-preview/result-preview.ts
+++ b/utils/result-preview/result-preview.ts
@@ -3,15 +3,13 @@ import {ResultLandingInfo} from "../entities/resultLandingInfo";
import {OrganizationInfo} from "../entities/organizationInfo";
export interface HostedByCollectedFrom {
- downloadName: string;
- downloadUrl: string[];
- collectedName: string;
- collectedId: string;
- accessMode: string[];
- bestAccessMode: string;
- type: string;
- year: string;
- icon: string
+ downloadNames: string[];
+ downloadUrl: string;
+ collectedNamesAndIds: Map
;
+ accessRight: string;
+ types: string[];
+ years: string[];
+ accessRightIcon: string;
}
export interface Journal {