Project

General

Profile

1
import {Injectable} from '@angular/core';
2
import {Http, Response} from '@angular/http';
3
import {HttpClient} from "@angular/common/http";
4
import {Observable}     from 'rxjs';
5
import {SearchResult}     from '../utils/entities/searchResult';
6
import {RefineResultsUtils} from './servicesUtils/refineResults.class';
7

    
8

    
9

    
10
import {StringUtils} from '../utils/string-utils.class';
11
import{EnvProperties} from '../utils/properties/env-properties';
12
import {map} from "rxjs/operators";
13

    
14
@Injectable()
15
export class SearchDataprovidersService {
16
    private sizeOfDescription: number = 270;
17

    
18
    constructor(private http: HttpClient ) {}
19

    
20
    searchDataproviders (params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties, usedBy: string="search" ):any {
21
        let link = properties.searchAPIURLLAst+"datasources";
22

    
23
        let url = link+"?";
24
        if(params!= null && params != ''  ) {
25
            url += params;
26
        }
27
        if(refineParams!= null && refineParams != ''  ) {
28
            url += refineParams;
29
        }
30
        url += "&page="+(page-1)+"&size="+size+"&format=json";
31

    
32

    
33
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
34
                    //.map(res => <any> res.json())
35
                    //.do(res => console.info(res))
36
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource", usedBy)]));
37
    }
38
    //((oaftype exact datasource) and(collectedfromdatasourceid exact "openaire____::47ce9e9f4fad46e732cff06419ecaabb"))
39
    advancedSearchDataproviders (params: string, page: number, size: number, properties: EnvProperties, refineParams:string=null,  refineFields:string[] =null, refineQuery:string = null, depositQuery:boolean = false  ):any {
40
      let url =  properties.searchAPIURLLAst+"resources"+(depositQuery?'':2)+"/?format=json";
41

    
42
      if(params!= null && params != ''  ) {
43
        url +="&query=(" + params + ")";
44

    
45
      }
46
      if(refineParams!= null && refineParams != ''  ) {
47
        url += refineParams;
48
      }
49
      if(refineQuery) {
50
        url += "&" + refineQuery;
51
      }
52
      url += "&page="+(page-1)+"&size="+size;
53

    
54
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
55
      //.map(res => <any> res.json())
56
      //.do(res => console.info(res))
57
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
58
    }
59

    
60
    searchCompatibleDataprovidersTable ( properties:EnvProperties):any {
61
      let size: number = 0;
62
      let url: string= properties.searchResourcesAPIURL;
63
      url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
64
      url += "&page=0&size=0&format=json";
65

    
66

    
67

    
68
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
69
                      //.map(res => <any> res.json())
70
                      .pipe(map(res => res['meta'].total));
71
    }
72

    
73
    searchCompatibleDataproviders (params: string,refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
74
      let url: string = properties.searchResourcesAPIURL;
75
      url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
76
      if(params!= null && params != ''  ) {
77
        url += params;
78
      }
79
      if(refineParams!= null && refineParams != ''  ) {
80
        url += refineParams;
81
      }
82
      url += "&page="+(page-1)+"&size="+size+"&format=json";
83

    
84
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
85
      //.map(res => <any> res.json())
86
      //.do(res => console.info(res))
87
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
88
    }
89

    
90
    searchEntityRegistriesTable (properties:EnvProperties):any {
91
      let size: number = 0;
92
      let url: string= properties.searchResourcesAPIURL;
93
      url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
94
      url += "&page=0&size=0&format=json";
95

    
96

    
97

    
98
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
99
                      //.map(res => <any> res.json())
100
                      .pipe(map(res => res['meta'].total));
101
    }
102

    
103
    searchEntityRegistries (params: string,refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties ):any {
104
      let url = properties.searchResourcesAPIURL;
105
      url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
106
      if(params!= null && params != ''  ) {
107
        url += params;
108
      }
109
      if(refineParams!= null && refineParams != ''  ) {
110
        url += refineParams;
111
      }
112
      url += "&page="+(page-1)+"&size="+size+"&format=json";
113

    
114
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
115
      //.map(res => <any> res.json())
116
      //.do(res => console.info(res))
117
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
118
    }
119

    
120
    searchJournalsTable ( properties:EnvProperties):any {
121
      let size: number = 0;
122
      let url: string= properties.searchResourcesAPIURL;
123
      url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
124
      url += "&page=0&size=0&format=json";
125

    
126
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)//.map(res => <any> res.json())
127
                        .pipe(map(res => res['meta'].total));
128
    }
