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/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 11675bf  [STREAMPIPES-303] Add autocomplete support for semantic type 
selection in StreamPipes Connect
11675bf is described below

commit 11675bfee5e7c8cc1781456d1eb5baf64b0053c4
Author: Dominik Riemer <[email protected]>
AuthorDate: Wed Feb 24 21:23:31 2021 +0100

    [STREAMPIPES-303] Add autocomplete support for semantic type selection in 
StreamPipes Connect
---
 .../apache/streampipes/rest/impl/AutoComplete.java |  31 +-
 .../org/apache/streampipes/vocabulary/Geo.java     |   7 +
 .../apache/streampipes/vocabulary/Geonames.java    |  13 +
 .../java/org/apache/streampipes/vocabulary/SO.java | 439 +++++++++++++++++++++
 .../apache/streampipes/vocabulary/SPSensor.java    |  14 +
 .../{Geonames.java => SemanticTypeRegistry.java}   |  39 +-
 .../event-schema/event-schema.component.html       |   6 +-
 .../edit-event-property.component.html             |   9 +-
 .../edit-event-property.component.ts               |  20 +-
 .../apis/semantic-types.service.ts                 |  23 +-
 ui/src/app/platform-services/platform.module.ts    |   4 +-
 11 files changed, 568 insertions(+), 37 deletions(-)

diff --git 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
index c9254e4..172f0a0 100644
--- 
a/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
+++ 
b/streampipes-rest/src/main/java/org/apache/streampipes/rest/impl/AutoComplete.java
@@ -18,26 +18,22 @@
 
 package org.apache.streampipes.rest.impl;
 
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.eclipse.rdf4j.query.BindingSet;
-import org.eclipse.rdf4j.query.MalformedQueryException;
-import org.eclipse.rdf4j.query.QueryEvaluationException;
-import org.eclipse.rdf4j.query.TupleQueryResult;
-import org.eclipse.rdf4j.repository.RepositoryException;
-
 import org.apache.streampipes.model.client.messages.AutocompleteItem;
 import org.apache.streampipes.model.client.messages.AutocompleteResult;
 import org.apache.streampipes.model.client.ontology.OntologyQuery;
 import org.apache.streampipes.storage.management.StorageManager;
 import org.apache.streampipes.storage.rdf4j.ontology.QueryExecutor;
 import org.apache.streampipes.storage.rdf4j.sparql.QueryBuilder;
+import org.apache.streampipes.vocabulary.SemanticTypeRegistry;
+import org.eclipse.rdf4j.query.BindingSet;
+import org.eclipse.rdf4j.query.MalformedQueryException;
+import org.eclipse.rdf4j.query.QueryEvaluationException;
+import org.eclipse.rdf4j.query.TupleQueryResult;
+import org.eclipse.rdf4j.repository.RepositoryException;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
 
 @Path("/v2/autocomplete")
 public class AutoComplete extends AbstractRestResource {
@@ -72,4 +68,11 @@ public class AutoComplete extends AbstractRestResource {
                 
.getBackgroundKnowledgeStorage().getOntologyResult(ontologyQuery));
     }
 
+    @GET
+    @Path("semantic-type")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response getSemanticTypes(@QueryParam("text") String text) {
+        return ok(SemanticTypeRegistry.INSTANCE.matches(text));
+    }
+
 }
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
index d6ee002..7267e8b 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
+++ 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
@@ -18,9 +18,16 @@
 
 package org.apache.streampipes.vocabulary;
 
+import java.util.Arrays;
+import java.util.List;
+
 public class Geo {
 
        public static final String lat = 
"http://www.w3.org/2003/01/geo/wgs84_pos#lat";;
        public static final String lng = 
"http://www.w3.org/2003/01/geo/wgs84_pos#long";;
        public static final String alt = 
"http://www.w3.org/2003/01/geo/wgs84_pos#alt";;
+
+       public static List<String> getAll() {
+               return Arrays.asList(lat, lng, alt);
+       }
 }
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
index 18b14c0..b44c5e8 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
+++ 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
@@ -20,6 +20,9 @@
 package org.apache.streampipes.vocabulary;
 
 
