Merge from master

This commit is contained in:
Konstantinos Triantafyllou 2022-03-21 14:39:34 +02:00
commit e678ca1072
4 changed files with 75 additions and 25 deletions

View File

@ -184,7 +184,7 @@
<!-- Subjects --> <!-- Subjects -->
<div *ngIf="resultLandingInfo.fos" class="uk-margin-medium-bottom"> <div *ngIf="resultLandingInfo.fos" class="uk-margin-medium-bottom">
<div class="uk-text-muted"> <div class="uk-text-muted">
Fields of Science and Technology classification Fields of Science and Technology classification (FOS)
</div> </div>
<div class="uk-margin-small-top"> <div class="uk-margin-small-top">
<div *ngIf="resultLandingInfo.fos && resultLandingInfo.fos.length > 0"> <div *ngIf="resultLandingInfo.fos && resultLandingInfo.fos.length > 0">
@ -194,7 +194,7 @@
</div> </div>
<div *ngIf="resultLandingInfo.sdg" class="uk-margin-medium-bottom"> <div *ngIf="resultLandingInfo.sdg" class="uk-margin-medium-bottom">
<div class="uk-text-muted"> <div class="uk-text-muted">
Sustainable Development Goals Sustainable Development Goals (SDG)
</div> </div>
<div class="uk-margin-small-top"> <div class="uk-margin-small-top">
<div *ngIf="resultLandingInfo.sdg && resultLandingInfo.sdg.length > 0"> <div *ngIf="resultLandingInfo.sdg && resultLandingInfo.sdg.length > 0">

View File

