# HG changeset patch # User Robert Casties # Date 1453384020 -3600 # Node ID 98b435bb6c0c0019bf69966d7a1720a40c9cdd75 # Parent 1843b12eff9a73fe1dca414f78639007ad76a60e more query work. diff -r 1843b12eff9a -r 98b435bb6c0c app/query-app.component.ts --- a/app/query-app.component.ts Thu Jan 21 11:16:13 2016 +0100 +++ b/app/query-app.component.ts Thu Jan 21 14:47:00 2016 +0100 @@ -11,7 +11,7 @@ @Component({ selector: 'query-app', template: ` -

Angular2 query builder

+

ISMI-Lab Query Builder

Select a query step:
[{{rowData.ismi_id}}] {{rowData.label}} + + view in OpenMind + {{rowData}} `, inputs: ['rowData', 'rowType'] diff -r 1843b12eff9a -r 98b435bb6c0c app/query-result.component.ts --- a/app/query-result.component.ts Thu Jan 21 11:16:13 2016 +0100 +++ b/app/query-result.component.ts Thu Jan 21 14:47:00 2016 +0100 @@ -12,10 +12,12 @@

Query results ({{queryState.resultInfo}}):

+ + - - +
ID LabelLink
diff -r 1843b12eff9a -r 98b435bb6c0c app/query-select.component.ts --- a/app/query-select.component.ts Thu Jan 21 11:16:13 2016 +0100 +++ b/app/query-select.component.ts Thu Jan 21 14:47:00 2016 +0100 @@ -96,12 +96,29 @@ if (opt) { step = {'mode': this.selectedMode, 'relationType': opt}; } - } else if (this.selectedMode.id == 'att_contains' || this.selectedMode.id == 'att_contains_norm') { + } else if (this.selectedMode.id == 'att_contains') { var att = this.selectedOption; var val = this.queryInput; if (att && val) { step = {'mode': this.selectedMode, 'attribute': att, 'value': val}; } + } else if (this.selectedMode.id == 'att_contains_norm') { + var att = this.selectedOption; + var val = this.queryInput; + if (att && val) { + this._queryService.fetchNormalizedString(val) + .subscribe( + data => { + console.debug("openmind norm data=", data); + step = {'mode': this.selectedMode, 'attribute': att, 'value': val, 'normValue': data.normalized_text}; + this._queryService.setQueryStep(this.index, step); + this.queryChanged.emit(this._queryService.getState()); + }, + err => console.error("openmind norm error=", err), + () => console.debug("openmind norm query Complete") + ); + return; + } } if (step != null) { diff -r 1843b12eff9a -r 98b435bb6c0c app/query.service.ts --- a/app/query.service.ts Thu Jan 21 11:16:13 2016 +0100 +++ b/app/query.service.ts Thu Jan 21 14:47:00 2016 +0100 @@ -10,7 +10,10 @@ @Injectable() export class QueryService { - public neo4jBaseUrl = 'http://localhost:7474/db/data'; + public neo4jBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data'; + //public neo4jBaseUrl = 'http://localhost:7474/db/data'; + public openMindBaseUrl = 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/'; + //public openMindBaseUrl = 'http://localhost:18080/ismi-richfaces/': public state: QueryState; public ismiObjectTypes: any; @@ -138,6 +141,7 @@ updateQuery() { this.createCypherQuery(); + this.state.resultInfo = 'loading...'; // run query for result table var resQuery = this.state.resultCypherQuery; var queryParams = this.state.cypherQueryParams; @@ -210,4 +214,20 @@ // return Observable return resp; } + + fetchNormalizedString(text: string) { + console.debug("fetching normalized string: ", text); + var headers = new Headers(); + headers.append('Accept', 'application/json'); + // put headers in options + var opts = {'headers': headers}; + // make get request asynchronously + var url = this.openMindBaseUrl+'jsonInterface?method=normalize_string&type=arabic_translit&text='; + url += text; + var resp = this._http.get(url, opts) + // filter result as JSON + .map(res => res.json()); + // return Observable + return resp; + } } \ No newline at end of file diff -r 1843b12eff9a -r 98b435bb6c0c index.html --- a/index.html Thu Jan 21 11:16:13 2016 +0100 +++ b/index.html Thu Jan 21 14:47:00 2016 +0100 @@ -1,7 +1,7 @@ - Angular 2 QuickStart + ISMI Query Builder @@ -28,7 +28,7 @@ - Loading... + Loading... Query Builder