129

    
130
    searchJournals (params: string,refineParams:string, page: number, size: number, refineFields:string[] , properties:EnvProperties):any {
131
      let url: string = properties.searchResourcesAPIURL;
132
      //url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
133
      url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
134

    
135
      if(params!= null && params != ''  ) {
136
        url += params;
137
      }
138
      if(refineParams!= null && refineParams != ''  ) {
139
        url += refineParams;
140
      }
141
      url += "&page="+(page-1)+"&size="+size+"&format=json";
142

    
143
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
144
      //.map(res => <any> res.json())
145
      //.do(res => console.info(res))
146
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results']),RefineResultsUtils.parse(res['refineResults'],refineFields, "datasource")]));
147
    }
148

    
149
    searchDataprovidersForDeposit (id: string,type:string, page: number, size: number, properties:EnvProperties):any {
150
        let link = properties.searchResourcesAPIURL;
151
        var compatibilities = "";
152
        if(type == "Research Data"){
153
          //compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
154
          compatibilities = " and (datasourcecompatibilityid = openaire2.0_data)";
155
        }else if(type == "Publications"){
156
          //compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
157
          compatibilities = " and (datasourcecompatibilityid <> openaire2.0_data)";
158
        }
159
        let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+compatibilities+" ":"")+") and (relorganizationid exact \""+id+"\")";
160
        url += "&page="+(page-1)+"&size="+size+"&format=json";
161

    
162

    
163
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
164
                    //.map(res => <any> res.json())
165
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
166
    }
167

    
168
    searchDataprovidersForDepositSearch(params: string, refineParams:string, page: number, size: number, refineFields:string[], properties:EnvProperties, usedBy: string="search" ):any {
169
    let link = properties.searchResourcesAPIURL;
170
      let url = link+"?query=((deletedbyinference = false) AND (oaftype exact datasource)) "+params;
171
      if(refineParams!= null && refineParams != ''  ) {
172
        url += refineParams;
173
      }
174
      url += "&page="+(page-1)+"&size="+size+"&format=json";
175

    
176
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
177
                      .pipe(map(res => [res['meta'].total, this.parseResults(res['results']), RefineResultsUtils.parse(res['refineResults'],
178
                                              refineFields, "datasource", usedBy)]));
179
  }
180

    
181
    searchDataProvidersBySubjects(keyword:string, type:string, page: number, size: number, properties:EnvProperties):any {
182
      let link = properties.searchResourcesAPIURL;
183
      var compatibilities = "";
184
      if(type == "Research Data"){
185
        compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid = openaire2.0_data)"
186
      }else if(type == "Publications"){
187
        compatibilities = " and (datasourcecompatibilityid <> UNKNOWN) and (datasourcecompatibilityid <> openaire2.0_data)"
188
      }
189
      let url = link+"?query=(((deletedbyinference = false) AND (oaftype exact datasource)) "+((compatibilities && compatibilities.length > 0)?" "+
190
      compatibilities+" ":"")+") "+
191
      " and (datasourcesubject all "+'"'+keyword+'"'+") " ;
192
      url += "&page="+(page-1)+"&size="+size+"&format=json";
193

    
194

    
195
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
196
                  //.map(res => <any> res.json())
197
                  .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
198

    
199
    }
200

    
201
    getDataProvidersforEntityRegistry(datasourceId: string, page: number, size: number , properties:EnvProperties):any {
202
      let url = properties.searchResourcesAPIURL;
203
      var basicQuery = "(oaftype exact datasource) "
204
      url += "?query=";
205
      if(datasourceId!= null && datasourceId != ''  ) {
206
        url +=" ( "+basicQuery+ " ) " +" and (collectedfromdatasourceid exact \"" + datasourceId + "\" or resulthostingdatasourceid exact \""+ datasourceId + "\")";
207
      }else{
208
        url +=" ( "+basicQuery+ " ) ";
209
      }
210

    
211
      url += "&page="+(page-1)+"&size="+size+"&format=json";
212

    
213
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
214
      //.map(res => <any> res.json())
215
      .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
216
    }
217
    searchDataprovidersForEntity (params: string, page: number, size: number, properties:EnvProperties):any {
218
        let link = properties.searchAPIURLLAst;
219
        let url = link+params+"/datasources?format=json";
220

    
221
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
222
                    //.map(res => <any> res.json())
223
                    .pipe(map(res => [res['meta'].total, this.parseResults(res['results'])]));
224
    }
225
/*
226
    searchDataprovidersCSV (params: string, refineParams:string, page: number, size: number):any {
227

    
228
        let link = OpenaireProperties. getSearchAPIURLLast()+"datasources";
229

    
230
        let url = link+"?";
231
        if(params!= null && params != ''  ) {
232
            url += params;
233
        }
234
        if(refineParams!= null && refineParams != ''  ) {
235
            url += refineParams;
236
        }
237
        url += "&page="+(page-1)+"&size="+size+"&format=json";
238

    
239
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
240
                    .map(res => <any> res.json())
241
                    //.do(res => console.info(res))
242

    
243
                    .map(res => this.parseResultsCSV(res['results']));
244
    }
245
*/
246
/*
247
    searchEntityRegistriesCSV (params: string,refineParams:string, page: number, size: number):any {
248
      let url = properties.searchAPIURLLAst;
249
      url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))"
250
      if(params!= null && params != ''  ) {
251
        url += params;
252
      }
253
      if(refineParams!= null && refineParams != ''  ) {
254
        url += refineParams;
255
      }
256
      url += "&page="+(page - 1)+"&size="+size+"&format=json";
257

    
258
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
259
      .map(res => <any> res.json())
260
      //.do(res => console.info(res))
261

    
262
      .map(res => this.parseResultsCSV(res['results']));
263
    }
264
*/
265
/*
266
    searchCompatibleDataprovidersCSV (params: string,refineParams:string, page: number, size: number):any {
267
      let url = properties.searchAPIURLLAst;
268
      url += "?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other))"
269
      if(params!= null && params != ''  ) {
270
        url += params;
271
      }
272
      if(refineParams!= null && refineParams != ''  ) {
273
        url += refineParams;
274
      }
275
      url += "&page="+(page - 1)+"&size="+size+"&format=json";
276

    
277
      return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
278
      .map(res => <any> res.json())
279
      //.do(res => console.info(res))
280

    
281
      .map(res => this.parseResultsCSV(res['results']));
282
    }
283
*/
284

    
285

    
286
    parseResults(data: any): SearchResult[] {
287
        let results: SearchResult[] = [];
288

    
289
        let length = Array.isArray(data) ? data.length : 1;
290

    
291
        for(let i=0; i<length; i++) {
292
            let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
293

    
294
            var result: SearchResult = new SearchResult();
295

    
296
            result['title'] = {"name": '', "accessMode": '', "sc39": ''};
297

    
298
            result['title'].name = resData.officialname;
299
            result['englishname'] = resData.englishname;
300

    
301
            //result['title'].url = OpenaireProperties.getsearchLinkToDataProvider();
302
            //result['title'].url += Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
303
            result['id'] = Array.isArray(data) ? data[i]['result']['header']['dri:objIdentifier'] : data['result']['header']['dri:objIdentifier'];
304

    
305
            result['type'] = this.getDataproviderType(resData);
306

    
307
            if(!Array.isArray(resData['description'])) {
308
              result.description = (resData['description']) ? String(resData['description']) : "";
309
            } else {
310
              result.description = (resData['description'][0]) ? String(resData['description'][0]) : "";
311
            }
312

    
313
            if (result.description && result.description.length > this.sizeOfDescription) {
314
              result.description = result.description.substring(0, this.sizeOfDescription) + "...";
315
            }
316

    
317
            let typeid: string = resData['datasourcetype'].classid;
318
            //console.info(typeid);
319
            if(typeid != "entityregistry" && typeid != "entityregistry::projects" && typeid != "entityregistry::repositories") {
320

    
321
                if(resData.hasOwnProperty('accessinfopackage')) {
322
                    let OAIPMHURL: string;
323
                    if(Array.isArray(resData['accessinfopackage'])) {
324
                        OAIPMHURL = resData['accessinfopackage'][0];
325
                    } else {
326
                        OAIPMHURL = resData['accessinfopackage'];
327
                    }
328

    
329
                    if(OAIPMHURL != '' && OAIPMHURL != 'unknown') {
330
                        result['OAIPMHURL'] = OAIPMHURL;
331
                    }
332
                }
333
                let compatibility = this.getDataproviderCompatibility(resData);
334
                result['compatibility'] = compatibility.classname;
335
                if(compatibility.classid == "UNKNOWN") {
336
                  result['compatibilityUNKNOWN'] = true;
337
                }
338
            } else {
339
              result['compatibility'] = "";
340
            }
341

    
342
            result['websiteURL'] = resData.websiteurl;
343

    
344
            let res:[string[], {"name":string, "id":string}[]] = this.getDataproviderCountriesOrganizations(resData, true, true);
345
            result['organizations'] = res[1];
346
            result['countries'] = res[0];
347
            result['subjects'] = this.getDataproviderSubjects(resData);
348
            //console.log(result['subjects']);
349
            results.push(result);
350
        }
351

    
352
        return results;
353
    }
