# HG changeset patch # User casties # Date 1490800752 -7200 # Node ID 3b4046e0cc02ba2798a7602c1b50740001abc3e7 # Parent 781a5387ca93623bd132210c1a029a64b1ffad32# Parent d7c947909ab888c013171b8c037e4f9fab30fe57 Merge from ng2-table branch. d7c947909ab888c013171b8c037e4f9fab30fe57 diff -r 781a5387ca93 -r 3b4046e0cc02 package.json --- a/package.json Mon Mar 20 18:50:31 2017 +0100 +++ b/package.json Wed Mar 29 17:19:12 2017 +0200 @@ -1,6 +1,6 @@ { "name": "ng2-ismi-query-app", - "version": "1.0.0", + "version": "1.1.0", "scripts": { "build": "tsc -p src/", "build:watch": "tsc -p src/ -w", @@ -31,18 +31,17 @@ "@angular/platform-browser": "~2.4.0", "@angular/platform-browser-dynamic": "~2.4.0", "@angular/router": "~3.4.0", - "angular-in-memory-web-api": "~0.2.4", + "core-js": "^2.4.1", + "ng2-bootstrap": "^1.4.2", + "rxjs": "5.0.1", "systemjs": "0.19.40", - "core-js": "^2.4.1", - "rxjs": "5.0.1", "zone.js": "^0.7.4" }, "devDependencies": { "concurrently": "^3.2.0", "lite-server": "^2.2.2", "typescript": "~2.0.10", - "canonical-path": "0.0.2", "tslint": "^3.15.1", "lodash": "^4.16.4", @@ -54,7 +53,6 @@ "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~4.0.14", "rimraf": "^2.5.4", - "@types/node": "^6.0.46", "@types/jasmine": "2.5.36" }, diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app-config.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app-config.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,7 @@ +"use strict"; +//export const NEO4J_BASE_URL = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data'; +exports.NEO4J_BASE_URL = 'http://localhost:7474/db/data'; +exports.NEO4J_AUTHENTICATION = { 'user': 'neo4j', 'password': 'neo5j' }; +exports.OPENMIND_BASE_URL = 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/'; +//export const OPENMIND_BASE_URL = 'http://localhost:18080/ismi-richfaces/'; +//# sourceMappingURL=app-config.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app-config.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app-config.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"app-config.js","sourceRoot":"","sources":["app-config.ts"],"names":[],"mappings":";AACA,0FAA0F;AAC7E,sBAAc,GAAG,+BAA+B,CAAC;AAEjD,4BAAoB,GAAG,EAAC,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAC,CAAC;AAE9D,yBAAiB,GAAG,gDAAgD,CAAC;AAClF,4EAA4E"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app-config.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app-config.ts Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,8 @@ + +//export const NEO4J_BASE_URL = 'https://ismi-dev.mpiwg-berlin.mpg.de/neo4j-ismi/db/data'; +export const NEO4J_BASE_URL = 'http://localhost:7474/db/data'; + +export const NEO4J_AUTHENTICATION = {'user': 'neo4j', 'password': 'neo5j'}; + +export const OPENMIND_BASE_URL = 'https://ismi-dev.mpiwg-berlin.mpg.de/om4-ismi/'; +//export const OPENMIND_BASE_URL = 'http://localhost:18080/ismi-richfaces/'; diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app.module.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app.module.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,42 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var platform_browser_1 = require('@angular/platform-browser'); +var forms_1 = require('@angular/forms'); +var http_1 = require('@angular/http'); +var ng2_table_1 = require('ng2-table/ng2-table'); +var ng2_bootstrap_1 = require('ng2-bootstrap'); +var query_app_component_1 = require('./query-app.component'); +var query_select_component_1 = require('./query-select.component'); +//import { QueryResultComponent } from './query-result.component'; +//import { QueryResultRowComponent } from './query-result-row.component'; +var query_result_table_component_1 = require('./query-result-table.component'); +var query_service_1 = require('./query.service'); +var normalization_service_1 = require('./normalization.service'); +var AppModule = (function () { + function AppModule() { + } + AppModule = __decorate([ + core_1.NgModule({ + imports: [platform_browser_1.BrowserModule, forms_1.FormsModule, http_1.HttpModule, + ng2_table_1.Ng2TableModule, ng2_bootstrap_1.PaginationModule.forRoot()], + declarations: [query_app_component_1.QueryAppComponent, query_select_component_1.QuerySelectComponent, + // QueryResultComponent, QueryResultRowComponent + query_result_table_component_1.QueryResultTableComponent], + providers: [query_service_1.QueryService, normalization_service_1.NormalizationService], + bootstrap: [query_app_component_1.QueryAppComponent] + }), + __metadata('design:paramtypes', []) + ], AppModule); + return AppModule; +}()); +exports.AppModule = AppModule; +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app.module.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app.module.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["app.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAA8B,eAAe,CAAC,CAAA;AAC9C,iCAA8B,2BAA2B,CAAC,CAAA;AAC1D,sBAA4B,gBAAgB,CAAC,CAAA;AAC7C,qBAA2B,eAAe,CAAC,CAAA;AAE3C,0BAA+B,qBAAqB,CAAC,CAAA;AACrD,8BAAiC,eAAe,CAAC,CAAA;AAEjD,oCAAmC,uBAAuB,CAAC,CAAA;AAC3D,uCAAsC,0BAA0B,CAAC,CAAA;AACjE,mEAAmE;AACnE,0EAA0E;AAC1E,6CAA2C,gCAAgC,CAAC,CAAA;AAC5E,8BAA6B,iBAAiB,CAAC,CAAA;AAC/C,sCAAqC,yBAAyB,CAAC,CAAA;AAY/D;IAAA;IAAyB,CAAC;IAT1B;QAAC,eAAQ,CAAC;YACR,OAAO,EAAO,CAAE,gCAAa,EAAE,mBAAW,EAAE,iBAAU;gBACtC,0BAAc,EAAE,gCAAgB,CAAC,OAAO,EAAE,CAAE;YAC5D,YAAY,EAAE,CAAE,uCAAiB,EAAE,6CAAoB;gBACzD,kEAAkE;gBAChD,wDAAyB,CAAE;YAC3C,SAAS,EAAK,CAAE,4BAAY,EAAE,4CAAoB,CAAE;YACpD,SAAS,EAAK,CAAE,uCAAiB,CAAE;SACpC,CAAC;;iBAAA;IACuB,gBAAC;AAAD,CAAC,AAA1B,IAA0B;AAAb,iBAAS,YAAI,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/app.module.ts --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/app.module.ts Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,27 @@ +import { NgModule } from '@angular/core'; +import { BrowserModule } from '@angular/platform-browser'; +import { FormsModule } from '@angular/forms'; +import { HttpModule } from '@angular/http'; + +import { Ng2TableModule } from 'ng2-table/ng2-table'; +import { PaginationModule } from 'ng2-bootstrap'; + +import { QueryAppComponent } from './query-app.component'; +import { QuerySelectComponent } from './query-select.component'; +//import { QueryResultComponent } from './query-result.component'; +//import { QueryResultRowComponent } from './query-result-row.component'; +import { QueryResultTableComponent } from './query-result-table.component'; +import { QueryService } from './query.service'; +import { NormalizationService } from './normalization.service'; + + +@NgModule({ + imports: [ BrowserModule, FormsModule, HttpModule, + Ng2TableModule, PaginationModule.forRoot() ], + declarations: [ QueryAppComponent, QuerySelectComponent, +// QueryResultComponent, QueryResultRowComponent + QueryResultTableComponent ], + providers: [ QueryService, NormalizationService ], + bootstrap: [ QueryAppComponent ] +}) +export class AppModule { } diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/ismi-relation-types.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/ismi-relation-types.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,63 @@ +"use strict"; +var relation_type_1 = require('./relation-type'); +exports.RELATION_TYPES = {}; +addRelationType('is_part_of', 'is included in', 'includes'); +addRelationType('is_exemplar_of', 'title of witness', 'witnesses to title'); +addRelationType('was_created_by', 'created by', 'works of'); +addRelationType('has_subject', 'subject of title', 'titles with subject'); +addRelationType('has_role', 'roles of person', 'persons with role'); +addRelationType('is_alias_name_of', 'person name for alias', 'alias of person'); +addRelationType('is_alias_title_of', 'title name for alias', 'alias of title'); +addRelationType('is_commentary_on', 'is commentary on', 'list of commentaries'); +addRelationType('has_title_written_as', 'title in witness', 'witness with title as'); +addRelationType('has_author_written_as', 'author in witness', 'witness with author as'); +addRelationType('lived_in', 'place person lived in', 'persons who lived in'); +addRelationType('was_copied_by', 'witness copied by', 'witnesses that were copied by'); +addRelationType('was_born_in', 'place person was born in', 'persons who were born in'); +addRelationType('owned_by', 'codex owned by', 'persons who owned codex'); +addRelationType('was_student_of', 'studied with', 'persons studying with'); +addRelationType('died_in', 'place person died in', 'persons who died in'); +addRelationType('was_created_in', 'place title was created', 'titles that were created in'); +addRelationType('was_copied_in', 'place witness was copied', 'witnesses that were copied in'); +addRelationType('misattributed_to', 'title misattributed to', 'misattributions to person'); +addRelationType('was_dedicated_to', 'text dedicated to', 'texts that were dedicated to'); +addRelationType('is_version_of', 'standard text of different version', 'different version of standard text'); +addRelationType('is_translation_of', 'original text of a translation', 'translation of a text'); +addRelationType('has_floruit_date', 'floruit date of person', 'persons with floruit date'); +addRelationType('was_studied_by', 'persons studying this text', 'text studied by'); +//addRelationType('', '', ''); +function getRelationType(relType, isOutgoing) { + var name = relType; + if (isOutgoing === false) { + // add prefix to name + name = relation_type_1.invNamePrefix + name; + } + var rt = exports.RELATION_TYPES[name]; + if (rt == null) { + rt = new relation_type_1.RelationType(relType, isOutgoing); + } + return rt; +} +exports.getRelationType = getRelationType; +function getRelationByName(name) { + var rt = exports.RELATION_TYPES[name]; + if (rt == null) { + if (name.indexOf(relation_type_1.invNamePrefix) == 0) { + // inverse relation + name = name.substr(relation_type_1.invNamePrefix.length); + rt = new relation_type_1.RelationType(name, false); + } + else { + rt = new relation_type_1.RelationType(name, true); + } + } + return rt; +} +exports.getRelationByName = getRelationByName; +function addRelationType(name, outLabel, inLabel) { + // add outgoing relation + exports.RELATION_TYPES[name] = new relation_type_1.RelationType(name, true, outLabel); + // add inverse relation + exports.RELATION_TYPES[relation_type_1.invNamePrefix + name] = new relation_type_1.RelationType(name, false, inLabel); +} +//# sourceMappingURL=ismi-relation-types.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/ismi-relation-types.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/ismi-relation-types.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"ismi-relation-types.js","sourceRoot":"","sources":["ismi-relation-types.ts"],"names":[],"mappings":";AAAA,8BAA0C,iBAAiB,CAAC,CAAA;AAEjD,sBAAc,GAAkC,EAAE,CAAC;AAE9D,eAAe,CAAC,YAAY,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;AAC5D,eAAe,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;AAC5E,eAAe,CAAC,gBAAgB,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AA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AAyB,IAAY,EAAE,QAAgB,EAAE,OAAe;IACpE,wBAAwB;IACxB,sBAAc,CAAC,IAAI,CAAC,GAAG,IAAI,4BAAY,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC9D,uBAAuB;IACvB,sBAAc,CAAC,6BAAa,GAAG,IAAI,CAAC,GAAG,IAAI,4BAAY,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAClF,CAAC"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/ismi-result-types.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/ismi-result-types.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,14 @@ +"use strict"; +var result_type_1 = require('./result-type'); +exports.ISMI_RESULT_TYPES = { + '*': new result_type_1.ResultType('*', 'ismi_id', [ + 'ismi_id', 'label' + ]), + 'PERSON': new result_type_1.ResultType('PERSON', 'ismi_id', [ + 'ismi_id', 'name_translit', 'name', 'birth_date', 'death_date' + ]), + 'TEXT': new result_type_1.ResultType('TEXT', 'ismi_id', [ + 'ismi_id', 'full_title_translit', 'full_title', 'creation_date' + ]) +}; +//# sourceMappingURL=ismi-result-types.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/ismi-result-types.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/ismi-result-types.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"ismi-result-types.js","sourceRoot":"","sources":["ismi-result-types.ts"],"names":[],"mappings":";AAAA,4BAAyB,eAAe,CAAC,CAAA;AAG9B,yBAAiB,GAAgC;IACxD,GAAG,EAAE,IAAI,wBAAU,CAAC,GAAG,EAAE,SAAS,EAAE;QAC5B,SAAS,EAAE,OAAO;KACrB,CAAC;IACN,QAAQ,EAAE,IAAI,wBAAU,CAAC,QAAQ,EAAE,SAAS,EAAE;QAC1C,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;KACjE,CAAC;IACF,MAAM,EAAE,IAAI,wBAAU,CAAC,MAAM,EAAE,SAAS,EAAE;QACtC,SAAS,EAAE,qBAAqB,EAAE,YAAY,EAAE,eAAe;KAClE,CAAC;CACL,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/normalization.service.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/normalization.service.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,40 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var http_1 = require('@angular/http'); +require('rxjs/Rx'); // import all RxJS operators +var app_config_1 = require('./app-config'); +var NormalizationService = (function () { + function NormalizationService(_http) { + this._http = _http; + } + NormalizationService.prototype.fetchArabicTranslitNormalizedString = function (text) { + console.debug("fetching arabic translit normalized string: ", text); + var headers = new http_1.Headers(); + headers.append('Accept', 'application/json'); + // put headers in options + var opts = { 'headers': headers }; + // make get request asynchronously + var url = app_config_1.OPENMIND_BASE_URL + 'jsonInterface?method=normalize_string&type=arabic_translit&text='; + url += encodeURIComponent(text); + var resp = this._http.get(url, opts) + .map(function (res) { return res.json(); }); + // return Observable + return resp; + }; + NormalizationService = __decorate([ + core_1.Injectable(), + __metadata('design:paramtypes', [http_1.Http]) + ], NormalizationService); + return NormalizationService; +}()); +exports.NormalizationService = NormalizationService; +//# sourceMappingURL=normalization.service.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/normalization.service.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/normalization.service.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"normalization.service.js","sourceRoot":"","sources":["normalization.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAyB,eAAe,CAAC,CAAA;AACzC,qBAA4B,eAAe,CAAC,CAAA;AAE5C,QAAO,SAAS,CAAC,CAAA,CAAC,4BAA4B;AAE9C,2BAAgC,cAAc,CAAC,CAAA;AAG/C;IAEI,8BAAoB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;IAAG,CAAC;IAEnC,kEAAmC,GAAnC,UAAoC,IAAY;QAC5C,OAAO,CAAC,KAAK,CAAC,8CAA8C,EAAE,IAAI,CAAC,CAAC;QACpE,IAAI,OAAO,GAAG,IAAI,cAAO,EAAE,CAAC;QAC5B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC7C,yBAAyB;QACzB,IAAI,IAAI,GAAG,EAAC,SAAS,EAAE,OAAO,EAAC,CAAC;QAChC,kCAAkC;QAClC,IAAI,GAAG,GAAG,8BAAiB,GAAC,kEAAkE,CAAC;QAC/F,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC;aAEnC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC,CAAC;QACxB,oBAAoB;QACpB,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IAnBL;QAAC,iBAAU,EAAE;;4BAAA;IAqBb,2BAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,4BAAoB,uBAoBhC,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-app.component.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-app.component.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,88 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var query_service_1 = require('./query.service'); +var QueryAppComponent = (function () { + function QueryAppComponent(_queryService) { + var _this = this; + this._queryService = _queryService; + console.debug("QueryAppComponent constructor!"); + var newState = this.getStateStringFromUrlFragment(); + // initialize query service using external state + this._queryService.setup(newState); + this.queryStepList = []; + // set state in queryStepList + if (this._queryService.state.getNumSteps() > 0) { + // use state from URL + this._queryService.state.steps + .forEach(function (elem) { return _this.queryStepList.push('param'); }); + } + else { + // new empty state + this.addQueryStep(); + } + } + QueryAppComponent.prototype.getStateStringFromUrlFragment = function () { + var hash = window.location.hash; + if (hash) { + var fragb = hash.substr(1); + // base64 decode + var fragu = window.atob(fragb); + // url decode + var frag = decodeURIComponent(fragu); + // reset hash + window.location.hash = ''; + return frag; + } + return null; + }; + QueryAppComponent.prototype.getUrlFragmentFromState = function () { + var stateStr = this._queryService.state.getStateAsString(); + var frag = '#'; + if (stateStr.length > 0) { + var fragu = encodeURIComponent(stateStr); + var fragb = window.btoa(fragu); + frag += fragb; + } + return frag; + }; + QueryAppComponent.prototype.addQueryStep = function () { + this.queryStepList.push('step'); + }; + QueryAppComponent.prototype.removeQueryStep = function () { + this.queryStepList.pop(); + this._queryService.state.steps.pop(); + }; + QueryAppComponent.prototype.resetQuery = function () { + // reset everything by reloading + window.location.reload(); + }; + QueryAppComponent.prototype.showQueryUrl = function () { + var url = window.location.href; + url = url.replace(/#.*/, '') + this.getUrlFragmentFromState(); + window.prompt("URL to current query state", url); + }; + QueryAppComponent.prototype.onQueryChanged = function (event) { + console.debug("app.onquerychanged! event=", event); + this._queryService.runQuery(); + this.queryState = this._queryService.getState(); + }; + QueryAppComponent = __decorate([ + core_1.Component({ + selector: 'query-app', + template: "\n
\n

