comparison app/query.service.ts @ 5:b06a5d61afed

new query state stuff.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Wed, 13 Jan 2016 18:57:31 +0100
parents c741a00d38de
children 9f5473536a98
comparison
equal deleted inserted replaced
4:351c3df28602 5:b06a5d61afed
2 import {Http, Headers} from 'angular2/http'; 2 import {Http, Headers} from 'angular2/http';
3 3
4 import 'rxjs/Rx'; // import all RxJS operators 4 import 'rxjs/Rx'; // import all RxJS operators
5 5
6 import {QueryMode} from './query-mode'; 6 import {QueryMode} from './query-mode';
7 import {QueryState} from './query-state';
8 import {QueryStep} from './query-step';
7 9
8 @Injectable() 10 @Injectable()
9 export class QueryService { 11 export class QueryService {
10 12
13 public queryState: QueryState;
14
11 public ismiObjectTypes; 15 public ismiObjectTypes;
12 16
13 public QUERY_MODES: QueryMode[] = [ 17 public QUERY_MODES: QueryMode[] = [
14 {id: 'type_is', label:'Object type is'}, 18 {id: 'type_is', label:'Object type is'},
15 {id: 'att_contains', label: 'Attribute contains'}]; 19 {id: 'att_contains', label: 'Attribute contains'}];
16 20
17 constructor(private _http: Http) {} 21 constructor(private _http: Http) {
22 this.queryState = {'queries': [], 'results': [], numResults: 0};
23 }
18 24
19 getQueryModes(): QueryMode[] { 25 getQueryModes(): QueryMode[] {
20 return this.QUERY_MODES; 26 return this.QUERY_MODES;
21 } 27 }
22 28
25 if (queryMode.id === 'att_contains') { 31 if (queryMode.id === 'att_contains') {
26 options = ['d', 'e', 'f']; 32 options = ['d', 'e', 'f'];
27 } else if (queryMode.id === 'type_is') { 33 } else if (queryMode.id === 'type_is') {
28 options = this.ismiObjectTypes; 34 options = this.ismiObjectTypes;
29 } 35 }
30 return Promise.resolve(options); 36 console.debug("getQueryOptions returns: ", options);
37 return options;
31 } 38 }
32 39
33 setupIsmiObjectTypes() { 40 setupIsmiObjectTypes() {
34 var query = `MATCH (n) WITH DISTINCT labels(n) AS labels 41 var query = `MATCH (n) WITH DISTINCT labels(n) AS labels
35 UNWIND labels AS label 42 UNWIND labels AS label