Project

General

Profile

1
export class SearchFields {
2

    
3
    //main Entities
4
    //RESULTS
5
    //Used for datasets and publications and software and orp
6
    //In case Datasets or Software should display  different fields, use seperate tables for fields
7
  // "resultacceptanceyear",
8
    public RESULT_RANGE_FIELDS = [
9
      ["resultacceptanceyear", "resultacceptanceyear"]
10
    ];
11
    public RESULT_REFINE_FIELDS = [
12
      "relfunder",
13
    "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
14
    "relproject",
15
   "resultbestaccessright", "instancetypename", "resultlanguagename", "community","resulthostingdatasource","collectedfrom" ];
16

    
17
     public RESULT_ADVANCED_FIELDS:string[] = ["q","resulttitle","resultauthor", "authorid","resultdescription","resultsubject","resultpublisher",
18
     "resultbestaccessright","community","collectedfromdatasourceid","resulthostingdatasourceid", "resultdateofacceptance",
19
          "relfunder",
20
     "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id",
21
     "resultlanguagename", "relorganizationid", "pid","relprojectid", "instancetypename"];
22
          public RESULT_FIELDS: { [key:string]:FieldDetails}={
23
           ["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", filterType: null},
24
         ["resulttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "=", filterType: null},
25
         ["resultauthor"]:{name:"Author", type:"keyword", param:"author", operator: "at", equalityOperator: "=", filterType: null},
26
         ["authorid"]:{name:"Author ORCID", type:"keyword", param:"orcid", operator: "oc", equalityOperator: " exact ", filterType: null},
27
         ["resultsubject"]:{name:"Subject", type:"keyword", param:"subject", operator: "sb", equalityOperator: "=", filterType: null},
28
         ["resultdescription"]:{name:"Description", type:"keyword", param:"description", operator: "ds", equalityOperator: "=", filterType: null},
29
         ["resultpublisher"]:{name:"Publisher", type:"keyword", param:"publisher", operator: "pb", equalityOperator: "=", filterType: null},
30
         ["pid"]:{name:"PID", type:"keyword", param:"pid", operator: "pd", equalityOperator: " = ", filterType: null},
31
         ["resulthostingdatasourceid"]:{name:"Hosting Content Provider", type:"entity", param:"hostedBy", operator: "hs", equalityOperator: " exact ", filterType: null},
32
         ["resulthostingdatasource"]:{name:"Content Provider", type:"refine", param:"hostedBy", operator: "hs", equalityOperator: " exact ", filterType: "checkbox"},
33
         ["instancetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact ", filterType: "checkbox"},
34
         ["resultlanguagename"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact ", filterType: "checkbox"},
35
         ["community"]:{name:"Community", type:"refine", param:"community", operator: "cm", equalityOperator: " exact ", filterType: "checkbox"},
36
         ["relproject"]:{name:"Project", type:"refine", param:"project", operator: "po", equalityOperator: " exact ", filterType: "checkbox"},
37
         ["relprojectid"]:{name:"Project", type:"entity", param:"project", operator: "po", equalityOperator: " exact ", filterType: null},
38
         ["relfunder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact ", filterType: "checkbox"},
39
         ["relfundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact ", filterType: "checkbox"},
40
         ["relfundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact ", filterType: "checkbox"},
41
         ["relfundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn0", equalityOperator: " exact ", filterType: "checkbox"},
42
         ["resultacceptanceyear"]:{name:"Publication Date", type:"keyword", param:"year", operator: "ya", equalityOperator: " = ", filterType: null},
43
         ["resultdateofacceptance"]:{name:"Publication Date", type:"date", param:"date", operator: "dt", equalityOperator: " within ", filterType: null},
44
         ["resultacceptanceyear-range-resultacceptanceyear"]:{name:"Year range", type:"keyword", param:"year", operator: "ya", equalityOperator: " within ", filterType: "range"},
45
         ["resultbestaccessright"]:{name:"Access Mode", type:"vocabulary", param:"access", operator: "ac", equalityOperator: " exact ", filterType: "radio"},
46
         ["collectedfrom"]:{name:"Collected From", type:"refine", param:"datasource", operator: "cl", equalityOperator: " exact ", filterType: "checkbox"},
47
         ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", filterType: null},
48
         ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", filterType: null},
49
         ["resulttypeid"]:{name:"Result type", type:"refine", param:"types", operator: "tp", equalityOperator: " exact ", filterType: "radio"}
50
                };
51

    
52
      //PROJECT
53
      public PROJECT_RANGE_FIELDS = [
54
        ["projectendyear", "projectstartyear"]
55
      ];
56
      public PROJECT_REFINE_FIELDS:string[] =  ["funder","fundinglevel0_id","fundinglevel1_id",
57
      "fundinglevel2_id","projectstartyear","projectendyear","projectecsc39"];
58
    public PROJECT_ADVANCED_FIELDS:string[] =  ["q","projectacronym","projecttitle","projectkeywords",
59
    "funder",  "fundinglevel0_id","fundinglevel1_id",  "fundinglevel2_id",
60
    "projectstartdate","projectenddate","projectecsc39",
61
    "projectcode_nt","relorganizationid", "collectedfromdatasourceid"];
62
    public PROJECT_FIELDS: { [key:string]:FieldDetails}={
63
       ["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", filterType: null},
64
       ["projectacronym"]:{name:"Acronym", type:"keyword", param:"acronym", operator: "ar", equalityOperator: "=", filterType: null},
65
       ["projecttitle"]:{name:"Title", type:"keyword", param:"title", operator: "tt", equalityOperator: "=", filterType: null},
66
       ["projectkeywords"]:{name:"Keywords", type:"keyword", param:"keywords", operator: "ky", equalityOperator: "=", filterType: null},
67

    
68
       ["funder"]:{name:"Funder", type:"refine", param:"funder", operator: "fn", equalityOperator: " exact ", filterType: "checkbox"},
69
       ["fundinglevel0_id"]:{name:"Funding Stream", type:"refine", param:"funderlv0", operator: "fn0", equalityOperator: " exact ", filterType: "checkbox"},
70
       ["fundinglevel1_id"]:{name:"Funding Substream level 1", type:"refine", param:"funderlv1", operator: "fn1", equalityOperator: " exact ", filterType: "checkbox"},
71
       ["fundinglevel2_id"]:{name:"Funding Substream level 2", type:"refine", param:"funderlv2", operator: "fn2", equalityOperator: " exact ", filterType: "checkbox"},
72
       ["projectstartyear"]:{name:"Start Year", type:"year", param:"startyear", operator: "sy", equalityOperator: " <= ", filterType: "checkbox"},
73
       ["projectendyear"]:{name:"End Year", type:"year", param:"endyear", operator: "ey", equalityOperator: " >= ", filterType: "checkbox"},
74
       ["projectendyear-range-projectstartyear"]:{name:"Active within", type:"year", param:"year", operator: "ya", equalityOperator: " = ", filterType: "range"},
75
      ["projectstartdate"]:{name:"Start Date", type:"date", param:"startdate", operator: "sd", equalityOperator: " within ", filterType: null},
76
       ["projectenddate"]:{name:"End Date", type:"date", param:"enddate", operator: "ed", equalityOperator: " within ", filterType: null},
77
       ["projectecsc39"]:{name:"Special Clause 39", type:"boolean", param:"sc39", operator: "sc", equalityOperator: " exact ", filterType: "radio"},
78
       ["projectcode_nt"]:{name:"Project Code", type:"keyword", param:"code", operator: "cd", equalityOperator: " exact ", filterType: null},
79
       ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", filterType: null},
80
       ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", filterType: null}
81

    
82
     };
83

    
84
       //DATAPROVIDERS
85

    
86
       public DATASOURCE_REFINE_FIELDS:string[] =  ["datasourcetypeuiname", "datasourceodlanguages", "datasourceodcontenttypes",
87
         "datasourcecompatibilityname", "country"];
88
         public DATASOURCE_ADVANCED_FIELDS:string[] = ["q", "datasourceofficialname",
89
         "datasourceenglishname","datasourceodsubjects", "datasourcetypename","datasourceodlanguages",
90
         "datasourceodcontenttypes", "datasourcecompatibilityname","relorganizationid", "collectedfromdatasourceid"];
91

    
92
         public DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
93
              ["q"]:{name:"All fields", type:"keyword", param:"q", operator: "op", equalityOperator: "=", filterType: null},
94
              ["datasourceofficialname"]:{name:"English name", type:"keyword", param:"officialname", operator: "of", equalityOperator: "=", filterType: null},
95
              ["datasourceenglishname"]:{name:"Title", type:"keyword", param:"engname", operator: "eg", equalityOperator: "=", filterType: null},
96
              ["datasourceodsubjects"]:{name:"Subject", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "=", filterType: null},
97
              ["datasourcetypeuiid"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", filterType: null},
98
              ["datasourcetypeuiname"]:{name:"Type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", filterType: "checkbox"},
99
              ["datasourcetypename"]:{name:"Type", type:"vocabulary", param:"type", operator: "tp", equalityOperator: " exact ", filterType: null},
100
              ["datasourceodlanguages"]:{name:"Language", type:"vocabulary", param:"lang", operator: "ln", equalityOperator: " exact ", filterType: "checkbox"},
101
              ["datasourceodcontenttypes"]:{name:"Content", type:"refine", param:"content", operator: "cn", equalityOperator: " exact ", filterType: "checkbox"},
102
              ["datasourcecompatibilityid"]:{name:"Compatibility Level", type:"refine", param:"compatibility", operator: "cm", equalityOperator: " exact ", filterType: null},
103
              ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact ", filterType: "checkbox"},
104
              ["relorganizationid"]:{name:"Organization", type:"entity", param:"organization", operator: "og", equalityOperator: " exact ", filterType: null},
105
              ["collectedfromdatasourceid"]:{name:"Collected from Content Provider", type:"entity", param:"collectedFrom", operator: "cl", equalityOperator: " exact ", filterType: null},
106
              ["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", filterType: "checkbox"}
107
            };
108

    
109
  public DEPOSIT_DATASOURCE_KEYWORD_FIELDS: { "name": string, "equalityOperator": string} []= [
110
      {"name": "relorganizationname", "equalityOperator": "="},
111
      {"name": "relorganizationshortname", "equalityOperator": "="},
112
      {"name": "datasourceofficialname", "equalityOperator": "="},
113
      {"name": "datasourceenglishname", "equalityOperator": "="},
114
      {"name": "datasourcetypeuiname", "equalityOperator": " exact "},
115
      {"name": "country", "equalityOperator": " exact "},
116
      {"name": "datasourcesubject", "equalityOperator": " all "}
117
  ];
118
  public DEPOSIT_DATASOURCE_REFINE_FIELDS:string[] =  ["datasourcetypeuiname", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
119

    
120
  public DEPOSIT_DATASOURCE_FIELDS: { [key:string]:FieldDetails}={
121
    ["datasourcetypeuiname"]:{name:"Repository type", type:"refine", param:"type", operator: "tp", equalityOperator: " exact ", filterType: "radio"},
122
    ["country"]:{name:"Countries", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", filterType: "checkbox"},
123
    ["datasourceodsubjects"]:{name:"Subjects", type:"keyword", param:"subjects", operator: "sb", equalityOperator: "=", filterType: "checkbox"},
124
    ["datasourceodcontenttypes"]:{name:"Content type", type:"refine", param:"content", operator: "cn", equalityOperator: " exact ", filterType: "checkbox"},
125
    ["datasourcecompatibilityname"]:{name:"Compatibility Level", type:"vocabulary", param:"compatibility", operator: "cm", equalityOperator: " exact ", filterType: "checkbox"},
126
  };
127

    
128
          public COMPATIBLE_DATAPROVIDER_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
129
          public ENTITY_REGISTRIES_FIELDS:string[] = ["datasourcetypename","datasourcecompatibilityname"];
130
          public JOURNAL_FIELDS:string[] = ["datasourcetypeuiid","datasourcecompatibilityname"];
131

    
132
         //ORGANIZATION
133

    
134
         public ORGANIZATION_REFINE_FIELDS:string[] = ["country"]
135
     public ORGANIZATION_ADVANCED_FIELDS:string[] = ["q", "organizationlegalname","organizationlegalshortname","country"];
136

    
137
     public ORGANIZATION_FIELDS: { [key:string]:FieldDetails}={
138
                ["q"]:{name:"All fields", type:"keyword", param:"q", operator:"op", equalityOperator: "=", filterType: null},
139
                ["organizationlegalname"]:{name:"Legal Name", type:"keyword", param:"name", operator: "nm", equalityOperator: "=", filterType: null},
140
                ["organizationlegalshortname"]:{name:"Legal Short Name", type:"keyword", param:"shortname", operator: "so", equalityOperator: "=", filterType: null},
141
                ["country"]:{name:"Country", type:"vocabulary", param:"country", operator: "cu", equalityOperator: "=", filterType: "checkbox"},
142
              };
143
        //  public ORGANIZATION_INDEX:string[] = ["organizationcountryname"]//,"organizationeclegalbody"];
144
        // public ADVANCED_SEARCH_ORGANIZATION_PARAM:string[] = ["q","contenttype","compatibility","country","type"];
145
          //  public ORGANIZATION_INDEX_PARAM_MAP:{ [key:string]:string } = {["organizationlegalname"]:"contenttype", ["organizationlegalshortname"]:"type",
146
          //   ["organizationcountryname"]:"country"};//,["organizationeclegalbody"]:"type"};
147
          // public ORGANIZATION_FIELDS_MAP: { [key:string]:{ name:string, operator:string, type:string, indexField:string , operator: "op", equalityOperator:string}} ={
148
          // ["q"]:{name:"All fields",operator:"op", type:"keyword", indexField:null, operator: "op", equalityOperator: "="},
149
          // ["contenttype"]:{name:"Legal Name",operator:"cn", type:"keyword" , indexField:"organizationlegalname", operator: "op", equalityOperator: "="},
150
          // ["compatibility"]:{name:"Legal Short Name",operator:"cm", type:"keyword", indexField:"organizationlegalshortname", operator: "op", equalityOperator: "="},
151
          // ["country"]:{name:"Country",operator:"cu", type:"vocabulary", indexField:"organizationcountryname", operator: "op", equalityOperator: " exact "},
152
          // ["type"]:{name:"Type",operator:"tp", type:"refine", indexField:"organizationeclegalbody", operator: "op", equalityOperator: " exact "},
153
          //
154
          // };
155

    
156

    
157

    
158
     public HIDDEN_FIELDS:string[] = ["fundinglevel0_id","fundinglevel1_id","fundinglevel2_id",
159
     "relfundinglevel0_id","relfundinglevel1_id","relfundinglevel2_id"];
160

    
161
     public DEPENDENT_FIELDS: { [key:string]:string } = {["fundinglevel0_id"]:"funder",
162
     ["fundinglevel1_id"]:"fundinglevel0_id", ["fundinglevel2_id"]:"fundinglevel1_id", ["relfundinglevel0_id"]:"relfunder",
163
     ["relfundinglevel1_id"]:"relfundinglevel0_id", ["relfundinglevel2_id"]:"relfundinglevel1_id"};
164

    
165

    
166
      public ADVANCED_SEARCH_OPERATORS:{name:string, id:string}[] = [{name:"AND",id:"and"},{name:"OR",id:"or"},{name:"NOT",id:"not"}];
167

    
168
      public COMMUNITIES_SEARCH_FIELDS:string[] = ["type","status","role"];
169
     constructor (){
170
     }
171
     getFieldName(fieldId:string,fieldType:string):string{
172
       if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result"){
173
         return this.RESULT_FIELDS[fieldId].name;
174
       }else if(fieldType == "project"){
175
         return this.PROJECT_FIELDS[fieldId].name;
176
       }else if(fieldType == "organization"){
177
         return this.ORGANIZATION_FIELDS[fieldId].name;
178
       }else if(fieldType == "datasource" || fieldType == "dataprovider"){
179
         return this.DATASOURCE_FIELDS[fieldId].name;
180
       }else{
181
         return "UNDEFINED";
182
       }
183
     }
184

    
185
    getFieldFilterType(fieldId:string, fieldType:string, usedBy:string="search"):string{
186
      if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other"|| fieldType == "result"){
187
        return this.RESULT_FIELDS[fieldId].filterType;
188
      }else if(fieldType == "project"){
189
        return this.PROJECT_FIELDS[fieldId].filterType;
190
      }else if(fieldType == "organization"){
191
        return this.ORGANIZATION_FIELDS[fieldId].filterType;
192
      }else if(fieldType == "datasource" || fieldType == "dataprovider"){
193
        if(usedBy == "search") {
194
          return this.DATASOURCE_FIELDS[fieldId].filterType;
195
        } else if(usedBy == "deposit") {
196
          return this.DEPOSIT_DATASOURCE_FIELDS[fieldId].filterType;
197
        }
198
      }else{
199
        return "checkbox";
200
      }
201
    }
202

    
203
  getFieldParam(fieldId:string,fieldType:string):string{
204
    if(fieldType == "publication" || fieldType == "dataset" || fieldType == "software" || fieldType == "other" || fieldType == "result"){
205
      return this.RESULT_FIELDS[fieldId].param;
206
    }else if(fieldType == "project"){
207
      return this.PROJECT_FIELDS[fieldId].param;
208
    }else if(fieldType == "organization"){
209
      return this.ORGANIZATION_FIELDS[fieldId].param;
210
    }else if(fieldType == "datasource" || fieldType == "dataprovider"){
211
      return this.DATASOURCE_FIELDS[fieldId].param;
212
    }else{
213
      return "UNDEFINED";
214
    }
215
  }
216

    
217
/*
218
AND
219
  Funder: relfunder, relfundinglevel0_id, relfundinglevel1_id, relfundinglevel2_id
220
  Project: relproject
221
  Community: community
222
OR
223
  Type: instancetypename, datasourcetypeuiname
224
  Language: resultlanguagename, datasourceodlanguages
225
  Compatibility Level: datasourcecompatibilityname
226
  Country: country
227
  Content: datasourceodcontenttypes
228
  Content Provider: resulthostingdatasource
229
  Collected From: collectedfrom
230
BULLETS
231
  Access Mode: resultbestaccessright
232
  Special Clause 39: projectecsc39
233
  Versioning:
234

    
235
RANGE
236
  Publication date: resultacceptanceyear
237
  Project life: projectstartyear, projectendyear
238

    
239
? WHAT ABOUT ?:
240
  Subjects:
241
  Supported Identifiers:
242
*/
243

    
244
  getFieldOperator(fieldId:string):string{
245
     if(fieldId == "relfunder" || fieldId == "relfundinglevel0_id" || fieldId == "relfundinglevel1_id" || fieldId == "relfundinglevel2_id"
246
       || fieldId == "relproject" || fieldId == "community" || fieldId == "projectendyear-range-projectstartyear") {
247
       return "and";
248
     } else if(fieldId == "instancetypename" || fieldId == "datasourcetypeuiname"
249
       || fieldId == "resultlanguagename" || fieldId == "datasourceodlanguages"
250
       || fieldId == "datasourcecompatibilityname" || fieldId == "country" || fieldId == "datasourceodcontenttypes"
251
       || fieldId == "resulthostingdatasource" || fieldId == "collectedfrom") {
252
       return "or";
253
     }
254
     return "or";
255
  }
256
}
257
export class FieldDetails{
258
   name:string;
259
     type:string;
260
      param:string;
261
       equalityOperator:string;
262
       operator:string;
263
       filterType: string = "checkbox";
264
 }
(5-5/5)