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 -->
<div *ngIf="resultLandingInfo.fos" class="uk-margin-medium-bottom">
<div class="uk-text-muted">
Fields of Science and Technology classification
Fields of Science and Technology classification (FOS)
</div>
<div class="uk-margin-small-top">
<div *ngIf="resultLandingInfo.fos && resultLandingInfo.fos.length > 0">
@ -194,7 +194,7 @@
</div>
<div *ngIf="resultLandingInfo.sdg" class="uk-margin-medium-bottom">
<div class="uk-text-muted">
Sustainable Development Goals
Sustainable Development Goals (SDG)
</div>
<div class="uk-margin-small-top">
<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")) {
this.resultTypes = {
values: [],
filterId: "type",
countSelectedValues: 0,
filterType: 'checkbox',
originalFilterId: "",
valueIsExact: true,
title: "Result Types",
filterOperator: "or"
};
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
if (URLparams["type"]) {
let types = URLparams["type"];
types = Array.isArray(types) ? types.join(',').split(",") : types.split(",");

View File

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

View File

@ -78,6 +78,12 @@ export class ISVocabulariesService {
//return this.getVocabularyFromService(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;
@ -106,6 +112,9 @@ export class ISVocabulariesService {
getVocabularyFromService(vocabularyName: string, properties: EnvProperties): Observable<AutoCompleteValue[]> {
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)
//.map(res => <any> res.json())
.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[] {
var array: AutoCompleteValue[] = []
for (var i = 0; i < data.length; i++) {