Mercurial > hg > ng2-query-ismi
comparison app/query.service.ts @ 13:98b435bb6c0c
more query work.
author | Robert Casties <casties@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 21 Jan 2016 14:47:00 +0100 |
parents | 1843b12eff9a |
children | 7dc7ea95ca26 |
comparison
equal
deleted
inserted
replaced
12:1843b12eff9a | 13:98b435bb6c0c |
---|---|
8 import {QueryStep} from './query-step'; | 8 import {QueryStep} from './query-step'; |
9 | 9 |
10 @Injectable() | 10 @Injectable() |
11 export class QueryService { | 11 export class QueryService { |
12 | 12 |
13 public neo4jBaseUrl = 'http://localhost:7474/db/data'; | 13 public neo4jBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data'; |
14 //public neo4jBaseUrl = 'http://localhost:7474/db/data'; | |
15 public openMindBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/'; | |
16 //public openMindBaseUrl = 'http://localhost:18080/ismi-richfaces/': | |
14 public state: QueryState; | 17 public state: QueryState; |
15 public ismiObjectTypes: any; | 18 public ismiObjectTypes: any; |
16 | 19 |
17 constructor(private _http: Http) { | 20 constructor(private _http: Http) { |
18 this.state = { | 21 this.state = { |
136 this.state.resultTypes = returnType; | 139 this.state.resultTypes = returnType; |
137 } | 140 } |
138 | 141 |
139 updateQuery() { | 142 updateQuery() { |
140 this.createCypherQuery(); | 143 this.createCypherQuery(); |
144 this.state.resultInfo = 'loading...'; | |
141 // run query for result table | 145 // run query for result table |
142 var resQuery = this.state.resultCypherQuery; | 146 var resQuery = this.state.resultCypherQuery; |
143 var queryParams = this.state.cypherQueryParams; | 147 var queryParams = this.state.cypherQueryParams; |
144 var resRes = this.fetchCypherResult(resQuery, queryParams); | 148 var resRes = this.fetchCypherResult(resQuery, queryParams); |
145 resRes.subscribe( | 149 resRes.subscribe( |
208 // filter result as JSON | 212 // filter result as JSON |
209 .map(res => res.json()); | 213 .map(res => res.json()); |
210 // return Observable | 214 // return Observable |
211 return resp; | 215 return resp; |
212 } | 216 } |
217 | |
218 fetchNormalizedString(text: string) { | |
219 console.debug("fetching normalized string: ", text); | |
220 var headers = new Headers(); | |
221 headers.append('Accept', 'application/json'); | |
222 // put headers in options | |
223 var opts = {'headers': headers}; | |
224 // make get request asynchronously | |
225 var url = this.openMindBaseUrl+'jsonInterface?method=normalize_string&type=arabic_translit&text='; | |
226 url += text; | |
227 var resp = this._http.get(url, opts) | |
228 // filter result as JSON | |
229 .map(res => res.json()); | |
230 // return Observable | |
231 return resp; | |
232 } | |
213 } | 233 } |