354
    getDataproviderSubjects(resData: any): string [] {
355
      var subjects:string [] = [];
356

    
357
      let length = Array.isArray(resData['subjects']) ? resData['subjects'].length : 1;
358
      for(let i=0; i<length; i++) {
359
          let subject = Array.isArray(resData['subjects']) ? resData['subjects'][i] :resData['subjects'];
360
          if(subject && subject.content) {
361
            subjects.push(subject.content);
362
          }
363
      }
364
      return subjects;
365
    }
366
    getDataproviderType(resData: any): string {
367
        if(resData['datasourcetype'].hasOwnProperty("classname")) {
368
            return resData['datasourcetype'].classname;
369
        } else {
370
            return '';
371
        }
372
    }
373

    
374
    getDataproviderCompatibility(resData: any): {"classid": string, "classname": string} {
375
        if(resData.hasOwnProperty('openairecompatibility')) {
376
            return {"classid": resData['openairecompatibility'].classid, "classname": resData['openairecompatibility'].classname};
377
        } else {
378
            return {"classid": "", "classname": ""};
379
        }
380
    }
381

    
382
    getDataproviderCountriesOrganizations(resData: any, getCountries: boolean, getOrganizations: boolean): [string[], {"name": string, "id": string}[]] {
383
        let countries: string[] = [];
384
        let organizations: {"name": string, "id": string}[] = [];
385

    
386
        if(resData['rels'].hasOwnProperty("rel")) {
387
            let countriesSet: Set<string> = new Set<string>();
388

    
389
            let relLength = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'].length : 1;
390

    
391
            for(let i=0; i<relLength; i++) {
392
                let relation = Array.isArray(resData['rels']['rel']) ? resData['rels']['rel'][i] : resData['rels']['rel'];
393

    
394
                if(relation.hasOwnProperty("to")) {
395
                    if(relation['to'].class == "provides" && relation['to'].type == "organization") {
396
                        if(getOrganizations) {
397
                            let item: {"name":string, "id":string} = {"name": "", "id": ""};
398
                            //item['name'] = relation.legalname;
399
                            if(relation.legalshortname) {
400
                              item['name'] = relation.legalshortname;
401
                            } else {
402
                              item['name'] = relation.legalname;
403
                            }
404
                            if(!item['name']) {
405
                              item['name'] = "[no title available]";
406
                            }
407
                            item['id'] = /*OpenaireProperties.getsearchLinkToOrganization()+*/relation['to'].content;
408
                            organizations.push(item);
409
                        }
410

    
411
                        if(getCountries) {
412
                            if(relation.hasOwnProperty('country') &&
413
                               relation.country.hasOwnProperty('classname')) {
414
                                if(!countriesSet.has(relation.country.classname)) {
415
                                    countriesSet.add(relation.country.classname);
416
                                    countries.push(relation.country.classname);
417
                                }
418
                            }
419
                        }
420
                    }
421
                }
422
            }
423
        }
424
        return [countries, organizations];
425
    }
