[develop | DONE | ADDED]: Added search organizations by PID (ror, isni, wikidata, fundRef).

1. string-utils.class.ts: Added methods "isValidRor()", "isValidIsni()", "isValidWikidata()", "isValidFundRef()" and cases for these new identifiers.
2. newSearchPage.component.ts: In method "createKeywordQuery()", check for PIDs also for organizations entity.
3. environment.ts: Updated property "fundRefURL" to "https://data.crossref.org/fundingdata/funder/" (old: https://api.crossref.org/funders/).
This commit is contained in:
Konstantina Galouni 2024-04-02 10:59:33 +03:00
parent 828dfc0671
commit 78d262dd3b
3 changed files with 36 additions and 5 deletions

View File

@ -1085,7 +1085,7 @@ export class NewSearchPageComponent implements OnInit, OnDestroy, OnChanges {
let params = "";
let doisParams = "";
var DOIs: Identifier[] = Identifier.getIdentifiersFromString(value);
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service")) {
if ((entityType == 'publication' || entityType == 'dataset' || entityType == 'software' || entityType == 'other' || entityType == "result" || entityType == "dataprovider" || entityType == "service" || entityType == "organization")) {
for (let identifier of DOIs) {
// console.log(identifier)
// pidclassid exact \"doi\" and pid exact \"10.1016/j.nima.2015.11.134\"

View File

@ -23,7 +23,7 @@ export let common: EnvProperties = {
rorURL: "https://ror.org/",
isniURL: "https://isni.org/isni/",
wikiDataURL: "https://www.wikidata.org/wiki/",
fundRefURL: "https://api.crossref.org/funders/",
fundRefURL: "https://data.crossref.org/fundingdata/funder/",
fairSharingURL: "https://fairsharing.org/",
eoscMarketplaceURL: "https://marketplace.eosc-portal.eu/services/",
sherpaURL: "http://sherpa.ac.uk/romeo/issn/",

View File

@ -150,7 +150,7 @@ export class DOI {
}
export class Identifier {
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" = null;
class: "doi" | "pmc" | "pmid" | "handle" | "ORCID" | "re3data" | "swhid" | "ror" | "wikidata" | "fundref" | "isni" = null;
id: string;
public static getDOIsFromString(str: string): string[] {
@ -205,14 +205,22 @@ export class Identifier {
return {"class": "re3data", "id": pid};
} else if (Identifier.isValidSwhId(pid)) {
return {"class": "swhid", "id": pid};
} else if (Identifier.isValidRor(pid)) {
return {"class": "ror", "id": pid};
} else if (Identifier.isValidFundRef(pid)) {
return {"class": "fundref", "id": pid};
} else if (Identifier.isValidWikidata(pid)) {
return {"class": "wikidata", "id": pid};
} else if (Identifier.isValidIsni(pid)) {
return {"class": "isni", "id": pid};
}
//set it as a doi, to catch the case that doi has not valid format
return (strict?null:{"class": "doi", "id": pid});
}
public static getPIDFromIdentifiers(identifiers: Map<string, string[]>): Identifier {
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid"];
if(identifiers) {
let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data", "swhid", "ror", "wikidata", "fundref", "isni"];
if(identifiers && identifiers.size > 0) {
for (let cl of classes) {
if (identifiers.get(cl)) {
for (let pid of identifiers.get(cl)) {
@ -258,6 +266,7 @@ export class Identifier {
}
public static isValidHANDLE(str: string): boolean {
// let exp = /\b[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g; // resolve with url - need to add method for raw value
let exp = /^[0-9a-zA-Z-]*\/[0-9a-zA-Z-]*$/g;
return str.match(exp) != null;
}
@ -272,6 +281,28 @@ export class Identifier {
let exp = /swh:1:snp:[0-9a-f]{40}/g;
return str.match(exp) != null;
}
public static isValidRor(str: string): boolean {
let exp = /0[a-z|0-9]{6}[0-9]{2}\b/g;
return str.match(exp) != null;
}
public static isValidIsni(str: string): boolean {
let exp = /^[0]{7}[0-9]{8}[0-9X]$/g;
return str.match(exp) != null;
}
public static isValidWikidata(str: string): boolean {
let exp = /^Q\d+$/g;
return str.match(exp) != null;
}
public static isValidFundRef(str: string): boolean {
// let exp = /aaa/g;
let exp = /^[1-9]\d+$/g;
return str.match(exp) != null;
}
}
export class StringUtils {