diff --git a/claims/claim-utils/claimContextSearchForm.component.ts b/claims/claim-utils/claimContextSearchForm.component.ts
index 1db7e287..52567d47 100644
--- a/claims/claim-utils/claimContextSearchForm.component.ts
+++ b/claims/claim-utils/claimContextSearchForm.component.ts
@@ -71,23 +71,23 @@ import{EnvProperties} from '../../utils/properties/env-properties';
-
-
+
-
+
{{concept1.label}}
-
- -
-
+
+ -
+
-
+
{{concept2.label}}
-
- - {{concept3.label}}
+
@@ -196,9 +196,9 @@ getCommunities () {
}else{
this.loading = true;
var token=Session.getUserJwt();
- this._contextService.getCommunities(this.properties.claimsAPIURL).subscribe(
+ this._contextService.getCommunities(this.properties.contextsAPI).subscribe(
data => {
- this.communities = data.communities;
+ this.communities = data;
this.loading = false;
},
err => {
@@ -218,10 +218,10 @@ getCommunities () {
}else{
var token=Session.getUserJwt();
- this._contextService.getCategories(this.selectedCommunityId,this.properties.claimsAPIURL).subscribe(
+ this._contextService.getCategories(this.selectedCommunityId,this.properties.contextsAPI).subscribe(
data => {
- this.categories = (Array.isArray(data.category))? data.category:[data.category];
+ this.categories =data;// (Array.isArray(data.category))? data.category:[data.category];
this.concepts = [];
this.addCommunityInConcepts();
this.filteredList = [];
@@ -247,10 +247,15 @@ getCommunities () {
}else{
this.concepts = [];
var token=Session.getUserJwt();
- this._contextService.getConcepts(this.selectedCategoryId, "",true, this.properties.claimsAPIURL).subscribe(
+ this._contextService.getConcepts(this.selectedCategoryId, "",true, this.properties.contextsAPI).subscribe(
data => {
this.concepts =data;
+ if(this.selectedCategoryId == "egi::classification"){
+ for(var i =0 ; i {
+ console.log(data);
+ for(var i =0 ; i {
+ console.log(err);
+ this.loading = false;
+ }
+ );
+ }
+ }else{
+ this.concepts=[];
+ this.loading = false;
+ }
+ }
displaySubcategory(id) {
if(this.conceptsClassDisplay[id] != null){
this.conceptsClassDisplay[id] = !this.conceptsClassDisplay[id];
@@ -289,19 +325,26 @@ getCommunities () {
this.conceptsClassDisplay[categoryId] = true;
}
this.conceptsClass[categoryId] = [];
- var token=Session.getUserJwt();
this.conceptsCategoryLoading[categoryId] = true;
- this._contextService.getConcepts(categoryId, "",false, this.properties.claimsAPIURL).subscribe(
+ this._contextService.getConcepts(categoryId, "",false, this.properties.contextsAPI).subscribe(
data => {
- var concepts = (Array.isArray(data))? data:[data];
- for(var i=0;i {
console.log(err);
@@ -311,6 +354,28 @@ getCommunities () {
}
}
+ browseSubConcepts (categoryId, conceptId) {
+
+ this.conceptsCategoryLoading[categoryId] = true;
+ this._contextService.getSubConcepts(conceptId, "",false, this.properties.contextsAPI).subscribe(
+ data => {
+ var concepts = data[0];//(Array.isArray(data))? data:[data];
+ this.conceptsClass[categoryId].push(concepts)
+ console.log("Data"+concepts);
+
+
+
+ console.log(this.conceptsClass[categoryId]);
+ this.conceptsCategoryLoading[categoryId] = false;
+ },
+ err => {
+ console.log(err);
+ this.conceptsCategoryLoading[categoryId] = false;
+ }
+ );
+
+
+ }
communityChanged(){
console.log(this.selectedCommunityId +" ");
this.warningMessage = "";
diff --git a/claims/claim-utils/service/contexts.service.ts b/claims/claim-utils/service/contexts.service.ts
index cf9a2956..d6d4dba7 100644
--- a/claims/claim-utils/service/contexts.service.ts
+++ b/claims/claim-utils/service/contexts.service.ts
@@ -14,37 +14,58 @@ export class ContextsService {
}
public getCommunities( apiUrl:string):any {
- let url = apiUrl + 'communities';
+ let url = apiUrl + 's/';
+
let key = url;
-
-
console.info('ContextsService: request communities '+url);
- return this.http.get(url, this.getAuthOptions())
- .map(request => request.json().data)
+ return this.http.get(url)
+ .map(res => res.json()).map(res => this.parseCommunities(res) )
// .do(request => console.info("Get claims: offset = "))
.catch(this.handleError);
}
+ parseCommunities(data){
+ var communities = [];
+
+ for(var i = 0; i< data.length; i++){
+ if(data[i].type && (data[i].type == "ri" || data[i].type == "community")){
+ communities.push(data[i]);
+ }
+ }
+ return communities;
+ }
public getCategories(communityId :string, apiUrl:string):any {
console.info('ContextsService: request categories for community with id '+communityId);
- let url= apiUrl + 'communities/' + communityId + '/categories';
+ let url= apiUrl + '/' + communityId ;
let key = url;
- return this.http.get(url, this.getAuthOptions())
- .map(request => request.json().data)
+ return this.http.get(url)
+ .map(request => request.json())
// .do(request => console.info("Get claims: offset = " ))
.catch(this.handleError);;
}
public getConcepts(categoryId :string, keyword: string, parsing:boolean, apiUrl:string):any {
console.info('ContextsService: request concept for category with id '+categoryId + ' and keyword '+ keyword);
- let url= apiUrl + 'categories/' + categoryId+ "/concepts";
+ let url= apiUrl + '/category/' + categoryId;
let key = url+"_parsing="+parsing;
- return this.http.get(url, this.getAuthOptions())
- .map(request => request.json().data)
+ return this.http.get(url )
+ .map(request => request.json())
.catch(this.handleError)
- .map(res => (parsing)?this.parse(res.concept):res.concept);
+ .map(res => (parsing)?this.parse(res):res);
+ // .do(res => console.info("Result is "+ res.length ));
+ }
+ public getSubConcepts(subConceptID :string, keyword: string, parsing:boolean, apiUrl:string):any {
+ console.info('ContextsService: request sub concept for concept with id '+subConceptID + ' and keyword '+ keyword);
+ let url= apiUrl + '/category/concept/' + subConceptID;
+ let key = url+"_parsing="+parsing;
+
+
+ return this.http.get(url )
+ .map(request => request.json())
+ .catch(this.handleError)
+ .map(res => (parsing)?this.parseSubConcepts(res):res);
// .do(res => console.info("Result is "+ res.length ));
}
parse (data: any):AutoCompleteValue[] {
@@ -64,6 +85,29 @@ export class ContextsService {
return array;
+ }
+ parseSubConcepts (data: any):AutoCompleteValue[] {
+ var array:AutoCompleteValue[] =[]
+ if(data.length >0 && data[0].concepts){
+ var concepts = data[0].concepts;
+ for(var i = 0; i < concepts.length; i++){
+ var value:AutoCompleteValue = new AutoCompleteValue();
+ value.id = concepts[i].id;
+ value.label = concepts[i].label;
+ if(concepts[i].concepts){
+ var subconcepts = concepts[i].concepts;
+ for(var x = 0; x < subconcepts.length; x++){
+ var value:AutoCompleteValue = new AutoCompleteValue();
+ value.id = subconcepts[x].id;
+ value.label = subconcepts[x].label;
+ array.push(value);
+ }
+ }
+ array.push(value);
+ }
+ }
+ return array;
+
}
private handleError (error: Response) {
diff --git a/utils/properties/env-properties.ts b/utils/properties/env-properties.ts
index 4dac2e45..a9bee09f 100644
--- a/utils/properties/env-properties.ts
+++ b/utils/properties/env-properties.ts
@@ -81,7 +81,7 @@ export class EnvProperties {
adminToolsCommunity;
-
+ contextsAPI;
communityAPI;
communitiesAPI;
datasourcesAPI;