426
/*
427
    parseResultsCSV(data: any): any {
428
        let results: any = [];
429
        let length = Array.isArray(data) ? data.length : 1;
430

    
431
        for(let i=0; i<length; i++) {
432
            let resData = Array.isArray(data) ? data[i]['result']['metadata']['oaf:entity']['oaf:datasource'] : data['result']['metadata']['oaf:entity']['oaf:datasource'];
433

    
434
            var result: any = [];
435

    
436
            result.push(this.quote(resData.officialname));
437
            result.push(this.quote(this.getDataproviderType(resData)));
438
            result.push(this.quote(this.getDataproviderCountriesOrganizations(resData, true, false)[0]));
439
            result.push(this.quote(this.getDataproviderCompatibility(resData)));
440
            results.push(result);
441
        }
442
        return results;
443
    }
444
*/
445
    numOfDataproviders(url: string, properties:EnvProperties):any {
446
        //let url = OpenaireProperties. getSearchAPIURLLast()+params+(params.indexOf("?") == -1 ?"?":"&")+"format=json";
447

    
448
        return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
449
                    //.map(res => <any> res.json())
450
                    .pipe(map(res => res['total']));
451
    }
452

    
453
    numOfEntityDataproviders(id: string, entity: string, properties:EnvProperties):any {
454
        var parameters = "";
455
        if(entity == "organization") {
456
          parameters = "organizations/"+id+"/datasources/count";
457
        }
458

    
459
        let url = properties.searchAPIURLLAst+parameters+"?format=json";
460
        return this.numOfDataproviders(url, properties);
461
    }
462

    
463
    numOfSearchDataproviders(params: string, properties:EnvProperties, refineQuery:string=null):any {
464
        let url: string = properties.searchAPIURLLAst+"datasources/count?format=json";
465
        if(params != "") {
466
          url += "&q=" + StringUtils.URIEncode(params);
467
        }
468
      if(refineQuery!= null && refineQuery != ''  ) {
469
        url += refineQuery;
470
      }
471

    
472
        return this.numOfDataproviders(url, properties);
473
    }
474
  numOfSearchDataproviders2(params: string, properties:EnvProperties, refineQuery:string=null):any {
475
    let url: string = properties.searchAPIURLLAst+"resources2/?format=json&size=0&type=datasources";
476
    if(params != "") {
477
      url += "&query=" +params;
478
    }
479
    if(refineQuery!= null && refineQuery != ''  ) {
480
      url += refineQuery;
481
    }
482
    return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
483
      .pipe(map(res => res['meta']['total']));
484
  }
485
/*
486
    private quote(word: any): string {
487
        return '"'+word+'"';
488
    }
489
*/
490
getDataprovidersTableResults (queryType:string, properties:EnvProperties):any {
491
  let size: number = 0;
492
  let url: string= properties.searchAPIURLLAst;
493
  if(queryType == "compatible"){
494
      url += '?query=((oaftype exact datasource) not (datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) not(datasourcetypeuiid = other) not(datasourcetypeuiid exact "pubsrepository::journal") not(datasourcetypeuiid exact "aggregator::pubsrepository::journals"))';
495
  }else if(queryType=="registries"){
496
    url += "?query=((oaftype exact datasource) and(datasourcetypeuiid = other))";
497
  }else if(queryType=="journals"){
498
    url += '?query=((oaftype exact datasource) not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ))';
499

    
500
  }
501

    
502
  url += "&page=0&size=0&format=json";
503

    
504

    
505

    
506
  return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
507
                  //.map(res => <any> res.json())
508
                  .pipe(map(res => res['meta'].total));
509
}
510
}
(15-15/21)