diff app/query-select.component.ts @ 13:98b435bb6c0c

more query work.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Thu, 21 Jan 2016 14:47:00 +0100
parents 6989cd00e8d7
children 7dc7ea95ca26
line wrap: on
line diff
--- 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) {