Project

General

Profile

1 61381 k.triantaf
import {Filter, Value} from "./searchHelperClasses.class";
2
import {SearchFields} from "../../utils/properties/searchFields";
3
4
export class DatasourcesHelperClass {
5
6
  public static getrefineFields(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
7
    let searchFields:SearchFields = new SearchFields();
8
    if (type == "registries") {
9
      return searchFields.ENTITY_REGISTRIES_FIELDS;
10
    } else if (type == "journals") {
11
      return searchFields.JOURNAL_FIELDS;
12
13
    } else if (type == "compatible") {
14
      return searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
15
    } else if (type == "deposit") {
16
      return searchFields.DEPOSIT_DATASOURCE_REFINE_FIELDS;
17
    } else {
18
      return searchFields.DATASOURCE_REFINE_FIELDS;
19
    }
20
  }
21
22
  public static getTitle(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
23
    if (type == "registries") {
24
      return "Entity Registries"
25
    } else if (type == "journals") {
26
      return "Journals"
27
    } else if (type == "compatible") {
28
      return "Compatible Content Providers";
29
    } else {
30
      return "Content Providers"
31
    }
32
  }
33
  public static getDescription(type: "all" | "registries" | "journals" | "compatible" | "deposit") {
34
    if (type == "registries") {
35
      return ["Entity Registries","Discover research Entity Registries.","For each entity are available description and the research projects managed. Categorized by type and OpenAIRE compatibility level."];
36
    } else if (type == "journals") {
37
      return ["Research journals","Discover research Journals. ","For each entity are available description, subjects, related content providers, publications and research outcomes per year and type."];
38
    } else if (type == "compatible") {
39
      return ["research repositories", "Discover publication, data, software, istitutional and thematic repositories.","Available repository research outcomes per year and type."];
40
    } else {
41
      return ["Content providers","Discover worldwide research content providers and correlated research.","Statistics data about produced research outocomes per year available."];
42
    }
43
  }
44
  public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
45
    if (type == "registries") {
46
      return ' datasourcetypeuiid = other ';
47
    } else if (type == "journals") {
48
      // return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
49
      return 'oaftype exact datasource  not datasourcecompatibilityid = notCompatible and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
50
51
    } else if (type == "compatible") {
52
      return ' oaftype exact datasource  and datasourcecompatibilityid <> notCompatible  and datasourcetypeuiid <> other and datasourcetypeuiid <> "pubsrepository::journal" and datasourcetypeuiid <> "aggregator::pubsrepository::journals" ';
53
    }else if (type == "deposit") {
54
      return ' oaftype exact datasource  ';
55
    } else {
56
      return "";
57
    }
58
  }
59
60
  public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
61
    if (type == "registries") {
62
      return this.createRegistriesFilters();
63
    } else if (type == "journals") {
64
      return this.createJournalFilters();
65
    } else if (type == "compatible") {
66
      return this.createCompatibleFilters();
67
    } else {
68
      return [];
69
    }
70
  }
71
72
  private static createCompatibleFilters(): Filter[] {
73
    var filter_names = ["Type", "Compatibility Level"];
74
    var filter_ids = ["datasourcetypeuiid", "datasourcecompatibilityname"];
75
    var searchFields = new SearchFields();
76
    var filter_original_ids = searchFields.COMPATIBLE_DATAPROVIDER_FIELDS;
77
    var value_names = [
78
79
      [
80
        "Institutional Repository", "Thematic Repository", "Publication Repository",
81
        "Institutional Repository Aggregator",
82
        "Thematic Repository Aggregator", "Publication Repository Aggregator",
83
        "Data Repository", "Data Repository Aggregator", "CRIS System", "Publication Catalogue",
84
        "Software Repository", "Software Repository Aggregator"],
85
      ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE 4.0 (inst.&thematic. repo.)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
86
        "collected from a compatible aggregator", "proprietary", "under validation"]];
87
//{"englishName":"OpenAIRE 4.0 (inst.&thematic. repo.)","nativeName":"OpenAIRE 4.0 (inst.&thematic. repo.)","encoding":"OPENAIRE","code":"openaire4.0","synonyms":null}
88
    var value_original_ids = [
89
      ["pubsrepository::institutional", "pubsrepository::thematic", "pubsrepository::unknown", "aggregator::pubsrepository::institutional", "aggregator::pubsrepository::thematic", "aggregator::pubsrepository::unknown",
90
        "datarepository::unknown", "aggregator::datarepository", "crissystem", "pubscatalogue::unknown", "softwarerepository", "aggregator::softwarerepository"],
91
      //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
92
      ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)","OpenAIRE 4.0 (inst.&thematic. repo.)", "OpenAIRE Data (funded, referenced datasets)", "OpenAIRE CRIS v1.1",