+import java.util.Arrays;
+import java.util.List;
+
 public class Geonames {
 
     public static String AlternateName = 
"http://www.geonames.org/ontology#alternateName";;
@@ -30,4 +33,14 @@ public class Geonames {
     public static String PostalCode = 
"http://www.geonames.org/ontology#postalCode";;
     public static String ShortName = 
"http://www.geonames.org/ontology#shortName";;
 
+    public static List<String> getAll() {
+        return Arrays.asList(AlternateName,
+                CountryCode,
+                Name,
+                OfficialName,
+                Population,
+                PostalCode,
+                ShortName);
+    }
+
 }
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SO.java
 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SO.java
index facd7b8..a66f7c7 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SO.java
+++ 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SO.java
@@ -20,6 +20,9 @@
 package org.apache.streampipes.vocabulary;
 
 
+import java.util.Arrays;
+import java.util.List;
+
 public class SO {
 
   public static final String NS = "http://schema.org/";;
@@ -460,4 +463,440 @@ public class SO {
   public static final String Workload = "http://schema.org/workload";;
   public static final String WorstRating = "http://schema.org/worstRating";;
 
+  public static List<String> getAll() {
+    return Arrays.asList(GeoJsonLineString,
+            GeoJsonPolygon,
+            GeoJsonMultiPoint,
+            GeoJsonMultiLineString,
+            GeoJsonMultiPolygon,
+            QuantitativeValue,
+            PropertyValueSpecification,
+            Number,
+            Enumeration,
+            Altitude,
+            AcceptsReservations,
+            AccessCode,
+            AccessibilityAPI,
+            AccessibilityControl,
+            AccessibilityFeature,
+            AccessibilityHazard,
+            Action,
+            ActiveIngredient,
+            ActivityDuration,
+            ActivityFrequency,
+            AdditionalName,
+            AdditionalVariable,
+            AddressLocality,
+            AddressRegion,
+            AdministrationRoute,
+            AlcoholWarning,
+            Algorithm,
+            AlignmentType,
+            AlternateName,
+            AlternativeHeadline,
+            AmountOfThisGood,
+            AnswerCount,
+            ApplicationCategory,
+            ApplicationSubCategory,
+            ApplicationSuite,
+            ArrivalGate,
+            ArrivalPlatform,
+            ArrivalTerminal,
+            ArrivalTime,
+            ArticleBody,
+            ArticleSection,
+            Aspect,
+            Assembly,
+            AssemblyVersion,
+            AssociatedPathophysiology,
+            AudienceType,
+            AvailabilityEnds,
+            AvailabilityStarts,
+            AvailableFrom,
+            AvailableThrough,
+            Award,
+            Background,
+            BaseSalary,
+            Benefits,
+            BestRating,
+            BillingIncrement,
+            BiomechnicalClass,
+            BirthDate,
+            Bitrate,
+            BoardingGroup,
+            BodyLocation,
+            BookEdition,
+            BookingTime,
+            Boolean,
+            Box,
+            Breadcrumb,
+            BreastfeedingWarning,
+            BrowserRequirements,
+            BusName,
+            BusNumber,
+            Calories,
+            Caption,
+            CarbohydrateContent,
+            CarrierRequirements,
+            CharacterName,
+            CheckinTime,
+            CheckoutTime,
+            ChildMaxAge,
+            ChildMinAge,
+            CholesterolContent,
+            Circle,
+            ClincalPharmacology,
+            ClipNumber,
+            Closes,
+            CodeRepository,
+            CodeValue,
+            CodingSystem,
+            Color,
+            CommentCount,
+            CommentText,
+            CommentTime,
+            ConfirmationNumber,
+            ContactType,
+            ContentRating,
+            ContentSize,
+            ContentType,
+            ContentUrl,
+            CookTime,
+            CookingMethod,
+            CopyrightYear,
+            CostCurrency,
+            CostOrigin,
+            CostPerUnit,
+            CountriesNotSupported,
+            CountriesSupported,
+            CurrenciesAccepted,
+            DateCreated,
+            DateIssued,
+            DateModified,
+            DatePosted,
+            DatePublished,
+            DateTime,
+            Dateline,
+            DeathDate,
+            DepartureGate,
+            DeparturePlatform,
+            DepartureTerminal,
+            DepartureTime,
+            Dependencies,
+            Device,
+            DietFeatures,
+            Discount,
+            DiscountCode,
+            DiscountCurrency,
+            DiscussionUrl,
+            DissolutionDate,
+            Distance,
+            DoorTime,
+            DosageForm,
+            DoseUnit,
+            DoseValue,
+            DownloadUrl,
+            DownvoteCount,
+            DropoffTime,
+            DrugUnit,
+            Duns,
+            Duration,
+            EducationRequirements,
+            EducationalFramework,
+            EducationalRole,
+            EducationalUse,
+            Elevation,
+            Email,
+            EmbedUrl,
+            EmploymentType,
+            EncodingFormat,
+            EncodingType,
+            EndDate,
+            EndTime,
+            Epidemiology,
+            EpisodeNumber,
+            EstimatedFlightDuration,
+            EvidenceOrigin,
+            ExerciseType,
+            ExifData,
+            ExpectedArrivalFrom,
+            ExpectedArrivalUntil,
+            ExpectedPrognosis,
+            ExperienceRequirements,
+            ExpertConsiderations,
+            Expires,
+            FamilyName,
+            FatContent,
+            FaxNumber,
+            FeatureList,
+            FiberContent,
+            FileFormat,
+            FileSize,
+            FlightDistance,
+            FlightNumber,
+            Followup,
+            FoodWarning,
+            FoundingDate,
+            Free,
+            Frequency,
+            FromLocation,
+            Function,
+            FunctionalClass,
+            Gender,
+            Genre,
+            GivenName,
+            GlobalLocationNumber,
+            Gtin13,
+            Gtin14,
+            Gtin8,
+            GuidelineDate,
+            HasMap,
+            Headline,
+            HighPrice,
+            HonorificPrefix,
+            HonorificSuffix,
+            HowPerformed,
+            HttpMethod,
+            IataCode,
+            IcaoCode,
+            Image,
+            InLanguage,
+            Incentives,
+            Industry,
+            InfectiousAgent,
+            Ingredients,
+            InstallUrl,
+            Intensity,
+            InteractionCount,
+            InteractivityType,
+            IsAvailableGenerically,
+            IsBasedOnUrl,
+            IsFamilyFriendly,
+            IsGift,
+            IsProprietary,
+            Isbn,
+            IsicV4,
+            Issn,
+            IssueNumber,
+            ItemListElement,
+            ItemListOrder,
+            JobTitle,
+            Keywords,
+            LabelDetails,
+            LastReviewed,
+            Latitude,
+            LearningResourceType,
+            LegalName,
+            License,
+            Line,
+            LodgingUnitDescription,
+            Logo,
+            Longitude,
+            LowPrice,
+            Map,
+            MaxPrice,
+            MaxValue,
+            MealService,
+            MechanismOfAction,
+            MembershipNumber,
+            MemoryRequirements,
+            Menu,
+            MinPrice,
+            MinValue,
+            ModifiedTime,
+            Mpn,
+            MultipleValues,
+            MuscleAction,
+            Naics,
+            NamedPosition,
+            NaturalProgression,
+            NonProprietaryName,
+            NormalRange,
+            NumAdults,
+            NumChildren,
+            NumTracks,
+            NumberOfEpisodes,
+            NumberOfPages,
+            NumberOfSeasons,
+            OccupationalCategory,
+            OfferCount,
+            OpeningHours,
+            Opens,
+            OperatingSystem,
+            OrderDate,
+            OrderNumber,
+            Outcome,
+            Overdosage,
+            Overview,
+            OwnedFrom,
+            OwnedThrough,
+            PageEnd,
+            PageStart,
+            Pagination,
+            PartySize,
+            Pathophysiology,
+            PaymentAccepted,
+            PaymentDue,
+            PaymentMethodId,
+            PaymentUrl,
+            Permissions,
+            Phase,
+            PhysiologicalBenefits,
+            PickupTime,
+            PlayerType,
+            Polygon,
+            Population,
+            Position,
+            PossibleComplication,
+            PostOfficeBoxNumber,
+            PostOp,
+            PostalCode,
+            PreOp,
+            PregnancyWarning,
+            PrepTime,
+            Preparation,
+            PrescribingInfo,
+            PreviousStartDate,
+            Price,
+            PriceCurrency,
+            PriceRange,
+            PriceType,
+            PriceValidUntil,
+            PrintColumn,
+            PrintEdition,
+            PrintPage,
+            PrintSection,
+            Procedure,
+            ProcessingTime,
+            ProcessorRequirements,
+            ProductID,
+            ProficiencyLevel,
+            ProgramName,
+            ProgrammingModel,
+            ProprietaryName,
+            ProteinContent,
+            PublicationType,
+            PublishingPrinciples,
+            Qualifications,
+            Question,
+            RatingCount,
+            RatingValue,
+            ReadonlyValue,
+            RecipeCategory,
+            RecipeCuisine,
+            RecipeInstructions,
+            RecipeYield,
+            RecommendationStrength,
+            RelatedLink,
+            ReleaseDate,
+            ReleaseNotes,
+            Repetitions,
+            ReplyToUrl,
+            RepresentativeOfPage,
+            RequiredGender,
+            RequiredMaxAge,
+            RequiredMinAge,
+            Requirements,
+            RequiresSubscription,
+            ReservationId,
+            Responsibilities,
+            RestPeriods,
+            ReviewBody,
+            ReviewCount,
+            Risks,
+            Runtime,
+            SafetyConsideration,
+            SalaryCurrency,
+            SameAs,
+            SampleType,
+            SaturatedFatContent,
+            ScheduledTime,
+            Screenshot,
+            SeasonNumber,
+            SeatNumber,
+            SeatRow,
+            SeatSection,
+            SerialNumber,
+            ServesCuisine,
+            ServiceType,
+            ServiceUrl,
+            ServingSize,
+            Significance,
+            SignificantLink,
+            Skills,
+            Sku,
+            SodiumContent,
+            SoftwareVersion,
+            SpecialCommitments,
+            StageAsNumber,
+            StartDate,
+            StartTime,
+            Step,
+            StepValue,
+            StorageRequirements,
+            StreetAddress,
+            StrengthUnit,
+            StrengthValue,
+            StructuralClass,
+            SubStageSuffix,
+            Subtype,
+            SugarContent,
+            SuggestedGender,
+            SuggestedMaxAge,
+            SuggestedMinAge,
+            TargetDescription,
+            TargetName,
+            TargetPlatform,
+            TargetPopulation,
+            TargetUrl,
+            TaxID,
+            Telephone,
+            Temporal,
+            Text,
+            ThumbnailUrl,
+            TickerSymbol,
+            TicketNumber,
+            TicketToken,
+            TimeRequired,
+            TissueSample,
+            Title,
+            ToLocation,
+            TotalPrice,
+            TotalTime,
+            TrackingNumber,
+            TrackingUrl,
+            TrainName,
+            TrainNumber,
+            TransFatContent,
+            Transcript,
+            TransmissionMethod,
+            TypicalAgeRange,
+            UnitCode,
+            UnsaturatedFatContent,
+            UploadDate,
+            UpvoteCount,
+            UrlTemplate,
+            ValidFor,
+            ValidFrom,
+            ValidThrough,
+            ValidUntil,
+            Value,
+            ValueAddedTaxIncluded,
+            ValueMaxLength,
+            ValueMinLength,
+            ValueName,
+            ValuePattern,
+            ValueRequired,
+            VatID,
+            Version,
+            VideoFrameSize,
+            VideoQuality,
+            VolumeNumber,
+            Warning,
+            WebCheckinTime,
+            WordCount,
+            WorkHours,
+            Workload,
+            WorstRating);
+  }
 }
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SPSensor.java
 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SPSensor.java
index f7c040f..b723085 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SPSensor.java
+++ 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SPSensor.java
@@ -18,6 +18,9 @@
 
 package org.apache.streampipes.vocabulary;
 
+import java.util.Arrays;
+import java.util.List;
+
 public class SPSensor {
 
   public static final String ACCELERATION_X = 
"http://streampipes.org/hmi/accelerationX";;
@@ -35,5 +38,16 @@ public class SPSensor {
 
   public static final String STATE = "http://streampipes.org/process/state";;
 
+  public static List<String> getAll() {
+    return Arrays.asList(ACCELERATION_X,
+            ACCELERATION_Y,
+            ACCELERATION_Z,
+            GYROSCOPE_X,
+            GYROSCOPE_Y,
+            GYROSCOPE_Z,
+            AMBIENT_LIGHT,
+            IMAGE,
+            STATE);
+  }
 
 }
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SemanticTypeRegistry.java
similarity index 52%
copy from 
streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
copy to 
streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SemanticTypeRegistry.java
index 18b14c0..43ef6b9 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geonames.java
+++ 
b/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/SemanticTypeRegistry.java
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -16,18 +15,38 @@
  * limitations under the License.
  *
  */
-
 package org.apache.streampipes.vocabulary;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+public enum SemanticTypeRegistry {
+
+  INSTANCE;
+
+  private List<String> semanticTypes;
+
+  SemanticTypeRegistry() {
+    this.semanticTypes = new ArrayList<>();
+    registerTypes();
+  }
 
-public class Geonames {
+  private void registerTypes() {
+    this.semanticTypes.addAll(SPSensor.getAll());
+    this.semanticTypes.addAll(SO.getAll());
+    this.semanticTypes.addAll(Geo.getAll());
+    this.semanticTypes.addAll(Geonames.getAll());
+  }
 
-    public static String AlternateName = 
"http://www.geonames.org/ontology#alternateName";;
-    public static String CountryCode = 
"http://www.geonames.org/ontology#countryCode";;
-    public static String Name = "http://www.geonames.org/ontology#name";;
-    public static String OfficialName = 
"http://www.geonames.org/ontology#officialName";;
-    public static String Population = 
"http://www.geonames.org/ontology#population";;
-    public static String PostalCode = 
"http://www.geonames.org/ontology#postalCode";;
-    public static String ShortName = 
"http://www.geonames.org/ontology#shortName";;
+  public List<String> getAllSemanticTypes() {
+    return semanticTypes;
+  }
 
+  public List<String> matches(String text) {
+    return this.semanticTypes
+            .stream()
+            .filter(type -> type.contains(text))
+            .collect(Collectors.toList());
+  }
 }
diff --git 
a/ui/src/app/connect/components/schema-editor/event-schema/event-schema.component.html
 
b/ui/src/app/connect/components/schema-editor/event-schema/event-schema.component.html
index cf0fe17..c732dc3 100644
--- 
a/ui/src/app/connect/components/schema-editor/event-schema/event-schema.component.html
+++ 
b/ui/src/app/connect/components/schema-editor/event-schema/event-schema.component.html
@@ -58,7 +58,7 @@
                     <mat-spinner fxLayoutAlign="center" style="margin: 10px 0 
5px 0">Loading</mat-spinner>
                 </div>
                 <div fxLayoutAlign="center">
-                    <h3>The system tries to guess the schema of the data</h3>
+                    <h3>Guessing the event schema...</h3>
                 </div>
             </div>
 
@@ -66,7 +66,7 @@
                 <div fxLayout="row" fxLayoutAlign="center center">
                     <mat-icon style="margin-top: 10px" 
class="md-accent">warning</mat-icon>
                     <span style="width: 10px;"></span>
-                    <h3>System error while guess the schema of the data</h3>
+                    <h3>Sorry, there was an error while guessing the schema of 
your configured data source...</h3>
                 </div>
                 <div fxLayout="row" fxLayoutAlign="center center">
                     <button mat-button class="md-accent">
@@ -98,4 +98,4 @@
     <div fxFlex="0 1 50%" *ngIf="isPreviewEnabled">
         <app-event-schema-preview 
[eventSchema]="eventSchema"></app-event-schema-preview>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git 
a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
 
b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
index 955e437..cf90f88 100644
--- 
a/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
+++ 
b/ui/src/app/connect/dialog/edit-event-property/edit-event-property.component.html
@@ -48,8 +48,13 @@
 
     <div class="form-group">
       <mat-form-field class="doubleWidth">
-        <input matInput placeholder="Domain Property" class="dmainProperty" 
name="domainproperty" id="domainproperty"
-               [(ngModel)]="cachedProperty.domainProperties[0]">
+        <input matInput placeholder="Semantic Type" class="dmainProperty" 
name="domainproperty" id="domainproperty"
+               [(ngModel)]="cachedProperty.domainProperties[0]" 
[matAutocomplete]="st" [formControl]="domainPropertyControl">
+      <mat-autocomplete #st="matAutocomplete" [panelWidth]="'300px'">
+        <mat-option *ngFor="let semanticType of semanticTypes | async" 
[value]="semanticType" style="font-size: 10pt;">
+          {{semanticType}}
+        </mat-option>
+      </mat-autocomplete>
       </mat-form-field>
       <div *ngIf="!isEventPropertyNested">
         <mat-checkbox name="timestampCheckbox"
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 852162a..b8e0425 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
@@ -17,7 +17,7 @@
  */
 
 import {Component, EventEmitter, Inject, OnInit, Output} from '@angular/core';
-import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
 import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';
 import {
   EventPropertyList,
@@ -28,6 +28,9 @@ import {
 import {SemanticTypeUtilsService} from 
'../../../core-services/semantic-type/semantic-type-utils.service';
 import {DataTypesService} from '../../services/data-type.service';
 import {MatSlideToggleChange} from "@angular/material/slide-toggle";
+import {SemanticTypesService} from 
"../../../platform-services/apis/semantic-types.service";
+import {Observable} from "rxjs";
+import {debounceTime, distinctUntilChanged, startWith, switchMap} from 
'rxjs/operators';
 
 @Component({
     selector: 'sp-edit-event-property',
@@ -51,7 +54,10 @@ export class EditEventPropertyComponent implements OnInit {
     isNumericProperty: boolean;
     isSaveBtnEnabled: boolean;
 
+    semanticTypes: Observable<Array<string>>;
+
     private propertyForm: FormGroup;
+    domainPropertyControl = new FormControl();
 
     private runtimeDataTypes;
 
@@ -59,7 +65,8 @@ export class EditEventPropertyComponent implements OnInit {
                 private dialogRef: MatDialogRef<EditEventPropertyComponent>,
                 private formBuilder: FormBuilder,
                 private dataTypeService: DataTypesService,
-                private semanticTypeUtilsService: SemanticTypeUtilsService) {
+                private semanticTypeUtilsService: SemanticTypeUtilsService,
+                private semanticTypesService: SemanticTypesService) {
     }
 
     ngOnInit(): void {
@@ -74,6 +81,15 @@ export class EditEventPropertyComponent implements OnInit {
         this.isNumericProperty = 
this.semanticTypeUtilsService.isNumeric(this.cachedProperty) ||
             this.dataTypeService.isNumeric(this.cachedProperty.runtimeType);
         this.createForm();
+        this.semanticTypes = this.domainPropertyControl.valueChanges
+            .pipe(
+                startWith(''),
+                debounceTime(400),
+                distinctUntilChanged(),
+                switchMap(val => {
+                    return val ? 
this.semanticTypesService.getSemanticTypes(val) : [];
+                })
+            );
     }
 
     copyEp(ep: EventPropertyUnion) {
diff --git 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
 b/ui/src/app/platform-services/apis/semantic-types.service.ts
similarity index 55%
copy from 
streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
copy to ui/src/app/platform-services/apis/semantic-types.service.ts
index d6ee002..5b6ee52 100644
--- 
a/streampipes-vocabulary/src/main/java/org/apache/streampipes/vocabulary/Geo.java
+++ b/ui/src/app/platform-services/apis/semantic-types.service.ts
@@ -16,11 +16,24 @@
  *
  */
 
-package org.apache.streampipes.vocabulary;
+import {Injectable} from "@angular/core";
+import {HttpClient} from "@angular/common/http";
+import {PlatformServicesCommons} from "./commons.service";
+import {map} from "rxjs/operators";
+import {Observable} from "rxjs";
 
-public class Geo {
+@Injectable()
+export class SemanticTypesService {
+
+  constructor(private http: HttpClient,
+              private platformServicesCommons: PlatformServicesCommons) {
+
+  }
+
+  getSemanticTypes(text: string): Observable<Array<string>> {
+    return this.http.get(this.platformServicesCommons.unauthenticatedBasePath 
+ "/autocomplete/semantic-type?text=" + text).pipe(map(response => {
+      return response as Array<string>;
+    }));
+  }
 
-       public static final String lat = 
"http://www.w3.org/2003/01/geo/wgs84_pos#lat";;
-       public static final String lng = 
"http://www.w3.org/2003/01/geo/wgs84_pos#long";;
-       public static final String alt = 
"http://www.w3.org/2003/01/geo/wgs84_pos#alt";;
 }
diff --git a/ui/src/app/platform-services/platform.module.ts 
b/ui/src/app/platform-services/platform.module.ts
index b5f8882..44c8bea 100644
--- a/ui/src/app/platform-services/platform.module.ts
+++ b/ui/src/app/platform-services/platform.module.ts
@@ -25,6 +25,7 @@ import {FilesService} from "./apis/files.service";
 import {MeasurementUnitsService} from "./apis/measurement-units.service";
 import {PipelineElementTemplateService} from 
"./apis/pipeline-element-template.service";
 import {PipelineMonitoringService} from "./apis/pipeline-monitoring.service";
+import {SemanticTypesService} from "./apis/semantic-types.service";
 
 @NgModule({
   imports: [],
@@ -38,7 +39,8 @@ import {PipelineMonitoringService} from 
"./apis/pipeline-monitoring.service";
     //PipelineTemplateService,
     PipelineElementService,
     PipelineMonitoringService,
-    PipelineService
+    PipelineService,
+    SemanticTypesService
   ],
   entryComponents: []
 })

Reply via email to