You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2023/02/23 18:56:55 UTC

[streampipes] branch dev updated: [#1291] Can't aggregate calculation results of the Math processing element (#1340)

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new a5ebee83e [#1291] Can't aggregate calculation results of the Math processing element (#1340)
a5ebee83e is described below

commit a5ebee83e0afd3c759ff3913ecc0b0dd621d8dfd
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Fri Feb 24 02:56:48 2023 +0800

    [#1291] Can't aggregate calculation results of the Math processing element (#1340)
    
    * [#1291] store SO.NUMBER primitive property as double value in InfluxStore
    
    * [#1291] fix potential isNumber() judge bug in data-explorer-field-provider-service.ts
    
    * [#1291] remove code associated with the prefix 'https://www.w3.org/2001/XMLSchema'
---
 .../dataexplorer/commons/influx/InfluxStore.java         | 16 +++++++++-------
 .../org/apache/streampipes/sdk/helpers/EpProperties.java |  3 ++-
 .../components/widgets/base/base-widget-config.ts        |  2 +-
 .../services/data-explorer-field-provider-service.ts     |  5 +----
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/streampipes-data-explorer-commons/src/main/java/org/apache/streampipes/dataexplorer/commons/influx/InfluxStore.java b/streampipes-data-explorer-commons/src/main/java/org/apache/streampipes/dataexplorer/commons/influx/InfluxStore.java
index 7f87b1888..e36b6e9cf 100644
--- a/streampipes-data-explorer-commons/src/main/java/org/apache/streampipes/dataexplorer/commons/influx/InfluxStore.java
+++ b/streampipes-data-explorer-commons/src/main/java/org/apache/streampipes/dataexplorer/commons/influx/InfluxStore.java
@@ -26,6 +26,7 @@ import org.apache.streampipes.model.runtime.field.PrimitiveField;
 import org.apache.streampipes.model.schema.EventProperty;
 import org.apache.streampipes.model.schema.EventPropertyPrimitive;
 import org.apache.streampipes.model.schema.PropertyScope;
+import org.apache.streampipes.vocabulary.SO;
 import org.apache.streampipes.vocabulary.XSD;
 
 import org.influxdb.InfluxDB;
@@ -188,18 +189,20 @@ public class InfluxStore {
         } catch (NumberFormatException ef) {
           p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsFloat());
         }
-      } else if (XSD.FLOAT.toString().equals(runtimeType)) {
-        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsFloat());
-      } else if (XSD.DOUBLE.toString().equals(runtimeType)) {
-        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsDouble());
-      } else if (XSD.BOOLEAN.toString().equals(runtimeType)) {
-        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsBoolean());
       } else if (XSD.LONG.toString().equals(runtimeType)) {
         try {
           p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsLong());
         } catch (NumberFormatException ef) {
           p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsFloat());
         }
+      } else if (XSD.FLOAT.toString().equals(runtimeType)) {
+        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsFloat());
+      } else if (XSD.DOUBLE.toString().equals(runtimeType)) {
+        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsDouble());
+      } else if (XSD.BOOLEAN.toString().equals(runtimeType)) {
+        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsBoolean());
+      } else if (SO.NUMBER.equals(runtimeType)) {
+        p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsDouble());
       } else {
         p.addField(preparedRuntimeName, eventPropertyPrimitiveField.getAsString());
       }
@@ -220,5 +223,4 @@ public class InfluxStore {
     }
     influxDb.close();
   }
-
 }
diff --git a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
index 06995b285..ced0dd00e 100644
--- a/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
+++ b/streampipes-sdk/src/main/java/org/apache/streampipes/sdk/helpers/EpProperties.java
@@ -27,6 +27,7 @@ import org.apache.streampipes.model.schema.EventPropertyPrimitive;
 import org.apache.streampipes.model.schema.PropertyScope;
 import org.apache.streampipes.model.schema.QuantitativeValue;
 import org.apache.streampipes.sdk.utils.Datatypes;
+import org.apache.streampipes.vocabulary.SO;
 import org.apache.streampipes.vocabulary.SPSensor;
 import org.apache.streampipes.vocabulary.XSD;
 
@@ -217,7 +218,7 @@ public class EpProperties {
    * @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
    */
   public static EventPropertyPrimitive numberEp(Label label, String runtimeName, String domainProperty) {
-    return ep(label, "http://schema.org/Number", runtimeName, domainProperty);
+    return ep(label, SO.NUMBER, runtimeName, domainProperty);
   }
 
   /**
diff --git a/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts b/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
index 525e50dae..c62570f85 100644
--- a/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
@@ -128,7 +128,7 @@ export abstract class BaseWidgetConfig<
         const b = new EventPropertyPrimitive();
         b['@class'] =
             'org.apache.streampipes.model.schema.EventPropertyPrimitive';
-        b.runtimeType = 'https://www.w3.org/2001/XMLSchema#string';
+        b.runtimeType = 'http://www.w3.org/2001/XMLSchema#string';
         b.runtimeName = '';
 
         result.push(b);
diff --git a/ui/src/app/data-explorer/services/data-explorer-field-provider-service.ts b/ui/src/app/data-explorer/services/data-explorer-field-provider-service.ts
index bc7cf597b..9fc3beddc 100644
--- a/ui/src/app/data-explorer/services/data-explorer-field-provider-service.ts
+++ b/ui/src/app/data-explorer/services/data-explorer-field-provider-service.ts
@@ -194,10 +194,7 @@ export class DataExplorerFieldProviderService {
                 runtimeType === 'http://www.w3.org/2001/XMLSchema#float' ||
                 runtimeType === 'http://www.w3.org/2001/XMLSchema#double' ||
                 runtimeType === 'http://www.w3.org/2001/XMLSchema#integer' ||
-                runtimeType === 'https://schema.org/Number' ||
-                runtimeType === 'https://www.w3.org/2001/XMLSchema#float' ||
-                runtimeType === 'https://www.w3.org/2001/XMLSchema#double' ||
-                runtimeType === 'https://www.w3.org/2001/XMLSchema#integer'
+                runtimeType === 'http://www.w3.org/2001/XMLSchema#long'
             );
         } else {
             return false;