93
        "collected from a compatible aggregator", "proprietary", "under validation"]];
94
    var filters: Filter[] = [];
95
    for (var i = 0; i < filter_names.length; i++) {
96
      var values: Value[] = [];
97
      for (var j = 0; j < value_names[i].length; j++) {
98
        var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false}
99
        values.push(value);
100
      }
101
      var filter: Filter = {
102
        title: filter_names[i],
103
        filterId: filter_ids[i],
104
        originalFilterId: filter_original_ids[i],
105
        values: values,
106
        countSelectedValues: 0,
107
        "filterOperator": 'or',
108
        valueIsExact: true,
109
        filterType: "checkbox"
110
      };
111
      filters.push(filter);
112
    }
113
    return filters;
114
  }
115
116
  private static createRegistriesFilters(): Filter[] {
117
    var filter_names = ["Type", "Compatibility Level"];
118
    var filter_ids = ["datasourcetypename", "datasourcecompatibilityname"];
119
    var searchFields = new SearchFields();
120
    var filter_original_ids = searchFields.ENTITY_REGISTRIES_FIELDS;
121
    var value_names = [
122
      ["Funder", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"],
123
124
      ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
125
        "collected from a compatible aggregator", "proprietary", "under validation"]];
126
127
    var value_original_ids = [
128
      ["Funder database", "Registry of repositories", "Scholarly Comm. Infrastructure", "Registry", "Information Space", "Web Source"],
129
      //["entityregistry::projects","entityregistry::repositories","scholarcomminfra","entityregistry","infospace","websource"],
130
      //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
131
      ["OpenAIRE Basic (DRIVER OA)", "OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)", "OpenAIRE Data (funded, referenced datasets)",
132
        "collected from a compatible aggregator", "proprietary", "under validation"]];
133
134
    var filters: Filter[] = [];
135
    for (var i = 0; i < filter_names.length; i++) {
136
      var values: Value[] = [];
137
      for (var j = 0; j < value_names[i].length; j++) {
138
        var value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false}
139
        values.push(value);
140
      }
141
      var filter: Filter = {
142
        title: filter_names[i],
143
        filterId: filter_ids[i],
144
        originalFilterId: filter_original_ids[i],
145
        values: values,
146
        countSelectedValues: 0,
147
        "filterOperator": 'or',
148
        valueIsExact: true,
149
        filterType: "checkbox"
150
      };
151
      filters.push(filter);
152
    }
153
    return filters;
154
  }
155
156
157
  private static createJournalFilters():Filter[] {
158
    var filter_names=["Type","Compatibility Level"];
159
    var filter_ids=["datasourcetypeuiid","datasourcecompatibilityname"];
160
    var searchFields = new SearchFields();
161
    var filter_original_ids = searchFields.JOURNAL_FIELDS;
162
    var value_names=[
163
      /*[
164
      "Institutional Publication Repository","Thematic Publication Repository", "Other Publication Repository",
165
     "Institutional Repositories Aggregators",
166
     "Thematic Repositories Aggregators", "Other Repositories Aggregators",
167
      "Data Repositories", "Data Repositories Aggregators", "Journals", "Journals Aggregators", "CRIS Systems", "Publication Catalogues"],
168
      */
169
      ["Journal", "Journal Aggregator\/Publisher"],
170
      ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
171
        "collected from a compatible aggregator", "proprietary", "under validation"]];
172
173
    var value_original_ids=[
174
      ["pubsrepository::journal", "aggregator::pubsrepository::journals"],
175
      //["driver","openaire2.0", "driver-openaire2.0", "openaire3.0","openaire2.0_data"]
176
      ["OpenAIRE Basic (DRIVER OA)","OpenAIRE 2.0 (EC funding)", "OpenAIRE 2.0+ (DRIVER OA, EC funding)", "OpenAIRE 3.0 (OA, funding)", "OpenAIRE 4.0 (inst.&thematic. repo.)","OpenAIRE Data (funded, referenced datasets)",
177
        "collected from a compatible aggregator", "proprietary", "under validation"]];
178
    var filters: Filter[] =[];
179
    for(var i =0 ; i < filter_names.length;i++){
180
      var values:Value[] = [];
181
      for(var j =0 ; j < value_names[i].length;j++){
182
        var value:Value = {name: value_names[i][j], id: value_original_ids[i][j], number:0, selected:false}
183
        values.push(value);
184
      }
185
      var filter:Filter = {title: filter_names[i], filterId: filter_ids[i], originalFilterId:  filter_original_ids[i], values : values, countSelectedValues:0, "filterOperator": 'or', valueIsExact: true, filterType: "checkbox" };
186
      filters.push(filter);
187
    }
188
    return filters;
189
  }
190
191
192
}