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
                };
50

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

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

    
81
     };
82

    
83
       //DATAPROVIDERS
84

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

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

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

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

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

    
131
         //ORGANIZATION
132

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

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

    
155

    
156

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

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

    
164

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

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

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

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

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

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

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

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