[Library & Explore | develop]: Added software heritage as pid for research products.
1. environments/: Added in all environments, property: swhURL: "https://archive.softwareheritage.org/". 2. env-properties.ts: Added property swhURL?: string; 3. string-utils.class.ts: Added method "isValidSwhId()" and swhid in checks and definitions. 4. resultLandingInfo.ts: Added swhid in accepted types of interface Id. 5. resultLanding.component.ts: Added check for swhid in "getReferenceIdName()" and "getReferenceUrl()". 6. parsingFunctions.class.ts: Added pid[i].classid == "swhid" check in "parseIdentifiers()". 7. showIdentifiers.component.ts: Added "swhid" in display of pids.
This commit is contained in:
parent
1c5a0b22a8
commit
445441572d
|
@ -514,7 +514,8 @@ export class ParsingFunctions {
|
||||||
let identifiers = new Map<string, string[]>();
|
let identifiers = new Map<string, string[]>();
|
||||||
|
|
||||||
if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
|
if (pid.hasOwnProperty("classid") && pid['classid'] != "") {
|
||||||
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data") {
|
if (pid.classid == "doi" || pid.classid == "pmc" || pid.classid == "handle" || pid.classid == "pmid" || pid.classid == "re3data"
|
||||||
|
|| pid.classid == "swhid") {
|
||||||
if (!identifiers.has(pid.classid)) {
|
if (!identifiers.has(pid.classid)) {
|
||||||
identifiers.set(pid.classid, new Array<string>());
|
identifiers.set(pid.classid, new Array<string>());
|
||||||
}
|
}
|
||||||
|
@ -522,7 +523,8 @@ export class ParsingFunctions {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < pid.length; i++) {
|
for (let i = 0; i < pid.length; i++) {
|
||||||
if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data") {
|
if (pid[i].classid == "doi" || pid[i].classid == "pmc" || pid[i].classid == "handle" || pid[i].classid == "pmid" || pid[i].classid == "re3data"
|
||||||
|
|| pid[i].classid == "swhid") {
|
||||||
if (!identifiers.has(pid[i].classid)) {
|
if (!identifiers.has(pid[i].classid)) {
|
||||||
identifiers.set(pid[i].classid, new Array<string>());
|
identifiers.set(pid[i].classid, new Array<string>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import {properties} from "../../../../environments/environment";
|
||||||
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
|
<span class="uk-text-meta uk-text-small" [class.uk-text-uppercase]="key != 're3data'">{{key}}: </span>
|
||||||
<span [class.uk-margin-small-left]="modal">
|
<span [class.uk-margin-small-left]="modal">
|
||||||
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
|
<ng-container *ngFor="let item of identifiers.get(key) let j=index">
|
||||||
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data'"
|
<a *ngIf="key == 'doi' || key == 'pmc' || key == 'pmid' || key == 'handle' || key == 're3data' || key == 'swhid'"
|
||||||
[href]="getUrl(key) + item" target="_blank" class="uk-display-inline-block custom-external">
|
[href]="getUrl(key) + item" target="_blank" class="uk-display-inline-block custom-external">
|
||||||
{{item}}
|
{{item}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -124,6 +124,8 @@ export class ShowIdentifiersComponent implements AfterViewInit {
|
||||||
return properties.handleURL;
|
return properties.handleURL;
|
||||||
} else if(key == "re3data") {
|
} else if(key == "re3data") {
|
||||||
return properties.r3DataURL;
|
return properties.r3DataURL;
|
||||||
|
} else if(key == "swhid") {
|
||||||
|
return properties.swhURL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -825,6 +825,8 @@ export class ResultLandingComponent {
|
||||||
return this.properties.pmidURL + id.value;
|
return this.properties.pmidURL + id.value;
|
||||||
} else if (id.type === "handle") {
|
} else if (id.type === "handle") {
|
||||||
return this.properties.handleURL + id.value;
|
return this.properties.handleURL + id.value;
|
||||||
|
} else if (id.type === "swhid") {
|
||||||
|
return this.properties.swhURL + id.value;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -839,6 +841,8 @@ export class ResultLandingComponent {
|
||||||
return 'PubMed';
|
return 'PubMed';
|
||||||
} else if (id.type === "handle") {
|
} else if (id.type === "handle") {
|
||||||
return 'Handle.NET';
|
return 'Handle.NET';
|
||||||
|
} else if(id.type == "swhid") {
|
||||||
|
return 'Software Heritage';
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "../result-preview/result-preview";
|
} from "../result-preview/result-preview";
|
||||||
|
|
||||||
export interface Id {
|
export interface Id {
|
||||||
type: "pmid" | "doi" | "pmc" | "handle" | "openaire";
|
type: "pmid" | "doi" | "pmc" | "handle" | "openaire" | "swhid";
|
||||||
value: string;
|
value: string;
|
||||||
trust: number
|
trust: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ export interface EnvProperties {
|
||||||
cordisURL?: string;
|
cordisURL?: string;
|
||||||
openDoarURL?: string;
|
openDoarURL?: string;
|
||||||
r3DataURL?: string;
|
r3DataURL?: string;
|
||||||
|
swhURL?: string;
|
||||||
fairSharingURL?: string,
|
fairSharingURL?: string,
|
||||||
eoscMarketplaceURL?: string,
|
eoscMarketplaceURL?: string,
|
||||||
sherpaURL?: string;
|
sherpaURL?: string;
|
||||||
|
|
|
@ -149,7 +149,7 @@ export class DOI {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Identifier {
|
export class Identifier {
|
||||||
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" = null;
|
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null;
|
||||||
id: string;
|
id: string;
|
||||||
|
|
||||||
public static getDOIsFromString(str: string): string[] {
|
public static getDOIsFromString(str: string): string[] {
|
||||||
|
@ -202,13 +202,15 @@ export class Identifier {
|
||||||
return {"class": "handle", "id": pid};
|
return {"class": "handle", "id": pid};
|
||||||
} else if (Identifier.isValidRe3Data(pid)) {
|
} else if (Identifier.isValidRe3Data(pid)) {
|
||||||
return {"class": "re3data", "id": pid};
|
return {"class": "re3data", "id": pid};
|
||||||
|
} else if (Identifier.isValidSwhId(pid)) {
|
||||||
|
return {"class": "swhid", "id": pid};
|
||||||
}
|
}
|
||||||
//set it as a doi, to catch the case that doi has not valid format
|
//set it as a doi, to catch the case that doi has not valid format
|
||||||
return (strict?null:{"class": "doi", "id": pid});
|
return (strict?null:{"class": "doi", "id": pid});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static getPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
|
public static getPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
|
||||||
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data"];
|
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"];
|
||||||
if(identifiers) {
|
if(identifiers) {
|
||||||
for (let cl of classes) {
|
for (let cl of classes) {
|
||||||
if (identifiers.get(cl)) {
|
if (identifiers.get(cl)) {
|
||||||
|
@ -257,6 +259,12 @@ export class Identifier {
|
||||||
let exp = /(r3d[1-9]\d{0,8})/g;
|
let exp = /(r3d[1-9]\d{0,8})/g;
|
||||||
return str.match(exp) != null;
|
return str.match(exp) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static isValidSwhId(str: string): boolean {
|
||||||
|
// let exp = /swh:1:(snp|rel|rev|dir|cnt):[0-9a-f]{40}/g;
|
||||||
|
let exp = /swh:1:snp:[0-9a-f]{40}/g;
|
||||||
|
return str.match(exp) != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StringUtils {
|
export class StringUtils {
|
||||||
|
|
Loading…
Reference in New Issue