You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2024/03/22 15:49:58 UTC

(streampipes) branch 2615-move-all-types-and-semantic-types-definition-to-one-location-in-ui updated: refactor(#2615): Change datatypes from class to string

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

zehnder pushed a commit to branch 2615-move-all-types-and-semantic-types-definition-to-one-location-in-ui
in repository https://gitbox.apache.org/repos/asf/streampipes.git


The following commit(s) were added to refs/heads/2615-move-all-types-and-semantic-types-definition-to-one-location-in-ui by this push:
     new 4054c1db4a refactor(#2615): Change datatypes from class to string
4054c1db4a is described below

commit 4054c1db4afc077d64eb91fb2d16a2648e45471e
Author: Philipp Zehnder <te...@users.noreply.github.com>
AuthorDate: Fri Mar 22 16:49:33 2024 +0100

    refactor(#2615): Change datatypes from class to string
---
 .../src/lib/model}/types/semantic-type.service.ts  |  0
 .../event-property-row.component.ts                |  2 +-
 .../event-schema/event-schema.component.ts         |  2 +-
 .../edit-schema-transformation.component.ts        |  2 +-
 .../edit-event-property.component.ts               |  4 +---
 ui/src/app/connect/filter/timestamp.pipe.ts        |  2 +-
 .../services/transformation-rule.service.ts        |  2 +-
 .../field-names-table.component.ts                 |  2 +-
 .../live-preview-table.component.ts                |  2 +-
 .../static-free-input.component.ts                 |  2 +-
 .../widgets/table/table-widget.component.ts        |  2 +-
 .../dashboard/registry/widget-config-builder.ts    |  8 +++----
 ui/src/app/dashboard/sdk/ep-requirements.ts        | 13 ++++++-----
 .../app/dashboard/sdk/matching/datatype-match.ts   | 10 ++++-----
 ui/src/app/dashboard/sdk/model/datatypes.ts        | 25 ++++++++--------------
 ui/src/app/dashboard/sdk/model/vocabulary.ts       | 23 --------------------
 .../data-explorer-field-provider-service.ts        |  2 +-
 .../user-defined-output.component.ts               |  2 +-
 18 files changed, 38 insertions(+), 67 deletions(-)

diff --git a/ui/src/app/core-services/types/semantic-type.service.ts b/ui/projects/streampipes/platform-services/src/lib/model/types/semantic-type.service.ts
similarity index 100%
rename from ui/src/app/core-services/types/semantic-type.service.ts
rename to ui/projects/streampipes/platform-services/src/lib/model/types/semantic-type.service.ts
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-property-row/event-property-row.component.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-property-row/event-property-row.component.ts
index 316af7e25c..a806a8103a 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-property-row/event-property-row.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-property-row/event-property-row.component.ts
@@ -33,7 +33,7 @@ import { StaticValueTransformService } from '../../../../services/static-value-t
 import { EventPropertyUtilsService } from '../../../../services/event-property-utils.service';
 import { ShepherdService } from '../../../../../services/tour/shepherd.service';
 import { IdGeneratorService } from '../../../../../core-services/id-generator/id-generator.service';
-import { SemanticTypeService } from '../../../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-event-property-row',
diff --git a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
index 8dfcb80598..973703145e 100644
--- a/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
+++ b/ui/src/app/connect/components/adapter-configuration/schema-editor/event-schema/event-schema.component.ts
@@ -43,7 +43,7 @@ import { UserErrorMessage } from '../../../../../core-model/base/UserErrorMessag
 import { TransformationRuleService } from '../../../../services/transformation-rule.service';
 import { StaticValueTransformService } from '../../../../services/static-value-transform.service';
 import { IdGeneratorService } from '../../../../../core-services/id-generator/id-generator.service';
-import { SemanticTypeService } from '../../../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-event-schema',
diff --git a/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts b/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
index f87d518b0b..e9861d6c5a 100644
--- a/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
+++ b/ui/src/app/connect/dialog/edit-event-property/components/edit-schema-transformation/edit-schema-transformation.component.ts
@@ -27,7 +27,7 @@ import { UntypedFormControl } from '@angular/forms';
 import { Observable } from 'rxjs';
 import { ShepherdService } from '../../../../../services/tour/shepherd.service';
 import { SemanticTypesRestService } from '../../../../../../../projects/streampipes/platform-services/src/lib/apis/semantic-types-rest.service';
-import { SemanticTypeService } from '../../../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-edit-schema-transformation',
diff --git a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts
index 6f05628a27..797ec2aa0c 100644
--- a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts
+++ b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.ts
@@ -41,7 +41,7 @@ import { EditSchemaTransformationComponent } from './components/edit-schema-tran
 import { EditValueTransformationComponent } from './components/edit-value-transformation/edit-value-transformation.component';
 import { EditUnitTransformationComponent } from './components/edit-unit-transformation/edit-unit-transformation.component';
 import { ShepherdService } from '../../../services/tour/shepherd.service';
-import { SemanticTypeService } from '../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-edit-event-property',
@@ -70,8 +70,6 @@ export class EditEventPropertyComponent implements OnInit {
 
     private propertyForm: UntypedFormGroup;
 
-    private runtimeDataTypes;
-
     constructor(
         public dialogRef: DialogRef<EditEventPropertyComponent>,
         private formBuilder: UntypedFormBuilder,
diff --git a/ui/src/app/connect/filter/timestamp.pipe.ts b/ui/src/app/connect/filter/timestamp.pipe.ts
index 901c421c54..5ec2e98352 100644
--- a/ui/src/app/connect/filter/timestamp.pipe.ts
+++ b/ui/src/app/connect/filter/timestamp.pipe.ts
@@ -18,7 +18,7 @@
 
 import { Pipe, PipeTransform } from '@angular/core';
 import { EventPropertyUnion } from '@streampipes/platform-services';
-import { SemanticTypeService } from '../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Pipe({
     name: 'timestampFilter',
diff --git a/ui/src/app/connect/services/transformation-rule.service.ts b/ui/src/app/connect/services/transformation-rule.service.ts
index 6c5dceab7a..9e0222e311 100644
--- a/ui/src/app/connect/services/transformation-rule.service.ts
+++ b/ui/src/app/connect/services/transformation-rule.service.ts
@@ -37,7 +37,7 @@ import {
 } from '@streampipes/platform-services';
 import { TimestampTransformationRuleMode } from '../model/TimestampTransformationRuleMode';
 import { StaticValueTransformService } from './static-value-transform.service';
-import { SemanticTypeService } from '../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Injectable({ providedIn: 'root' })
 export class TransformationRuleService {
diff --git a/ui/src/app/core-ui/help/field-names-table/field-names-table.component.ts b/ui/src/app/core-ui/help/field-names-table/field-names-table.component.ts
index 3330d96a89..efb36d681f 100644
--- a/ui/src/app/core-ui/help/field-names-table/field-names-table.component.ts
+++ b/ui/src/app/core-ui/help/field-names-table/field-names-table.component.ts
@@ -18,7 +18,7 @@
 
 import { Component, Input } from '@angular/core';
 import { EventSchema } from '@streampipes/platform-services';
-import { SemanticTypeService } from '../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-field-names-table',
diff --git a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts
index 1ae75a0c7a..a28168f6e8 100644
--- a/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts
+++ b/ui/src/app/core-ui/pipeline-element-runtime-info/live-preview-table/live-preview-table.component.ts
@@ -18,7 +18,7 @@
 
 import { Component, Input } from '@angular/core';
 import { EventSchema } from '@streampipes/platform-services';
-import { SemanticTypeService } from '../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-live-preview-table',
diff --git a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
index 657610b0d3..08f9a82553 100644
--- a/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
+++ b/ui/src/app/core-ui/static-properties/static-free-input/static-free-input.component.ts
@@ -27,7 +27,7 @@ import {
 } from '../input.validator';
 import { AbstractValidatedStaticPropertyRenderer } from '../base/abstract-validated-static-property';
 import { QuillEditorComponent } from 'ngx-quill';
-import { SemanticTypeService } from '../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-app-static-free-input',
diff --git a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts b/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
index 3faf709cbc..2ea295a14b 100644
--- a/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
+++ b/ui/src/app/dashboard/components/widgets/table/table-widget.component.ts
@@ -24,7 +24,7 @@ import { TableConfig } from './table-config';
 import { ResizeService } from '../../../services/resize.service';
 import { DatalakeRestService } from '@streampipes/platform-services';
 import { WidgetConfigBuilder } from '../../../registry/widget-config-builder';
-import { SemanticTypeService } from '../../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-table-widget',
diff --git a/ui/src/app/dashboard/registry/widget-config-builder.ts b/ui/src/app/dashboard/registry/widget-config-builder.ts
index 5786cb1db2..5a7db3d52c 100644
--- a/ui/src/app/dashboard/registry/widget-config-builder.ts
+++ b/ui/src/app/dashboard/registry/widget-config-builder.ts
@@ -122,7 +122,7 @@ export class WidgetConfigBuilder {
             WidgetConfigBuilder.QUERY_LIMIT_KEY,
             'Past data',
             'The number of historic events that should be shown',
-            Datatypes.Integer.toUri(),
+            Datatypes.Integer,
         );
         fst.value = '50';
         this.widget.config.push(fst);
@@ -139,7 +139,7 @@ export class WidgetConfigBuilder {
             id,
             label,
             description,
-            Datatypes.String.toUri(),
+            Datatypes.String,
         );
         this.widget.config.push(fst);
         return this;
@@ -174,7 +174,7 @@ export class WidgetConfigBuilder {
             id,
             label,
             description,
-            Datatypes.Integer.toUri(),
+            Datatypes.Integer,
         );
         if (defaultValue) {
             fst.value = defaultValue.toString();
@@ -220,7 +220,7 @@ export class WidgetConfigBuilder {
             id,
             label,
             description,
-            Datatypes.Float.toUri(),
+            Datatypes.Float,
         );
         this.widget.config.push(fst);
         return this;
diff --git a/ui/src/app/dashboard/sdk/ep-requirements.ts b/ui/src/app/dashboard/sdk/ep-requirements.ts
index 07653a454f..5c58fba090 100644
--- a/ui/src/app/dashboard/sdk/ep-requirements.ts
+++ b/ui/src/app/dashboard/sdk/ep-requirements.ts
@@ -17,7 +17,6 @@
  */
 
 import { Datatypes } from './model/datatypes';
-import { Vocabulary } from './model/vocabulary';
 import {
     EventPropertyList,
     EventPropertyNested,
@@ -55,11 +54,15 @@ export class EpRequirements {
     }
 
     static latitudeReq(): EventPropertyUnion {
-        return EpRequirements.domainPropertyReq(Vocabulary.GEO + 'lat');
+        return EpRequirements.domainPropertyReq(
+            'http://www.w3.org/2003/01/geo/wgs84_pos#lat',
+        );
     }
 
     static longitudeReq(): EventPropertyUnion {
-        return EpRequirements.domainPropertyReq(Vocabulary.GEO + 'long');
+        return EpRequirements.domainPropertyReq(
+            'http://www.w3.org/2003/01/geo/wgs84_pos#long',
+        );
     }
 
     static timestampReq(): EventPropertyUnion {
@@ -110,9 +113,9 @@ export class EpRequirements {
         return eventProperty;
     }
 
-    static datatypeReq(datatype: Datatypes): EventPropertyPrimitive {
+    static datatypeReq(datatype: string): EventPropertyPrimitive {
         const eventProperty = EpRequirements.ep();
-        eventProperty.runtimeType = datatype.toUri();
+        eventProperty.runtimeType = datatype;
         return eventProperty;
     }
 }
diff --git a/ui/src/app/dashboard/sdk/matching/datatype-match.ts b/ui/src/app/dashboard/sdk/matching/datatype-match.ts
index 76127a28a0..ee155dc208 100644
--- a/ui/src/app/dashboard/sdk/matching/datatype-match.ts
+++ b/ui/src/app/dashboard/sdk/matching/datatype-match.ts
@@ -31,14 +31,14 @@ export class DatatypeMatch {
     }
 
     subClassOf(offer: string, requirement: string): boolean {
-        if (!(requirement === Datatypes.Number.toUri())) {
+        if (!(requirement === Datatypes.Number)) {
             return false;
         } else {
             if (
-                offer === Datatypes.Integer.toUri() ||
-                offer === Datatypes.Long.toUri() ||
-                offer === Datatypes.Double.toUri() ||
-                offer === Datatypes.Float.toUri()
+                offer === Datatypes.Integer ||
+                offer === Datatypes.Long ||
+                offer === Datatypes.Double ||
+                offer === Datatypes.Float
             ) {
                 return true;
             }
diff --git a/ui/src/app/dashboard/sdk/model/datatypes.ts b/ui/src/app/dashboard/sdk/model/datatypes.ts
index 60a10cfad4..4ba004372d 100644
--- a/ui/src/app/dashboard/sdk/model/datatypes.ts
+++ b/ui/src/app/dashboard/sdk/model/datatypes.ts
@@ -16,23 +16,16 @@
  *
  */
 
-import { Vocabulary } from './vocabulary';
-
 export class Datatypes {
-    static readonly Integer = new Datatypes(Vocabulary.XSD, 'integer');
-    static readonly Long = new Datatypes(Vocabulary.XSD, 'long');
-    static readonly Float = new Datatypes(Vocabulary.XSD, 'float');
-    static readonly Boolean = new Datatypes(Vocabulary.XSD, 'boolean');
-    static readonly String = new Datatypes(Vocabulary.XSD, 'string');
-    static readonly Double = new Datatypes(Vocabulary.XSD, 'double');
-    static readonly Number = new Datatypes(Vocabulary.SO, 'Number');
+    static readonly XSD: string = 'http://www.w3.org/2001/XMLSchema#';
+    static readonly SO: string = 'http://schema.org/';
 
-    private constructor(
-        private readonly vocabulary: string,
-        private readonly entity: string,
-    ) {}
+    static readonly Integer = this.XSD + 'integer';
+    static readonly Long = this.XSD + 'long';
+    static readonly Float = this.XSD + 'float';
+    static readonly Boolean = this.XSD + 'boolean';
+    static readonly String = this.XSD + 'string';
+    static readonly Double = this.XSD + 'double';
 
-    toUri() {
-        return this.vocabulary + this.entity;
-    }
+    static readonly Number = this.SO + 'Number';
 }
diff --git a/ui/src/app/dashboard/sdk/model/vocabulary.ts b/ui/src/app/dashboard/sdk/model/vocabulary.ts
deleted file mode 100644
index 052f96df93..0000000000
--- a/ui/src/app/dashboard/sdk/model/vocabulary.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-export class Vocabulary {
-    static readonly XSD: string = 'http://www.w3.org/2001/XMLSchema#';
-    static readonly SO: string = 'http://schema.org/';
-    static readonly GEO: string = 'http://www.w3.org/2003/01/geo/wgs84_pos#';
-}
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 d1a04626e2..7d14c7b04d 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
@@ -26,7 +26,7 @@ import {
     FieldConfig,
     SourceConfig,
 } from '@streampipes/platform-services';
-import { SemanticTypeService } from '../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Injectable({ providedIn: 'root' })
 export class DataExplorerFieldProviderService {
diff --git a/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts b/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
index ecfe3ce1f3..c1cc537c99 100644
--- a/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
+++ b/ui/src/app/editor/components/output-strategy/user-defined-output/user-defined-output.component.ts
@@ -24,7 +24,7 @@ import {
 } from '@streampipes/platform-services';
 import { UntypedFormControl } from '@angular/forms';
 import { IdGeneratorService } from '../../../../core-services/id-generator/id-generator.service';
-import { SemanticTypeService } from '../../../../core-services/types/semantic-type.service';
+import { SemanticTypeService } from '../../../../../../projects/streampipes/platform-services/src/lib/model/types/semantic-type.service';
 
 @Component({
     selector: 'sp-user-defined-output-strategy',