ISMI-Lab Query Builder

\n
\n
\n
Select a query step:
\n \n
\n \n \n \n \n
\n
\n
\n \n \n
\n ", + }), + __metadata('design:paramtypes', [query_service_1.QueryService]) + ], QueryAppComponent); + return QueryAppComponent; +}()); +exports.QueryAppComponent = QueryAppComponent; +//# sourceMappingURL=query-app.component.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-app.component.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-app.component.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-app.component.js","sourceRoot":"","sources":["query-app.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAwB,eAAe,CAAC,CAAA;AAKxC,8BAA2B,iBAAiB,CAAC,CAAA;AA8B7C;IAII,2BAAoB,aAA2B;QAJnD,iBAwEC;QApEuB,kBAAa,GAAb,aAAa,CAAc;QAC3C,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAChD,IAAI,QAAQ,GAAG,IAAI,CAAC,6BAA6B,EAAE,CAAC;QACpD,gDAAgD;QAChD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,6BAA6B;QAC7B,EAAE,CAA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CAAC;QAClB,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IAED,wCAAY,GAAZ;QACI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;IAED,2CAAe,GAAf;QACI,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACzC,CAAC;IAED,sCAAU,GAAV;QACI,gCAAgC;QAChC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC7B,CAAC;IAED,wCAAY,GAAZ;QACI,IAAI,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAA;QAC9B,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QAC9D,MAAM,CAAC,MAAM,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,0CAAc,GAAd,UAAe,KAAU;QACrB,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;IACpD,CAAC;IAlGL;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,WAAW;YACrB,QAAQ,EAAE,g4BAsBL;SACR,CAAC;;yBAAA;IA0EF,wBAAC;AAAD,CAAC,AAxED,IAwEC;AAxEY,yBAAiB,oBAwE7B,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-app.component.ts --- a/src/app/query-app.component.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query-app.component.ts Wed Mar 29 17:19:12 2017 +0200 @@ -1,5 +1,4 @@ import {Component} from '@angular/core'; -//import {HTTP_PROVIDERS} from '@angular/http'; import {QueryState} from './query-state'; import {QueryStep} from './query-step'; @@ -7,10 +6,6 @@ import {QueryService} from './query.service'; import {NormalizationService} from './normalization.service'; -import {QuerySelectComponent} from './query-select.component'; -import {QueryResultComponent} from './query-result.component'; -//import {QueryResultTableComponent} from './query-result-table.component'; - @Component({ selector: 'query-app', template: ` @@ -25,6 +20,8 @@
+ +
@@ -34,8 +31,6 @@
`, - //directives: [QuerySelectComponent, QueryResultTableComponent], - //providers: [QueryService, NormalizationService, HTTP_PROVIDERS] }) export class QueryAppComponent { @@ -43,9 +38,46 @@ public queryStepList: string[]; constructor(private _queryService: QueryService) { - this._queryService.setup(); + console.debug("QueryAppComponent constructor!"); + let newState = this.getStateStringFromUrlFragment(); + // initialize query service using external state + this._queryService.setup(newState); this.queryStepList = []; - this.addQueryStep(); + // set state in queryStepList + if (this._queryService.state.getNumSteps() > 0) { + // use state from URL + this._queryService.state.steps + .forEach((elem) => this.queryStepList.push('param')); + } else { + // new empty state + this.addQueryStep(); + } + } + + getStateStringFromUrlFragment(): string { + let hash: string = window.location.hash; + if (hash) { + let fragb: string = hash.substr(1); + // base64 decode + let fragu = window.atob(fragb); + // url decode + let frag = decodeURIComponent(fragu); + // reset hash + window.location.hash = ''; + return frag; + } + return null; + } + + getUrlFragmentFromState() { + let stateStr = this._queryService.state.getStateAsString(); + let frag = '#'; + if (stateStr.length > 0) { + let fragu = encodeURIComponent(stateStr); + let fragb = window.btoa(fragu); + frag += fragb; + } + return frag; } addQueryStep() { @@ -57,6 +89,17 @@ this._queryService.state.steps.pop(); } + resetQuery() { + // reset everything by reloading + window.location.reload(); + } + + showQueryUrl() { + let url = window.location.href + url = url.replace(/#.*/, '') + this.getUrlFragmentFromState(); + window.prompt("URL to current query state", url); + } + onQueryChanged(event: any) { console.debug("app.onquerychanged! event=", event); this._queryService.runQuery(); diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-app.module.ts --- a/src/app/query-app.module.ts Mon Mar 20 18:50:31 2017 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -import { NgModule } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { FormsModule } from '@angular/forms'; -import { HttpModule } from '@angular/http'; - -import { QueryAppComponent } from './query-app.component'; -import { QuerySelectComponent } from './query-select.component'; -import { QueryResultComponent } from './query-result.component'; -import { QueryResultRowComponent } from './query-result-row.component'; -//import { QueryResultTableComponent } from './query-result-table.component'; -import { QueryService } from './query.service'; -import { NormalizationService } from './normalization.service'; - - -@NgModule({ - imports: [ BrowserModule, FormsModule, HttpModule ], - declarations: [ QueryAppComponent, QuerySelectComponent, - QueryResultComponent, QueryResultRowComponent ], - providers: [ QueryService, NormalizationService ], - bootstrap: [ QueryAppComponent ] -}) -export class AppModule { } diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-mode.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-mode.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,18 @@ +"use strict"; +function getQueryModeById(id) { + return exports.QUERY_MODES.find(function (elem) { return elem.id === id; }); +} +exports.getQueryModeById = getQueryModeById; +exports.QUERY_MODES = [ + { id: 'type_is', label: 'Object type is' }, + { id: 'att_contains', label: 'Attribute (contains)' }, + { id: 'att_contains_norm', label: 'Attribute (contains normalized)' }, + { id: 'att_num_range', label: 'Attribute (number range)' }, + { id: 'relation_is', label: 'Relation type is' }, + { id: 'id_is', label: 'Object ID is' } +]; +exports.FIRST_QUERY_MODES = [ + { id: 'type_is', label: 'Object type is' }, + { id: 'id_is', label: 'Object ID is' } +]; +//# sourceMappingURL=query-mode.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-mode.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-mode.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-mode.js","sourceRoot":"","sources":["query-mode.ts"],"names":[],"mappings":";AAKA,0BAAiC,EAAU;IACvC,MAAM,CAAC,mBAAW,CAAC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,EAAE,KAAK,EAAE,EAAd,CAAc,CAAC,CAAC;AACtD,CAAC;AAFe,wBAAgB,mBAE/B,CAAA;AAEU,mBAAW,GAAgB;IAClC,EAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAC,gBAAgB,EAAC;IACvC,EAAC,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,sBAAsB,EAAC;IACnD,EAAC,EAAE,EAAE,mBAAmB,EAAE,KAAK,EAAE,iCAAiC,EAAC;IACnE,EAAC,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,0BAA0B,EAAC;IACxD,EAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,kBAAkB,EAAC;IAC9C,EAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAC;CACvC,CAAC;AAES,yBAAiB,GAAgB;IACxC,EAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAC,gBAAgB,EAAC;IACvC,EAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAC;CACvC,CAAC"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-mode.ts --- a/src/app/query-mode.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query-mode.ts Wed Mar 29 17:19:12 2017 +0200 @@ -3,6 +3,10 @@ label: string; } +export function getQueryModeById(id: string) { + return QUERY_MODES.find((elem) => elem.id === id); +} + export var QUERY_MODES: QueryMode[] = [ {id: 'type_is', label:'Object type is'}, {id: 'att_contains', label: 'Attribute (contains)'}, diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result-row.component.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result-row.component.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,29 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var QueryResultRowComponent = (function () { + function QueryResultRowComponent() { + } + QueryResultRowComponent.prototype.ngOnInit = function () { + console.debug("row init! rowType=", this.rowType, " columns=", this.columns, " rowData=", this.rowData); + }; + QueryResultRowComponent = __decorate([ + core_1.Component({ + selector: 'tr.resultRow', + template: "\n \n \n Link\n {{rowData[col.name]}}\n \n \n \n {{rowData}}\n \n ", + inputs: ['rowData', 'rowType', 'columns'] + }), + __metadata('design:paramtypes', []) + ], QueryResultRowComponent); + return QueryResultRowComponent; +}()); +exports.QueryResultRowComponent = QueryResultRowComponent; +//# sourceMappingURL=query-result-row.component.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result-row.component.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result-row.component.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-result-row.component.js","sourceRoot":"","sources":["query-result-row.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAwB,eAAe,CAAC,CAAA;AAmBxC;IAAA;IASA,CAAC;IAHG,0CAAQ,GAAR;QACI,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5G,CAAC;IAzBL;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,cAAc;YACxB,QAAQ,EAAE,0gBAWL;YACL,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;SAC5C,CAAC;;+BAAA;IAWF,8BAAC;AAAD,CAAC,AATD,IASC;AATY,+BAAuB,0BASnC,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result-table.component.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result-table.component.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,127 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var QueryResultTableComponent = (function () { + function QueryResultTableComponent() { + this.showTable = false; + this.currentPage = 1; + this.itemsPerPage = 10; + this.maxSize = 5; + this.numPages = 1; + this.length = 0; + this.config = { + paging: true, + sorting: { 'columns': this.columns }, + }; + } + QueryResultTableComponent.prototype.ngOnChanges = function (changes) { + console.debug("result table changed! changes=", changes); + this.data = this.queryState.results; + if (this.data.length > 0) { + this.allColumns = this.queryState.resultColumns; + this.columns = this.allColumns.filter(function (c) { return c.show; }); + this.config.sorting = this.columns; + this.config.paging = { 'page': this.currentPage, 'itemsPerPage': this.itemsPerPage }; + this.showTable = (this.data.length < 1000); + this.onChangeTable(this.config); + } + }; + QueryResultTableComponent.prototype.ngOnInit = function () { + console.debug("result table init!"); + }; + QueryResultTableComponent.prototype.onSelectNumItems = function (event) { + var selected = event.target.value; + console.debug("selected number of items:", selected); + var num = parseInt(selected); + if (num == 0) { + this.itemsPerPage = this.length; + } + else { + this.itemsPerPage = num; + } + // update something + this.config.paging = { 'page': this.currentPage, 'itemsPerPage': this.itemsPerPage }; + this.onChangeTable(this.config); + }; + QueryResultTableComponent.prototype.onSelectCols = function (event) { + console.debug("select cols:", this.allColumns); + this.columns = this.allColumns.filter(function (c) { return c.show; }); + this.config.sorting = this.columns; + }; + QueryResultTableComponent.prototype.changePage = function (page, data) { + if (data === void 0) { data = this.data; } + var start = (page.page - 1) * page.itemsPerPage; + var end = page.itemsPerPage > -1 ? (start + page.itemsPerPage) : data.length; + return data.slice(start, end); + }; + QueryResultTableComponent.prototype.changeSort = function (data, config) { + if (!config.sorting) { + return data; + } + var columns = this.columns.filter(function (c) { return c.sort; }); + // simple sorting + var sorted = data.sort(function (previous, current) { + for (var i = 0; i < columns.length; i++) { + var sort = columns[i].sort; + var columnName = columns[i].name; + if (previous[columnName] > current[columnName]) { + return sort === 'desc' ? -1 : 1; + } + else if (previous[columnName] < current[columnName]) { + return sort === 'asc' ? -1 : 1; + } + } + return 0; + }); + return sorted; + }; + QueryResultTableComponent.prototype.changeFilter = function (data, config) { + var _this = this; + if (!config.filtering) { + return data; + } + var filteredData = data.filter(function (item) { + return item[config.filtering.columnName].match(_this.config.filtering.filterString); + }); + return filteredData; + }; + QueryResultTableComponent.prototype.onChangeTable = function (config, page) { + if (page === void 0) { page = config.paging; } + console.debug("onChangeTable config=", config, " page=", page); + if (config.filtering) { + Object.assign(this.config.filtering, config.filtering); + } + if (config.sorting) { + Object.assign(this.config.sorting, config.sorting); + // changing sorting resets page + if (page == null) { + this.currentPage = 1; + page = { 'page': this.currentPage, 'itemsPerPage': this.itemsPerPage }; + } + } + //let filteredData = this.changeFilter(this.data, this.config); + //let sortedData = this.changeSort(filteredData, this.config); + var sortedData = this.changeSort(this.data, this.config); + this.rows = (page && this.config.paging) ? this.changePage(page, sortedData) : sortedData; + this.length = sortedData.length; + }; + QueryResultTableComponent = __decorate([ + core_1.Component({ + selector: 'query-result', + template: "\n
0\">\n Cypher query:\n
{{queryState.getQueryText()}}
\n

Query result

\n
{{resultInfo}}
\n
\n
\n
\n
Show \n \n results per page.\n
\n
\n
\n Columns:\n \n {{col.name}}\n \n \n
\n
\n \n \n \n \n
\n
\n
0)\">\n

No results found

\n
\n ", + inputs: ['queryState', 'resultInfo'] + }), + __metadata('design:paramtypes', []) + ], QueryResultTableComponent); + return QueryResultTableComponent; +}()); +exports.QueryResultTableComponent = QueryResultTableComponent; +//# sourceMappingURL=query-result-table.component.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result-table.component.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result-table.component.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-result-table.component.js","sourceRoot":"","sources":["query-result-table.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AAwDhD;IAAA;QAKW,cAAS,GAAG,KAAK,CAAC;QAOlB,gBAAW,GAAW,CAAC,CAAC;QACxB,iBAAY,GAAW,EAAE,CAAC;QAC1B,YAAO,GAAW,CAAC,CAAC;QACpB,aAAQ,GAAW,CAAC,CAAC;QACrB,WAAM,GAAW,CAAC,CAAC;QAEnB,WAAM,GAAQ;YACjB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,EAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAC;SAErC,CAAC;IAmGN,CAAC;IAjGG,+CAAW,GAAX,UAAY,OAAY;QACpB,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,U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HC;AAzHY,iCAAyB,4BAyHrC,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result-table.component.ts --- a/src/app/query-result-table.component.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query-result-table.component.ts Wed Mar 29 17:19:12 2017 +0200 @@ -1,14 +1,11 @@ import {Component, OnInit} from '@angular/core'; -//import {NG_TABLE_DIRECTIVES} from 'ng2-table/ng2-table'; -//import {PAGINATION_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; - import {QueryState} from './query-state'; @Component({ selector: 'query-result', template: ` -
+
Cypher query:
{{queryState.getQueryText()}}

Query result

@@ -17,7 +14,7 @@
Show - @@ -27,16 +24,14 @@
Columns: - - {{col.name}} + + {{col.name}}
-
Page {{page}} of {{numPages}}
-
- `, - inputs: ['queryState', 'resultInfo'], -// directives: [NG_TABLE_DIRECTIVES, PAGINATION_DIRECTIVES] +
+

No results found

+
+ `, + inputs: ['queryState', 'resultInfo'] }) export class QueryResultTableComponent implements OnInit { @@ -69,7 +66,7 @@ public rows: Array; - public page: number = 1; + public currentPage: number = 1; public itemsPerPage: number = 10; public maxSize: number = 5; public numPages: number = 1; @@ -84,12 +81,14 @@ ngOnChanges(changes: any) { console.debug("result table changed! changes=", changes); this.data = this.queryState.results; - this.allColumns = this.queryState.resultColumns; - this.columns = this.allColumns.filter(c => c.show); - this.config.sorting = this.columns; - this.config.paging = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; - this.showTable = (this.data.length < 1000); - this.onChangeTable(this.config); + if (this.data.length > 0) { + this.allColumns = this.queryState.resultColumns; + this.columns = this.allColumns.filter(c => c.show); + this.config.sorting = this.columns; + this.config.paging = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; + this.showTable = (this.data.length < 1000); + this.onChangeTable(this.config); + } } ngOnInit() { @@ -106,7 +105,7 @@ this.itemsPerPage = num; } // update something - this.config.paging = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; + this.config.paging = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; this.onChangeTable(this.config); } @@ -116,7 +115,7 @@ this.config.sorting = this.columns; } - changePage(page:any, data:Array = this.data):Array { + changePage(page: any, data: Array = this.data): Array { let start = (page.page - 1) * page.itemsPerPage; let end = page.itemsPerPage > -1 ? (start + page.itemsPerPage) : data.length; return data.slice(start, end); @@ -163,8 +162,8 @@ Object.assign(this.config.sorting, config.sorting); // changing sorting resets page if (page == null) { - this.page = 1; - page = {'page': this.page, 'itemsPerPage': this.itemsPerPage}; + this.currentPage = 1; + page = {'page': this.currentPage, 'itemsPerPage': this.itemsPerPage}; } } diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result.component.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result.component.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,27 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var QueryResultComponent = (function () { + function QueryResultComponent() { + } + QueryResultComponent = __decorate([ + core_1.Component({ + selector: 'query-result', + template: "\n
\n Cypher query:\n
{{queryState.resultCypherQuery}}
\n

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

\n \n \n \n \n \n \n \n \n
{{col?col.title:col}}
\n
\n ", + //directives: [QueryResultRowComponent], + inputs: ['queryState', 'resultInfo'] + }), + __metadata('design:paramtypes', []) + ], QueryResultComponent); + return QueryResultComponent; +}()); +exports.QueryResultComponent = QueryResultComponent; +//# sourceMappingURL=query-result.component.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-result.component.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-result.component.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-result.component.js","sourceRoot":"","sources":["query-result.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAgC,eAAe,CAAC,CAAA;AA8BhD;IAAA;IAKA,CAAC;IA7BD;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,cAAc;YACxB,QAAQ,EAAE,svBAiBL;YACL,wCAAwC;YACxC,MAAM,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC;SACvC,CAAC;;4BAAA;IAOF,2BAAC;AAAD,CAAC,AALD,IAKC;AALY,4BAAoB,uBAKhC,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-select.component.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-select.component.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,211 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var query_step_1 = require('./query-step'); +var query_service_1 = require('./query.service'); +var normalization_service_1 = require('./normalization.service'); +var ismi_relation_types_1 = require('./ismi-relation-types'); +var QuerySelectComponent = (function () { + function QuerySelectComponent(_queryService, _normService) { + this._queryService = _queryService; + this._normService = _normService; + // output queryChanged + this.queryChanged = new core_1.EventEmitter(); + } + QuerySelectComponent.prototype.ngOnInit = function () { + this.setup(); + }; + QuerySelectComponent.prototype.setup = function () { + console.log("query-select setup step=", this.queryStep); + var step = this._queryService.state.steps[this.index]; // i-1? + if (step != null) { + this.setQueryStep(step); + } + }; + QuerySelectComponent.prototype.getQueryModes = function () { + this.queryModes = this._queryService.getQueryModes(this.index); + return this.queryModes; + }; + QuerySelectComponent.prototype.onSelectMode = function (event) { + var selected = event.target.value; + this.selectedMode = this.queryModes.find(function (mode) { return mode.id === selected; }); + this.queryOptions = this._queryService.getQueryOptions(this.selectedMode); + }; + QuerySelectComponent.prototype.onSelectOption = function (event) { + var selected = event.target.value; + console.debug("selected option:", selected); + this.selectedOption = selected; + this.onSubmit(); + }; + QuerySelectComponent.prototype.onSubmit = function () { + console.debug("Submit! selectedMode=", this.selectedMode, " selectedOption=", this.selectedOption, " queryInput=", this.queryInput); + var step = this.getQueryStep(); + /* + * set step and submit change event + */ + if (step != null) { + this._queryService.setQueryStep(this.index, step); + this.queryChanged.emit(this._queryService.getState()); + } + return false; + }; + /** + * Returns QueryStep from current form state. + */ + QuerySelectComponent.prototype.getQueryStep = function () { + var _this = this; + var step = null; + if (this.selectedMode.id === 'type_is') { + /* + * type_is + */ + var opt = this.selectedOption; + if (opt) { + step = new query_step_1.QueryStep(this.selectedMode, { 'objectType': opt }); + } + } + else if (this.selectedMode.id === 'relation_is') { + /* + * relation_is + */ + var opt = this.selectedOption; + if (opt) { + var rel = ismi_relation_types_1.getRelationByName(opt); + step = new query_step_1.QueryStep(this.selectedMode, { 'relationType': rel }); + } + } + else if (this.selectedMode.id === 'id_is') { + /* + * id is + */ + var val = this.queryInput; + if (val) { + step = new query_step_1.QueryStep(this.selectedMode, { 'value': val }); + } + } + else if (this.selectedMode.id === 'att_contains') { + /* + * att_contains + */ + var att = this.selectedOption; + var val = this.queryInput; + if (att && val) { + step = new query_step_1.QueryStep(this.selectedMode, { 'attribute': att, 'value': val }); + } + } + else if (this.selectedMode.id === 'att_num_range') { + /* + * att_num_range + */ + var att = this.selectedOption; + var nlo = this.queryInput; + var nhi = this.queryInput2; + if (att && nlo && nhi) { + step = new query_step_1.QueryStep(this.selectedMode, { 'attribute': att, 'numLo': nlo, 'numHi': nhi }); + } + } + else if (this.selectedMode.id === 'att_contains_norm') { + /* + * att_contains_norm + * + * calls normalization service and submits event in callback + */ + var att_1 = this.selectedOption; + var val_1 = this.queryInput; + if (att_1 && val_1) { + // run search term through normalizer + this._normService.fetchArabicTranslitNormalizedString(val_1) + .subscribe(function (data) { + console.debug("openmind norm data=", data); + step = new query_step_1.QueryStep(_this.selectedMode, { 'attribute': att_1, 'value': val_1, 'normValue': data.normalized_text }); + _this._queryService.setQueryStep(_this.index, step); + // query has changed now + _this.queryChanged.emit(_this._queryService.getState()); + }, function (err) { return console.error("openmind norm error=", err); }, function () { return console.debug("openmind norm query Complete"); }); + // query has not been set yet (gets set in callback) + return null; + } + } + return step; + }; + /** + * Sets form state from given QueryStep. + */ + QuerySelectComponent.prototype.setQueryStep = function (step) { + var mode = step.mode; + this.selectedMode = mode; + if (mode.id === 'id_is') { + /* + * id_is + */ + this.queryInput = step.params.value; + } + else if (mode.id === 'type_is') { + /* + * type_is + */ + var name_1 = step.params.objectType; + this.queryOptions = [name_1]; + this.selectedOption = name_1; + } + else if (this.selectedMode.id === 'relation_is') { + /* + * relation_is + */ + var name_2 = step.params.relationType.name; + var rel = ismi_relation_types_1.getRelationByName(name_2); + this.queryOptions = [rel]; + this.selectedOption = name_2; + } + else if (this.selectedMode.id === 'att_contains') { + /* + * att_contains + */ + var name_3 = step.params.attribute; + this.queryOptions = [name_3]; + this.selectedOption = name_3; + this.queryInput = step.params.value; + } + else if (this.selectedMode.id === 'att_num_range') { + /* + * att_num_range + */ + var name_4 = step.params.attribute; + this.queryOptions = [name_4]; + this.selectedOption = name_4; + this.queryInput = step.params.numLo; + this.queryInput2 = step.params.numHi; + } + else if (this.selectedMode.id === 'att_contains_norm') { + /* + * att_contains_norm + */ + var name_5 = step.params.attribute; + this.queryOptions = [name_5]; + this.selectedOption = name_5; + this.queryInput = step.params.value; + } + // TODO: implement other modes + this.resultInfo = step.resultInfo; + }; + QuerySelectComponent = __decorate([ + core_1.Component({ + selector: 'query-select', + template: "\n

   result: {{resultInfo}}

\n
\n
\n \n\n \n \n \n\n \n \n \n\n \n \n contains\n \n \n\n \n \n is between\n \n and\n \n \n\n \n \n \n\n \n
\n
\n ", + inputs: ['queryStep', 'index'], + outputs: ['queryChanged'] + }), + __metadata('design:paramtypes', [query_service_1.QueryService, normalization_service_1.NormalizationService]) + ], QuerySelectComponent); + return QuerySelectComponent; +}()); +exports.QuerySelectComponent = QuerySelectComponent; +//# sourceMappingURL=query-select.component.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-select.component.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-select.component.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-select.component.js","sourceRoot":"","sources":["query-select.component.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAsD,eAAe,CAAC,CAAA;AAGtE,2BAAwB,cAAc,CAAC,CAAA;AAGvC,8BAA2B,iBAAiB,CAAC,CAAA;AAC7C,sCAAmC,yBAAyB,CAAC,CAAA;AAC7D,oCAAgC,uBAAuB,CAAC,CAAA;AAuExD;IAcI,8BAAoB,aAA2B,EAAU,YAAkC;QAAvE,kBAAa,GAAb,aAAa,CAAc;QAAU,iBAAY,GAAZ,YAAY,CAAsB;QAH3F,sBAAsB;QACf,iBAAY,GAA6B,IAAI,mBAAY,EAAc,CAAC;IAEe,CAAC;IAE/F,uCAAQ,GAAR;QACI,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAED,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,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAA;YAChC,IAAI,CAAC,YAAY,GAAG,CAAC,MAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,cAAc,GAAG,MAAI,CAAC;YAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;YACpC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAEzC,CAAC;QAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,KAAK,mBAAmB,CAAC,CAAC,CAAC;YACtD;;eAEG;YACH,IAAI,MAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAA;YAChC,IAAI,CAAC,YAAY,GAAG,CAAC,MAAI,CAAC,CAAC;YAC3B,IAAI,CAAC,cAAc,GAAG,MAAI,CAAC;YAC3B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACxC,CAAC;QACD,8BAA8B;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;IACtC,CAAC;IA3QL;QAAC,gBAAS,CAAC;YACP,QAAQ,EAAE,cAAc;YACxB,QAAQ,EAAE,ylFA6DL;YACL,MAAM,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC;YAC9B,OAAO,EAAE,CAAC,cAAc,CAAC;SAC5B,CAAC;;4BAAA;IA0MF,2BAAC;AAAD,CAAC,AAxMD,IAwMC;AAxMY,4BAAoB,uBAwMhC,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-select.component.ts --- a/src/app/query-select.component.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query-select.component.ts Wed Mar 29 17:19:12 2017 +0200 @@ -17,7 +17,8 @@
@@ -80,9 +81,9 @@ public queryStep: string; public index: number; public resultInfo: string; - public queryModes: QueryMode[]; + public queryModes: Array; public selectedMode: QueryMode; - public queryOptions: string[]; + public queryOptions: any[]; public selectedOption: string; public queryInput: string; public queryInput2: string; @@ -98,9 +99,9 @@ setup() { console.log("query-select setup step=", this.queryStep); - var step = this._queryService.state.steps[this.index-1]; + var step = this._queryService.state.steps[this.index]; // i-1? if (step != null) { - this.resultInfo = step.resultInfo; + this.setQueryStep(step); } } @@ -124,8 +125,26 @@ onSubmit() { console.debug("Submit! selectedMode=", this.selectedMode, " selectedOption=", this.selectedOption, " queryInput=", this.queryInput); - var step: QueryStep; - if (this.selectedMode.id == 'type_is') { + + let step = this.getQueryStep(); + + /* + * set step and submit change event + */ + if (step != null) { + this._queryService.setQueryStep(this.index, step); + this.queryChanged.emit(this._queryService.getState()); + } + return false; + } + + /** + * Returns QueryStep from current form state. + */ + getQueryStep(): QueryStep { + let step: QueryStep = null; + + if (this.selectedMode.id === 'type_is') { /* * type_is */ @@ -133,7 +152,7 @@ if (opt) { step = new QueryStep(this.selectedMode, {'objectType': opt}); } - } else if (this.selectedMode.id == 'relation_is') { + } else if (this.selectedMode.id === 'relation_is') { /* * relation_is */ @@ -142,7 +161,7 @@ let rel = getRelationByName(opt); step = new QueryStep(this.selectedMode, {'relationType': rel}); } - } else if (this.selectedMode.id == 'id_is') { + } else if (this.selectedMode.id === 'id_is') { /* * id is */ @@ -150,7 +169,7 @@ if (val) { step = new QueryStep(this.selectedMode, {'value': val}); } - } else if (this.selectedMode.id == 'att_contains') { + } else if (this.selectedMode.id === 'att_contains') { /* * att_contains */ @@ -159,7 +178,7 @@ if (att && val) { step = new QueryStep(this.selectedMode, {'attribute': att, 'value': val}); } - } else if (this.selectedMode.id == 'att_num_range') { + } else if (this.selectedMode.id === 'att_num_range') { /* * att_num_range */ @@ -169,7 +188,7 @@ if (att && nlo && nhi) { step = new QueryStep(this.selectedMode, {'attribute': att, 'numLo': nlo, 'numHi': nhi}); } - } else if (this.selectedMode.id == 'att_contains_norm') { + } else if (this.selectedMode.id === 'att_contains_norm') { /* * att_contains_norm * @@ -191,17 +210,71 @@ err => console.error("openmind norm error=", err), () => console.debug("openmind norm query Complete") ); - // query has not been set yet - return; + // query has not been set yet (gets set in callback) + return null; } } - - /* - * set step and submit change event + return step; + } + + /** + * Sets form state from given QueryStep. + */ + setQueryStep(step: QueryStep) { + let mode = step.mode; + this.selectedMode = mode; + if (mode.id === 'id_is') { + /* + * id_is */ - if (step != null) { - this._queryService.setQueryStep(this.index, step); - this.queryChanged.emit(this._queryService.getState()); + this.queryInput = step.params.value; + + } else if (mode.id === 'type_is') { + /* + * type_is + */ + let name = step.params.objectType; + this.queryOptions = [name]; + this.selectedOption = name; + + } else if (this.selectedMode.id === 'relation_is') { + /* + * relation_is + */ + let name = step.params.relationType.name + let rel = getRelationByName(name); + this.queryOptions = [rel]; + this.selectedOption = name; + + } else if (this.selectedMode.id === 'att_contains') { + /* + * att_contains + */ + let name = step.params.attribute + this.queryOptions = [name]; + this.selectedOption = name; + this.queryInput = step.params.value; + + } else if (this.selectedMode.id === 'att_num_range') { + /* + * att_num_range + */ + let name = step.params.attribute + this.queryOptions = [name]; + this.selectedOption = name; + this.queryInput = step.params.numLo; + this.queryInput2 = step.params.numHi; + + } else if (this.selectedMode.id === 'att_contains_norm') { + /* + * att_contains_norm + */ + let name = step.params.attribute + this.queryOptions = [name]; + this.selectedOption = name; + this.queryInput = step.params.value; } + // TODO: implement other modes + this.resultInfo = step.resultInfo; } } diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-state.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-state.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,71 @@ +"use strict"; +var query_step_1 = require('./query-step'); +var query_mode_1 = require('./query-mode'); +var QueryState = (function () { + function QueryState() { + this.steps = []; + } + /** + * Sets the query state from a string. + */ + QueryState.prototype.setStateFromString = function (newStateString) { + try { + // state string is json + var newState = JSON.parse(newStateString); + // state should be list of steps + if (!Array.isArray(newState)) + return; + var newSteps_1 = []; + newState.forEach(function (elem) { + // step is an array [mode, params] + if (!Array.isArray(elem)) + return; + var mode = elem[0]; + // get QueryMode object + var qm = query_mode_1.getQueryModeById(mode); + var params = elem[1]; + if (qm != null && params != null) { + // construct QueryStep + var qs = new query_step_1.QueryStep(qm, params); + newSteps_1.push(qs); + } + }); + if (newSteps_1.length > 0) { + // set new state + this.steps = newSteps_1; + } + } + catch (e) { + console.error("Unable to set state from string: " + newStateString); + } + }; + QueryState.prototype.getNumSteps = function () { + return this.steps.length; + }; + /** + * Returns the current query state as a string. + */ + QueryState.prototype.getStateAsString = function () { + var stateList = this.steps.map(function (qs) { return [qs.mode.id, qs.params]; }); + var stateStr = JSON.stringify(stateList); + return stateStr; + }; + /** + * Returns the cypher query as text for display. + */ + QueryState.prototype.getQueryText = function () { + var text = this.resultCypherQuery; + var hasParams = false; + for (var k in this.cypherQueryParams) { + if (!hasParams) { + hasParams = true; + text += '\n'; + } + text += "[" + k + "='" + this.cypherQueryParams[k] + "'] "; + } + return text; + }; + return QueryState; +}()); +exports.QueryState = QueryState; +//# sourceMappingURL=query-state.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-state.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-state.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-state.js","sourceRoot":"","sources":["query-state.ts"],"names":[],"mappings":";AAAA,2BAAwB,cAAc,CAAC,CAAA;AAEvC,2BAA0C,cAAc,CAAC,CAAA;AAEzD;IAAA;QACW,UAAK,GAAgB,EAAE,CAAC;IA8EnC,CAAC;IA5DG;;OAEG;IACH,uCAAkB,GAAlB,UAAmB,cAAsB;QACrC,IAAI,CAAC;YACD,uBAAuB;YACvB,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC1C,gCAAgC;YAChC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,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B,CAAC,CAAC;QAChE,IAAI,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QACzC,MAAM,CAAC,QAAQ,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,iCAAY,GAAZ;QACI,IAAI,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAClC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;YACnC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;gBACb,SAAS,GAAG,IAAI,CAAC;gBACjB,IAAI,IAAI,IAAI,CAAC;YACjB,CAAC;YACD,IAAI,IAAI,MAAI,CAAC,UAAK,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAK,CAAC;QACrD,CAAC;QACD,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IACL,iBAAC;AAAD,CAAC,AA/ED,IA+EC;AA/EY,kBAAU,aA+EtB,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-state.ts --- a/src/app/query-state.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query-state.ts Wed Mar 29 17:19:12 2017 +0200 @@ -1,5 +1,6 @@ import {QueryStep} from './query-step'; import {ResultType} from './result-type'; +import {QueryMode, getQueryModeById} from './query-mode'; export class QueryState { public steps: QueryStep[] = []; @@ -15,10 +16,59 @@ public resultTypes: string; public resultType: ResultType; public resultInfo: string; - public resultAttributes: string[]; + public resultAttributes: string[]; public resultRelations: any[]; public resultColumns: any[]; + + /** + * Sets the query state from a string. + */ + setStateFromString(newStateString: string) { + try { + // state string is json + let newState = JSON.parse(newStateString); + // state should be list of steps + if (!Array.isArray(newState)) return; + let newSteps: QueryStep[] = []; + newState.forEach((elem) => { + // step is an array [mode, params] + if (!Array.isArray(elem)) return; + let mode = elem[0]; + // get QueryMode object + let qm: QueryMode = getQueryModeById(mode); + let params = elem[1]; + if (qm != null && params != null) { + // construct QueryStep + let qs = new QueryStep(qm, params); + newSteps.push(qs); + } + }); + if (newSteps.length > 0) { + // set new state + this.steps = newSteps; + } + } catch (e) { + console.error("Unable to set state from string: "+newStateString); + } + } + + getNumSteps() { + return this.steps.length; + } + + /** + * Returns the current query state as a string. + */ + getStateAsString(): string { + let stateList = this.steps.map((qs) => [qs.mode.id, qs.params]); + let stateStr = JSON.stringify(stateList); + return stateStr; + } + + /** + * Returns the cypher query as text for display. + */ getQueryText() { let text = this.resultCypherQuery; let hasParams = false; diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-step.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-step.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,10 @@ +"use strict"; +var QueryStep = (function () { + function QueryStep(mode, params) { + this.mode = mode; + this.params = params; + } + return QueryStep; +}()); +exports.QueryStep = QueryStep; +//# sourceMappingURL=query-step.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query-step.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query-step.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query-step.js","sourceRoot":"","sources":["query-step.ts"],"names":[],"mappings":";AAEA;IAOI,mBAAa,IAAe,EAAE,MAAW;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IACL,gBAAC;AAAD,CAAC,AAXD,IAWC;AAXY,iBAAS,YAWrB,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query.service.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query.service.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,359 @@ +"use strict"; +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +var core_1 = require('@angular/core'); +var http_1 = require('@angular/http'); +require('rxjs/Rx'); // import all RxJS operators +//import 'rxjs/add/operator/map'; +var app_config_1 = require('./app-config'); +var query_mode_1 = require('./query-mode'); +var query_state_1 = require('./query-state'); +var result_type_1 = require('./result-type'); +var ismi_result_types_1 = require('./ismi-result-types'); +var ismi_relation_types_1 = require('./ismi-relation-types'); +var QueryService = (function () { + function QueryService(_http) { + this._http = _http; + this.typeAttribute = '_type'; + this.excludedAttributes = {}; + // init query state + this.state = new query_state_1.QueryState(); + } + QueryService.prototype.setup = function (newStateString) { + // get list of object types + this.setupObjectTypes(); + // get state from string + if (newStateString) { + this.state.setStateFromString(newStateString); + } + }; + QueryService.prototype.getState = function () { + return this.state; + }; + QueryService.prototype.getQueryModes = function (index) { + if (index == 0) { + return query_mode_1.FIRST_QUERY_MODES; + } + else { + return query_mode_1.QUERY_MODES; + } + }; + /** + * return the first set of options for the given query mode. + */ + QueryService.prototype.getQueryOptions = function (queryMode) { + var options = []; + if (queryMode == null) + return options; + if (queryMode.id === 'type_is') { + options = this.objectTypes; + } + else if (queryMode.id === 'relation_is') { + options = this.state.resultRelations; + } + else if (queryMode.id === 'att_contains') { + options = this.filterAttributes(this.state.resultAttributes); + } + else if (queryMode.id === 'att_contains_norm') { + options = this.filterAttributes(this.state.resultAttributes, true); + } + else if (queryMode.id === 'att_num_range') { + options = this.filterAttributes(this.state.resultAttributes); + } + console.debug("getQueryOptions returns: ", options); + return options; + }; + /** + * fetch all object types from Neo4j and store in this.objectTypes. + */ + QueryService.prototype.setupObjectTypes = function () { + var _this = this; + var query = "MATCH (n) WITH DISTINCT labels(n) AS labels\n UNWIND labels AS label \n RETURN DISTINCT label ORDER BY label"; + var res = this.fetchCypherResults([query]); + res.subscribe(function (data) { + console.debug("neo4j data=", data); + _this.objectTypes = data.results[0].data + .map(function (elem) { return elem.row[0]; }) + .filter(function (elem) { return elem[0] != "_"; }); + console.debug("object types=", _this.objectTypes); + }, function (err) { return console.error("neo4j error=", err); }, function () { return console.debug('neo4j query Complete'); }); + }; + /** + * Set the query step at index. + */ + QueryService.prototype.setQueryStep = function (index, step) { + this.state.steps[index] = step; + }; + /** + * Create the cypher queries for the current query state. + * + * Updates the queries for results, attributes and relations. + */ + QueryService.prototype.createCypherQuery = function () { + var queryMatch = ''; + var queryWhere = ''; + var queryReturn = ''; + var queryParams = {}; + var resultQuery = ''; + var attributesQuery = ''; + var outRelsQuery = ''; + var inRelsQuery = ''; + var returnType = ''; + var nIdx = 1; + this.state.steps.forEach(function (step, stepIdx) { + var mode = step.mode.id; + var params = step.params; + /* + * step: object type is + */ + if (mode === 'type_is') { + queryMatch = "MATCH (n" + nIdx + ":" + params.objectType + ")"; + queryWhere = ''; + queryReturn = "RETURN n" + nIdx; + returnType = 'node'; + } + /* + * step: object id is + */ + if (mode === 'id_is') { + if (!queryMatch) { + // first step - use match clause + queryMatch = "MATCH (n" + nIdx + " {ismi_id: {att_val" + stepIdx + "}})"; + queryParams[("att_val" + stepIdx)] = parseInt(params.value, 10); + queryWhere = ''; + queryReturn = "RETURN n" + nIdx; + returnType = 'node'; + } + else { + // use where clause + if (!queryWhere) { + queryWhere = 'WHERE '; + } + else { + queryWhere += ' AND '; + } + queryWhere += "n" + nIdx + ".ismi_id = {att_val" + stepIdx + "}"; + queryParams[("att_val" + stepIdx)] = parseInt(params.value, 10); + } + } + /* + * step: relation type is + */ + if (mode === 'relation_is') { + nIdx += 1; + var rel = params.relationType; + if (rel.isOutgoing()) { + queryMatch += "-[:`" + rel.getRelType() + "`]->(n" + nIdx + ")"; + } + else { + // inverse relation + queryMatch += "<-[:`" + rel.getRelType() + "`]-(n" + nIdx + ")"; + } + queryReturn = "RETURN DISTINCT n" + nIdx; + returnType = 'node'; + } + /* + * step: attribute contains(_norm) + */ + if (mode === 'att_contains' || mode === 'att_contains_norm') { + if (!queryWhere) { + queryWhere = 'WHERE '; + } + else { + queryWhere += ' AND '; + } + if (params.attribute === 'ismi_id') { + // ismi_id is integer + queryWhere += "n" + nIdx + ".ismi_id = {att_val" + stepIdx + "}"; + queryParams[("att_val" + stepIdx)] = parseInt(params.value, 10); + } + else { + if (mode === 'att_contains_norm') { + // match _n_attribute with normValue + queryWhere += "lower(n" + nIdx + "._n_" + params.attribute + ") CONTAINS lower({att_val" + stepIdx + "})"; + queryParams[("att_val" + stepIdx)] = params.normValue; + } + else { + queryWhere += "lower(n" + nIdx + "." + params.attribute + ") CONTAINS lower({att_val" + stepIdx + "})"; + queryParams[("att_val" + stepIdx)] = params.value; + } + } + } + /* + * step: attribute number range + */ + if (mode === 'att_num_range') { + if (!queryWhere) { + queryWhere = 'WHERE '; + } + else { + queryWhere += ' AND '; + } + queryWhere += ("toint(n" + nIdx + "." + params.attribute + ") >= toint({att_nlo" + stepIdx + "})") + + (" AND toint(n" + nIdx + "." + params.attribute + ") <= toint({att_nhi" + stepIdx + "})"); + queryParams[("att_nlo" + stepIdx)] = params.numLo; + queryParams[("att_nhi" + stepIdx)] = params.numHi; + } + }); + // compose query + resultQuery = queryMatch + (queryWhere ? '\n' + queryWhere : '') + '\n' + queryReturn; + // compose query for attributes of result + attributesQuery = queryMatch + ' ' + queryWhere + (" WITH DISTINCT keys(n" + nIdx + ") AS atts") + + " UNWIND atts AS att RETURN DISTINCT att ORDER BY att"; + // compose query for relations of result + outRelsQuery = queryMatch + '-[r]->() ' + queryWhere + ' RETURN DISTINCT type(r)'; + inRelsQuery = queryMatch + '<-[r]-() ' + queryWhere + ' RETURN DISTINCT type(r)'; + this.state.resultCypherQuery = resultQuery; + this.state.cypherQueryParams = queryParams; + this.state.attributesCypherQuery = attributesQuery; + this.state.outRelsCypherQuery = outRelsQuery; + this.state.inRelsCypherQuery = inRelsQuery; + this.state.resultTypes = returnType; + }; + /** + * Create and run the cypher queries for the current query state. + * + * Updates the results and nextQuery attributes and relations. + */ + QueryService.prototype.runQuery = function () { + var _this = this; + this.createCypherQuery(); + this.state.resultInfo = 'loading...'; + /* + * run query for result table + */ + var queries = [this.state.resultCypherQuery]; + var params = [this.state.cypherQueryParams]; + if (this.state.attributesCypherQuery) { + queries.push(this.state.attributesCypherQuery); + params.push(this.state.cypherQueryParams); + } + if (this.state.outRelsCypherQuery) { + queries.push(this.state.outRelsCypherQuery); + params.push(this.state.cypherQueryParams); + } + if (this.state.inRelsCypherQuery) { + queries.push(this.state.inRelsCypherQuery); + params.push(this.state.cypherQueryParams); + } + var res = this.fetchCypherResults(queries, params); + res.subscribe(function (data) { + console.debug("neo4j result data=", data); + var resIdx = 0; + /* + * results for result table + */ + _this.state.results = data.results[resIdx].data.map(function (elem) { return elem.row[0]; }); + _this.state.numResults = _this.state.results.length; + // count all types + var resTypes = {}; + _this.state.results.forEach(function (r) { + var t = r[_this.typeAttribute]; + if (resTypes[t] == null) { + resTypes[t] = 1; + } + else { + resTypes[t] += 1; + } + }); + var info = ''; + for (var t in resTypes) { + info += t + '(' + resTypes[t] + ') '; + } + info = info.substr(0, info.length - 1); + _this.state.resultInfo = info; + // save info also in last step + _this.state.steps[_this.state.steps.length - 1].resultInfo = info; + /* + * results for attribute list + */ + if (_this.state.attributesCypherQuery) { + resIdx += 1; + var atts = data.results[resIdx].data.map(function (elem) { return elem.row[0]; }); + _this.state.resultAttributes = atts; + // the following assumes only one type in the result + for (var t in resTypes) { + _this.state.resultType = result_type_1.getResultType(t, ismi_result_types_1.ISMI_RESULT_TYPES); + break; + } + _this.state.resultColumns = _this.state.resultType.getColumns(atts); + } + /* + * results for relations list + */ + if (_this.state.outRelsCypherQuery) { + // outgoing aka forward relations + resIdx += 1; + var rels = data.results[resIdx].data.map(function (elem) { return elem.row[0]; }) + .filter(function (elem) { return elem[0] != "_"; }) + .map(function (elem) { return ismi_relation_types_1.getRelationType(elem, true); }); + _this.state.resultRelations = rels; + } + if (_this.state.inRelsCypherQuery) { + // incoming aka reverse relations + resIdx += 1; + var rels = data.results[resIdx].data.map(function (elem) { return elem.row[0]; }) + .filter(function (elem) { return elem[0] != "_"; }) + .map(function (elem) { return ismi_relation_types_1.getRelationType(elem, false); }); + _this.state.resultRelations = _this.state.resultRelations.concat(rels); + } + }, function (err) { return console.error("neo4j result error=", err); }, function () { return console.debug('neo4j result query Complete'); }); + }; + QueryService.prototype.filterAttributes = function (attributes, normalized) { + var _this = this; + if (normalized === void 0) { normalized = false; } + var atts = []; + if (normalized) { + attributes.forEach(function (att) { + if (att.substr(0, 3) == "_n_") { + atts.push(att.substr(3)); + } + }); + } + else { + atts = attributes.filter(function (elem) { return elem[0] != "_" && !_this.excludedAttributes[elem]; }); + } + return atts; + }; + /** + * Run the given queries on the Neo4J server. + * + * Returns an Observable with the results. + */ + QueryService.prototype.fetchCypherResults = function (queries, params) { + if (params === void 0) { params = [{}]; } + console.debug("fetching cypher queries: ", queries); + var headers = new http_1.Headers(); + var auth = app_config_1.NEO4J_AUTHENTICATION; + headers.append('Authorization', 'Basic ' + btoa(auth.user + ":" + auth.password)); + headers.append('Content-Type', 'application/json'); + headers.append('Accept', 'application/json'); + // put headers in options + var opts = { 'headers': headers }; + // unpack queries into statements + var statements = queries.map(function (q, i) { + return { 'statement': q, 'parameters': (params[i]) ? params[i] : {} }; + }); + // create POST data from query + var data = JSON.stringify({ 'statements': statements }); + // make post request asynchronously + var resp = this._http.post(app_config_1.NEO4J_BASE_URL + '/transaction/commit', data, opts) + .map(function (res) { return res.json(); }); + // return Observable + return resp; + }; + QueryService = __decorate([ + core_1.Injectable(), + __metadata('design:paramtypes', [http_1.Http]) + ], QueryService); + return QueryService; +}()); +exports.QueryService = QueryService; +//# sourceMappingURL=query.service.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query.service.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/query.service.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"query.service.js","sourceRoot":"","sources":["query.service.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,qBAAyB,eAAe,CAAC,CAAA;AACzC,qBAA4B,eAAe,CAAC,CAAA;AAE5C,QAAO,SAAS,CAAC,CAAA,CAAC,4BAA4B;AAC9C,iCAAiC;AAEjC,2BAAmD,cAAc,CAAC,CAAA;AAClE,2BAAwD,cAAc,CAAC,CAAA;AACvE,4BAAyB,eAAe,CAAC,CAAA;AAEzC,4BAA4B,eAAe,CAAC,CAAA;AAC5C,kCAAgC,qBAAqB,CAAC,CAAA;AACtD,oCAA8B,uBAAuB,CAAC,CAAA;AAGtD;IAOI,sBAAoB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QALxB,kBAAa,GAAG,OAAO,CAAC;QACxB,uBAAkB,GAAG,EAAE,CAAC;QAK3B,mBAAmB;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,wBAAU,EAAE,CAAC;IAClC,CAAC;IAED,4BAAK,GAAL,UAAM,cAAsB;QACxB,2BAA2B;QAC3B,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,wBAAwB;QACxB,EAAE,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;YACjB,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAClD,CAAC;IACL,CAAC;IAED,+BAAQ,GAAR;QACI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED,oCAAa,GAAb,UAAc,KAAa;QACvB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC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AC,QAAU,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QACnD,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC7C,yBAAyB;QACzB,IAAI,IAAI,GAAG,EAAC,SAAS,EAAE,OAAO,EAAC,CAAC;QAChC,iCAAiC;QACjC,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC;YAC9B,MAAM,CAAC,EAAC,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAC,MAAM,CAAC,CAAC,CAAC,GAAC,EAAE,EAAC,CAAC;QACpE,CAAC,CAAC,CAAC;QACH,8BAA8B;QAC9B,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,UAAU,EAAC,CAAC,CAAC;QACtD,mCAAmC;QACnC,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,2BAAc,GAAC,qBAAqB,EAAE,IAAI,EAAE,IAAI,CAAC;aAE3E,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,EAAE,EAAV,CAAU,CAAC,CAAC;QACxB,oBAAoB;QACpB,MAAM,CAAC,IAAI,CAAC;IAChB,CAAC;IAvVL;QAAC,iBAAU,EAAE;;oBAAA;IAyVb,mBAAC;AAAD,CAAC,AAxVD,IAwVC;AAxVY,oBAAY,eAwVxB,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/query.service.ts --- a/src/app/query.service.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/app/query.service.ts Wed Mar 29 17:19:12 2017 +0200 @@ -25,8 +25,13 @@ this.state = new QueryState(); } - setup() { + setup(newStateString: string) { + // get list of object types this.setupObjectTypes(); + // get state from string + if (newStateString) { + this.state.setStateFromString(newStateString); + } } getState() { @@ -74,7 +79,9 @@ res.subscribe( data => { console.debug("neo4j data=", data); - this.objectTypes = data.results[0].data.map(elem => elem.row[0]).filter(elem => elem[0] != "_"); + this.objectTypes = data.results[0].data + .map(elem => elem.row[0]) + .filter(elem => elem[0] != "_"); console.debug("object types=", this.objectTypes); }, err => console.error("neo4j error=", err), diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/relation-type.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/relation-type.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,44 @@ +"use strict"; +exports.invLabelPrefix = '<- '; +exports.invNamePrefix = '-'; +exports.rawLabelPrefix = '('; +exports.rawLabelPostfix = ')'; +var RelationType = (function () { + function RelationType(relType, isOutgoing, label) { + this.outgoing = isOutgoing; + this.relType = relType; + if (isOutgoing) { + this.name = relType; + } + else { + this.name = exports.invNamePrefix + relType; + } + if (label != null) { + this.label = label; + } + else { + // create label using name + if (isOutgoing) { + this.label = exports.rawLabelPrefix + relType + exports.rawLabelPostfix; + } + else { + this.label = exports.rawLabelPrefix + exports.invLabelPrefix + relType + exports.rawLabelPostfix; + } + } + } + RelationType.prototype.getLabel = function () { + return this.label; + }; + RelationType.prototype.getName = function () { + return this.name; + }; + RelationType.prototype.getRelType = function () { + return this.relType; + }; + RelationType.prototype.isOutgoing = function () { + return this.outgoing; + }; + return RelationType; +}()); +exports.RelationType = RelationType; +//# sourceMappingURL=relation-type.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/relation-type.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/relation-type.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"relation-type.js","sourceRoot":"","sources":["relation-type.ts"],"names":[],"mappings":";AACW,sBAAc,GAAG,KAAK,CAAC;AACvB,qBAAa,GAAG,GAAG,CAAC;AACpB,sBAAc,GAAG,GAAG,CAAC;AACrB,uBA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result-column.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,14 @@ +"use strict"; +var ResultColumn = (function () { + function ResultColumn(name, title, sort, show) { + if (sort === void 0) { sort = ''; } + if (show === void 0) { show = false; } + this.name = name; + this.title = title; + this.sort = sort; + this.show = show; + } + return ResultColumn; +}()); +exports.ResultColumn = ResultColumn; +//# sourceMappingURL=result-column.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/result-column.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/result-column.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"result-column.js","sourceRoot":"","sources":["result-column.ts"],"names":[],"mappings":";AAAA;IAMI,sBAAa,IAAY,EAAE,KAAa,EAAE,IAAO,EAAE,IAAU;QAAnB,oBAAO,GAAP,SAAO;QAAE,oBAAU,GAAV,YAAU;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IACL,mBAAC;AAAD,CAAC,AAZD,IAYC;AAZY,oBAAY,eAYxB,CAAA"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/result-type.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/result-type.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,49 @@ +"use strict"; +var result_column_1 = require('./result-column'); +var ResultType = (function () { + function ResultType(name, idAttribute, allowedAttributes, deniedAttributes) { + if (allowedAttributes === void 0) { allowedAttributes = []; } + if (deniedAttributes === void 0) { deniedAttributes = []; } + this.name = name; + this.idAttribute = idAttribute; + this.allowedAttributes = allowedAttributes; + this.deniedAttributes = deniedAttributes; + } + /** + * Return columns for the given list of attributes. + */ + ResultType.prototype.getColumns = function (attributes, allAttributes) { + var _this = this; + if (allAttributes === void 0) { allAttributes = true; } + var atts = attributes.slice(); + var cols = []; + // allowed attributes + this.allowedAttributes.forEach(function (att) { + var idx = atts.indexOf(att); + if (idx > -1) { + cols.push(new result_column_1.ResultColumn(att, att, '', true)); + atts[idx] = null; + } + }); + // then other attributes + if (allAttributes) { + atts.forEach(function (att) { + if (att != null && att[0] != '_' && _this.deniedAttributes.indexOf(att) < 0) { + cols.push(new result_column_1.ResultColumn(att, att, '', false)); + } + }); + } + return cols; + }; + return ResultType; +}()); +exports.ResultType = ResultType; +function getResultType(name, resultTypes) { + var rt = resultTypes[name]; + if (rt == null) { + rt = resultTypes['*']; + } + return rt; +} +exports.getResultType = getResultType; +//# sourceMappingURL=result-type.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/app/result-type.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/app/result-type.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"result-type.js","sourceRoot":"","sources":["result-type.ts"],"names":[],"mappings":";AAAA,8BAA2B,iBAAiB,CAAC,CAAA;AAE7C;IAMI,oBAAa,IAAY,EAAE,WAAmB,EAAE,iBAA8B,EAAE,gBAA6B;QAA7D,iCAA8B,GAA9B,sBAA8B;QAAE,gCAA6B,GAA7B,qBAA6B;QACzG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC7C,CAAC;IAED;;OAEG;IACH,+BAAU,GAAV,UAAW,UAAoB,EAAE,aAAkB;QAAnD,iBAoBC;QApBgC,6BAAkB,GAAlB,oBAAkB;QAC/C,IAAI,IAAI,GAAG,UAAU,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,IAAI,GAAG,EAAE,CAAC;Q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781a5387ca93 -r 3b4046e0cc02 src/main.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.js Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,5 @@ +"use strict"; +var platform_browser_dynamic_1 = require('@angular/platform-browser-dynamic'); +var app_module_1 = require('./app/app.module'); +platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule); +//# sourceMappingURL=main.js.map \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/main.js.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main.js.map Wed Mar 29 17:19:12 2017 +0200 @@ -0,0 +1,1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,yCAAuC,mCAAmC,CAAC,CAAA;AAE3E,2BAA0B,kBAAkB,CAAC,CAAA;AAE7C,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"} \ No newline at end of file diff -r 781a5387ca93 -r 3b4046e0cc02 src/main.ts --- a/src/main.ts Mon Mar 20 18:50:31 2017 +0100 +++ b/src/main.ts Wed Mar 29 17:19:12 2017 +0200 @@ -1,5 +1,5 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { AppModule } from './app/query-app.module'; +import { AppModule } from './app/app.module'; platformBrowserDynamic().bootstrapModule(AppModule); diff -r 781a5387ca93 -r 3b4046e0cc02 src/systemjs.config.js --- a/src/systemjs.config.js Mon Mar 20 18:50:31 2017 +0100 +++ b/src/systemjs.config.js Wed Mar 29 17:19:12 2017 +0200 @@ -25,7 +25,10 @@ // other libraries 'rxjs': 'npm:rxjs', - 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js' + 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js', + + 'ng2-bootstrap': 'npm:ng2-bootstrap', + 'ng2-table': 'npm:ng2-table' }, // packages tells the System loader how to load when no filename and/or no extension packages: { @@ -34,6 +37,14 @@ }, rxjs: { defaultExtension: 'js' + }, + 'ng2-bootstrap': { + format: 'cjs', + main: 'bundles/ng2-bootstrap.umd.js', + defaultExtension: 'js' + }, + 'ng2-table': { + defaultExtension: 'js' } } });