@ -1453,16 +1453,7 @@ export class NewSearchPageComponent {
} }
}*/ }*/
if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) { if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
this.resultTypes = { this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
values: [],
filterId: "type",
countSelectedValues: 0,
filterType: 'checkbox',
originalFilterId: "",
valueIsExact: true,
title: "Result Types",
filterOperator: "or"
};
if (URLparams["type"]) { if (URLparams["type"]) {
let types = URLparams["type"]; let types = URLparams["type"];
types = Array.isArray(types) ? types.join(',').split(",") : types.split(","); types = Array.isArray(types) ? types.join(',').split(",") : types.split(",");

View File

@ -11,16 +11,15 @@ export class SearchFields {
// Remove Collected From Filter "collectedfrom","collectedfrom" // Remove Collected From Filter "collectedfrom","collectedfrom"
public RESULT_REFINE_FIELDS = [ public RESULT_REFINE_FIELDS = [
"resultbestaccessright", "relfunder", "resultbestaccessright", "instancetypename", "fos", "relfunder",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
"relproject", "relproject", "sdg", "country", "resultlanguagename", "resulthostingdatasource", "community"];
"instancetypename", "resultlanguagename", "community", "resulthostingdatasource", "country", "sdg", "fos"];
public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher", public RESULT_ADVANCED_FIELDS: string[] = ["q", "resulttitle", "resultauthor", "authorid", "resultdescription", "resultsubject", "resultpublisher",
"resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance", "resultbestaccessright", "community", "collectedfromdatasourceid", "resulthostingdatasourceid", "resultdateofacceptance",
"relfunder", "relfunder",
"relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id", "relfundinglevel0_id", "relfundinglevel1_id", "relfundinglevel2_id",
"resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename"]; "resultlanguagename", "relorganizationid", "pid", "relprojectid", "instancetypename", "fos", "sdg"];
public RESULT_FIELDS: { [key: string]: FieldDetails } = { public RESULT_FIELDS: { [key: string]: FieldDetails } = {
["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null}, ["q"]: {name: "All fields", type: "keyword", param: "q", operator: "op", equalityOperator: "=", filterType: null},
["resulttitle"]: { ["resulttitle"]: {
@ -81,7 +80,7 @@ export class SearchFields {
filterType: null filterType: null
}, },
["resulthostingdatasource"]: { ["resulthostingdatasource"]: {
name: "Content Provider", name: "Source",
type: "refine", type: "refine",
param: "hostedBy", param: "hostedBy",
operator: "hs", operator: "hs",
@ -89,7 +88,7 @@ export class SearchFields {
filterType: "checkbox" filterType: "checkbox"
}, },
["instancetypename"]: { ["instancetypename"]: {
name: "Type", name: "Document Type",
type: "vocabulary", type: "vocabulary",
param: "type", param: "type",
operator: "tp", operator: "tp",
@ -105,7 +104,7 @@ export class SearchFields {
filterType: "checkbox" filterType: "checkbox"
}, },
["community"]: { ["community"]: {
name: "Community", name: "Research Community",
type: "refine", type: "refine",
param: "community", param: "community",
operator: "cm", operator: "cm",
@ -185,7 +184,7 @@ export class SearchFields {
filterType: "range" filterType: "range"
}, },
["resultbestaccessright"]: { ["resultbestaccessright"]: {
name: "Access Mode", name: "Access",
type: "vocabulary", type: "vocabulary",
param: "access", param: "access",
operator: "ac", operator: "ac",
@ -217,7 +216,7 @@ export class SearchFields {
filterType: null filterType: null
}, },
["resulttypeid"]: { ["resulttypeid"]: {
name: "Result type", name: "Type",
type: "refine", type: "refine",
param: "types", param: "types",
operator: "tp", operator: "tp",
@ -233,16 +232,16 @@ export class SearchFields {
filterType: "checkbox" filterType: "checkbox"
}, },
["sdg"]: { ["sdg"]: {
name: "Sustainable Development Goals (SDG)", name: "SDG",
type: "refine", type: "vocabulary",
param: "sdg", param: "sdg",
operator: "sg", operator: "sg",
equalityOperator: " exact ", equalityOperator: " exact ",
filterType: "checkbox" filterType: "checkbox"
}, },
["fos"]: { ["fos"]: {
name: "Fields of Science and Technology classification (FOS)", name: "Field of Science",
type: "refine", type: "vocabulary",
param: "fos", param: "fos",
operator: "fs", operator: "fs",
equalityOperator: " exact ", equalityOperator: " exact ",

View File

@ -78,6 +78,12 @@ export class ISVocabulariesService {
//return this.getVocabularyFromService(vocabulary, properties); //return this.getVocabularyFromService(vocabulary, properties);
return from(this.getVocabularyFromServiceAsync(vocabulary, properties)); return from(this.getVocabularyFromServiceAsync(vocabulary, properties));
} else if (field == "fos") {
vocabulary = "fos";
return from(this.getVocabularyFromServiceAsync(vocabulary, properties));
} else if (field == "sdg") {
vocabulary = "sdg";
return from(this.getVocabularyFromServiceAsync(vocabulary, properties));
} }
return null; return null;
@ -106,6 +112,9 @@ export class ISVocabulariesService {
getVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> { getVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> {
let url = properties.vocabulariesAPI + vocabularyName; let url = properties.vocabulariesAPI + vocabularyName;
if(vocabularyName == 'fos' || vocabularyName == 'sdg'){
return this.getLocalVocabularyFromService(vocabularyName, properties);
}
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url) return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json()) //.map(res => <any> res.json())
.pipe(map(res => res['terms'])) .pipe(map(res => res['terms']))
@ -114,6 +123,57 @@ export class ISVocabulariesService {
} }
getLocalVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> {
if(vocabularyName == "sdg"){
let url = "/assets/vocabulary/sdg.json";
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['sdg']))
.pipe(map(res => this.parseSDGs(res)))
.pipe(catchError(this.handleError));
}else if( vocabularyName == "fos"){
let url = "/assets/vocabulary/fos.json";
return this.http.get((properties.useLongCache) ? (properties.cacheUrl + encodeURIComponent(url)) : url)
//.map(res => <any> res.json())
.pipe(map(res => res['fos']))
.pipe(map(res => this.parseFOS(res)))
.pipe(catchError(this.handleError));
}
}
parseSDGs(data: any): AutoCompleteValue[] {
var array: AutoCompleteValue[] = []
for (var i = 0; i < data.length; i++) {
var value: AutoCompleteValue = new AutoCompleteValue();
value.id = data[i].id;//data[i].code;
value.label = data[i].label;
array.push(value);
}
return array;
}
parseFOS(data: any): AutoCompleteValue[] {
let array: AutoCompleteValue[] = []
for (let fos of data) {
let value: AutoCompleteValue = new AutoCompleteValue();
value.id = fos.id;//data[i].code;
value.label = fos.label;
array.push(value);
for (let fos2 of fos.children) {
let value: AutoCompleteValue = new AutoCompleteValue();
value.id = fos2.id;//data[i].code;
value.label = fos2.label;
array.push(value);
for (let fos3 of fos2.children) {
let value: AutoCompleteValue = new AutoCompleteValue();
value.id = fos3.id;//data[i].code;
value.label = fos3.label;
array.push(value);
}
}
}
return array;
}
parse(data: any, vocabularyName: string): AutoCompleteValue[] { parse(data: any, vocabularyName: string): AutoCompleteValue[] {
var array: AutoCompleteValue[] = [] var array: AutoCompleteValue[] = []
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {