openaire-library/utils/properties/searchFields.ts

160 lines
13 KiB
TypeScript
Raw Normal View History

export class SearchFields {
//main Entities
//RESULTS
//Used for datasets and publications and software and orp
//In case Datasets or Software should display different fields, use seperate tables for fields
public RESULT_REFINE_FIELDS = [
"relfunder",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"relproject","resultacceptanceyear",
"resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource"];
public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","resultauthor","resultsubject","resultpublisher",
"resultbestaccessright","community","collectedfromdatasourceid","resulthostingdatasourceid", "resultdateofacceptance",
"relfunder",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
"resultlanguagename", "relorganizationid", "pid","relprojectid", "instancetypename"];
public RESULT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["resulttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "="},
["resultauthor"]:{name:"Author", type:"keyword", param:"author", operator: "at", equalityOperator: "="},
["resultsubject"]:{name:"Subject", type:"keyword", param:"subject", operator: "sb", equalityOperator: "="},
["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", operator: "pb", equalityOperator: "="},
["pid"]:{name:"PID", type:"keyword", param:"pid", operator: "pd", equalityOperator: " = "},
["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", operator: "hs", equalityOperator: " exact "},
["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", operator: "hs", equalityOperator: " exact "},
["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact "},
["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact "},
["community"]:{name:"Community", type:"refine", param:"community", operator: "cm", equalityOperator: " exact "},
["relproject"]:{name:"Project", type:"refine", param:"project", operator: "po", equalityOperator: " exact "},
["relprojectid"]:{name:"Project", type:"entity", param:"project", operator: "po", equalityOperator: " exact "},
["relfunder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact "},
["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact "},
["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact "},
["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn0", equalityOperator: " exact "},
["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", operator: "ya", equalityOperator: " exact "},
["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", operator: "dt", equalityOperator: " within "},
["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", operator: "ac", equalityOperator: " exact "},
["collectedfrom"]:{name:"Content Provider", type:"refine", param:"datasource", operator: "cl", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "}
};
//PROJECT
public PROJECT_REFINE_FIELDS:string[] = ["funder","fundinglevel0_id","fundinglevel1_id",
"fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
public PROJECT_ADVANCED_FIELDS:string[] = ["q","projectacronym","projecttitle","projectkeywords",
"funder", "fundinglevel0_id","fundinglevel1_id", "fundinglevel2_id",
"projectstartdate","projectenddate","projectecsc39",
"projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
public PROJECT_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", operator: "ar", equalityOperator: "="},
["projecttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "="},
["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", operator: "ky", equalityOperator: "="},
["funder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact "},
["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact "},
["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact "},
["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn2", equalityOperator: " exact "},
["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", operator: "sy", equalityOperator: " exact "},
["projectendyear"]:{name:"End Year", type:"year", param:"endyear", operator: "ey", equalityOperator: " exact "},
["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", operator: "sd", equalityOperator: " within "},
["projectenddate"]:{name:"End Date", type:"date", param:"enddate", operator: "ed", equalityOperator: " within "},
["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", operator: "sc", equalityOperator: " exact "},
["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", operator: "cd", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "}
};
//DATAPROVIDERS
public DATASOURCE_REFINE_FIELDS:string[] = ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
"datasourcecompatibilityname"];
public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
"datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
"datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "="},
["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", operator: "of", equalityOperator: "="},
["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", operator: "eg", equalityOperator: "="},
["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "="},
["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact "},
["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact "},
["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", operator: "cn", equalityOperator: " exact "},
["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", operator: "cm", equalityOperator: " exact "},
["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact "},
["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact "},
["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact "}
};
public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
//ORGANIZATION
public ORGANIZATION_REFINE_FIELDS:string[] = ["organizationcountryname"]
public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","organizationcountryname"];
public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
["q"]:{name:"All fields", type:"keyword", param:"q", operator:"op", equalityOperator: "="},
["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", operator: "nm", equalityOperator: "="},
["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", operator: "so", equalityOperator: "="},
["organizationcountryname"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "="},
};
// public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
// public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
// public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
// ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
// public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , operator: "op", equalityOperator:string}} ={
// ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, operator: "op", equalityOperator: "="},
// ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", operator: "op", equalityOperator: "="},
// ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", operator: "op", equalityOperator: "="},
// ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", operator: "op", equalityOperator: " exact "},
// ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", operator: "op", equalityOperator: " exact "},
//
// };
public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
"relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
public ADVANCED_SEARCH_OPERATORS:[{name:string, id:string}] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
constructor (){
}
getFieldName(fieldId:string,fieldType:string):string{
if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other"){
return this.RESULT_FIELDS[fieldId].name;
}else if(fieldType == "project"){
return this.PROJECT_FIELDS[fieldId].name;
}else if(fieldType == "organization"){
return this.ORGANIZATION_FIELDS[fieldId].name;
}else if(fieldType == "datasource" || fieldType == "dataprovider"){
return this.DATASOURCE_FIELDS[fieldId].name;
}else{
return "UNDEFINED";
}
}
}
export class FieldDetails{
name:string;
type:string;
param:string;
equalityOperator:string;
operator:string;
}