This is an automated email from the ASF dual-hosted git repository.
zehnder pushed a commit to branch
3597-remove-deprecated-methods-from-epproperties
in repository https://gitbox.apache.org/repos/asf/streampipes.git
The following commit(s) were added to
refs/heads/3597-remove-deprecated-methods-from-epproperties by this push:
new 19eed96234 refactor(#3597): Remove deprecated methods using
domainProperty instead of semanticType
19eed96234 is described below
commit 19eed96234c96922156e2b20e8ceb6fded9e08f3
Author: Philipp Zehnder <[email protected]>
AuthorDate: Wed May 7 11:20:42 2025 +0200
refactor(#3597): Remove deprecated methods using domainProperty instead of
semanticType
---
.../streampipes/sdk/helpers/EpProperties.java | 229 ++++++++++-----------
1 file changed, 109 insertions(+), 120 deletions(-)
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 daec2d22b1..242e7dc651 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
@@ -30,22 +30,25 @@ import org.apache.streampipes.vocabulary.SO;
import org.apache.streampipes.vocabulary.SPSensor;
import org.apache.streampipes.vocabulary.XSD;
-import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class EpProperties {
- public static EventPropertyNested nestedEp(Label label, String runtimeName,
EventProperty...
- eventProperties) {
+ public static EventPropertyNested nestedEp(
+ Label label, String runtimeName, EventProperty...
+ eventProperties
+ ) {
EventPropertyNested nestedProperty = getPreparedProperty(label, new
EventPropertyNested(runtimeName));
nestedProperty.setEventProperties(new
ArrayList<>(Arrays.asList(eventProperties)));
return nestedProperty;
}
- public static EventPropertyList listNestedEp(Label label, String runtimeName,
- List<EventProperty>
listItemProperties) {
+ public static EventPropertyList listNestedEp(
+ Label label, String runtimeName,
+ List<EventProperty> listItemProperties
+ ) {
EventPropertyList list = getPreparedProperty(label, new
EventPropertyList());
list.setRuntimeName(runtimeName);
@@ -56,8 +59,10 @@ public class EpProperties {
return list;
}
- public static EventPropertyList listNestedEp(Label label, String
runtimeName, String
- semanticType, List<EventProperty> listItemProperties) {
+ public static EventPropertyList listNestedEp(
+ Label label, String runtimeName, String
+ semanticType, List<EventProperty> listItemProperties
+ ) {
EventPropertyList list = listNestedEp(label, runtimeName,
listItemProperties);
list.setSemanticType(semanticType);
return list;
@@ -70,9 +75,10 @@ public class EpProperties {
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive timestampProperty(String runtimeName) {
- // TODO we need a real timestamp property!
- EventPropertyPrimitive ep = ep(Labels.from("", "Timestamp", "The current
timestamp value"),
- XSD.LONG.toString(), runtimeName, "http://schema.org/DateTime");
+ EventPropertyPrimitive ep = ep(
+ Labels.from("", "Timestamp", "The current timestamp value"),
+ XSD.LONG.toString(), runtimeName, SO.DATE_TIME
+ );
ep.setPropertyScope(PropertyScope.HEADER_PROPERTY.name());
return ep;
}
@@ -84,8 +90,10 @@ public class EpProperties {
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive imageProperty(String runtimeName) {
- EventPropertyPrimitive ep = ep(Labels.from("", "Image", ""),
- XSD.STRING.toString(), runtimeName, SPSensor.IMAGE);
+ EventPropertyPrimitive ep = ep(
+ Labels.from("", "Image", ""),
+ XSD.STRING.toString(), runtimeName, SPSensor.IMAGE
+ );
ep.setPropertyScope(PropertyScope.MEASUREMENT_PROPERTY.name());
return ep;
}
@@ -93,11 +101,11 @@ public class EpProperties {
/**
* Creates a new list-based event property of type integer and with the
assigned domain property.
*
- * @param label A human-readable label of the property
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable label of the property
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyList listIntegerEp(Label label, String
runtimeName, String semanticType) {
@@ -107,11 +115,11 @@ public class EpProperties {
/**
* Creates a new list-based event property of type long and with the
assigned domain property.
*
- * @param label A human-readable label of the property
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable label of the property
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyList listLongEp(Label label, String runtimeName,
String semanticType) {
@@ -121,11 +129,11 @@ public class EpProperties {
/**
* Creates a new list-based event property of type double and with the
assigned domain property.
*
- * @param label A human-readable label of the property
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable label of the property
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyList listDoubleEp(Label label, String
runtimeName, String semanticType) {
@@ -135,11 +143,11 @@ public class EpProperties {
/**
* Creates a new list-based event property of type string and with the
assigned domain property.
*
- * @param label A human-readable label of the property
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable label of the property
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyList listStringEp(Label label, String
runtimeName, String semanticType) {
@@ -149,23 +157,31 @@ public class EpProperties {
/**
* Creates a new list-based event property of type boolean and with the
assigned domain property.
*
- * @param label A human-readable label of the property
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable label of the property
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyList listBooleanEp(Label label, String
runtimeName, String semanticType) {
return listEp(label, runtimeName, Datatypes.Boolean, semanticType);
}
- public static EventPropertyList listEp(Label label, String runtimeName,
Datatypes runtimeType, String
- semanticType) {
- return getPreparedProperty(label, new EventPropertyList(runtimeName,
ep(Labels.empty(), runtimeType
- .toString(),
- runtimeName,
- semanticType)));
+ public static EventPropertyList listEp(
+ Label label, String runtimeName, Datatypes runtimeType, String
+ semanticType
+ ) {
+ return getPreparedProperty(
+ label, new EventPropertyList(
+ runtimeName, ep(
+ Labels.empty(), runtimeType
+ .toString(),
+ runtimeName,
+ semanticType
+ )
+ )
+ );
}
/**
@@ -188,18 +204,20 @@ public class EpProperties {
* @param eventProperty The complex type of data in the list
* @return {@link org.apache.streampipes.model.schema.EventPropertyList}
*/
- public static EventPropertyList listEp(Label label, String runtimeName,
EventProperty eventProperty,
- String semanticType) {
+ public static EventPropertyList listEp(
+ Label label, String runtimeName, EventProperty eventProperty,
+ String semanticType
+ ) {
return getPreparedProperty(label, new EventPropertyList(runtimeName,
eventProperty, semanticType));
}
/**
* Creates a new primitive property of type boolean and the provided domain
property.
*
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive booleanEp(Label label, String
runtimeName, String semanticType) {
@@ -209,10 +227,10 @@ public class EpProperties {
/**
* Creates a new primitive property of type number and the provided domain
property.
*
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive numberEp(Label label, String
runtimeName, String semanticType) {
@@ -222,10 +240,10 @@ public class EpProperties {
/**
* Creates a new primitive property of type string and the provided domain
property.
*
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive stringEp(Label label, String
runtimeName, String semanticType) {
@@ -235,15 +253,17 @@ public class EpProperties {
/**
* Creates a new primitive property of type string and the provided domain
property.
*
- * @param runtimeName The field identifier of the event property at
runtime.
- * @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
- * @param propertyScope The scope for the property, whether it is a HEADER,
MEASUREMENT, od DIMENSION property
+ * @param runtimeName The field identifier of the event property at
runtime.
+ * @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
+ * provided by a vocabulary. Use one of the
vocabularies provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * @param propertyScope The scope for the property, whether it is a HEADER,
MEASUREMENT, od DIMENSION property
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
- public static EventPropertyPrimitive stringEp(Label label, String
runtimeName, String semanticType,
- PropertyScope propertyScope) {
+ public static EventPropertyPrimitive stringEp(
+ Label label, String runtimeName, String semanticType,
+ PropertyScope propertyScope
+ ) {
EventPropertyPrimitive ep = ep(label, XSD.STRING.toString(), runtimeName,
semanticType);
ep.setPropertyScope(propertyScope.name());
return ep;
@@ -253,89 +273,61 @@ public class EpProperties {
* Creates a new primitive property of type string and the provided domain
property. In addition, the value range
* of the property is restricted to the defined {@link
org.apache.streampipes.model.schema.Enumeration}
*
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. The
string should correspond to a URI
- * provided by a vocabulary. Use one of the
vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
- * @param enumeration The allowed values of the event property at runtime.
+ * provided by a vocabulary. Use one of the vocabularies
provided in
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * @param enumeration The allowed values of the event property at runtime.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
- public static EventPropertyPrimitive stringEp(Label label, String
runtimeName, String semanticType, Enumeration
- enumeration) {
+ public static EventPropertyPrimitive stringEp(
+ Label label, String runtimeName, String semanticType, Enumeration
+ enumeration
+ ) {
EventPropertyPrimitive ep = ep(label, XSD.STRING.toString(), runtimeName,
semanticType);
ep.setValueSpecification(enumeration);
return ep;
}
- /**
- * Creates a new primitive property of type string and the provided domain
property. In addition, the value range
- * of the property is restricted to the defined {@link
org.apache.streampipes.model.schema.Enumeration}
- *
- * @param runtimeName The field identifier of the event property at
runtime.
- * @param domainProperties The semantics of the list property as a list of
URIs. Use one of the vocabularies
- * provided in
- * {@link org.apache.streampipes.vocabulary} or
create your own domain-specific vocabulary.
- * @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
- */
- public static EventPropertyPrimitive stringEp(Label label, String
runtimeName, List<URI> domainProperties) {
- return ep(label, XSD.STRING.toString(), runtimeName, domainProperties);
- }
-
/**
* Creates a new primitive property of type integer and the provided domain
property.
*
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. Use
one of the vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive integerEp(Label label, String
runtimeName, String semanticType) {
return ep(label, XSD.INTEGER.toString(), runtimeName, semanticType);
}
- /**
- * Creates a new primitive property of type integer and the provided domain
properties. In addition, the value range
- * of the property is restricted to the defined {@link
org.apache.streampipes.model.schema.Enumeration}
- *
- * @deprecated provide the semantic type as string
- * @param runtimeName The field identifier of the event property at
runtime.
- * @param domainProperties The semantics of the list property as a list of
URIs. Use one of the vocabularies
- * provided in
- * {@link org.apache.streampipes.vocabulary} or
create your own domain-specific vocabulary.
- * @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
- */
- @Deprecated(forRemoval = true, since = "0.97.0")
- public static EventPropertyPrimitive integerEp(Label label, String
runtimeName, List<URI> domainProperties) {
- return ep(label, XSD.INTEGER.toString(), runtimeName, domainProperties);
- }
/**
* Creates a new primitive property of type integer and the provided domain
property.
*
- * @param label A human-readable identifier of the property
presented to users in the StreamPipes UI.
- * If you do not want to have a label besides the
runtime name, use
- * {@link org.apache.streampipes.sdk.helpers.Labels}
- * @param runtimeName The field identifier of the event property at
runtime.
+ * @param label A human-readable identifier of the property presented
to users in the StreamPipes UI.
+ * If you do not want to have a label besides the
runtime name, use
+ * {@link org.apache.streampipes.sdk.helpers.Labels}
+ * @param runtimeName The field identifier of the event property at runtime.
* @param semanticType The semantics of the list property as a String. Use
one of the vocabularies provided in
- * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
+ * {@link org.apache.streampipes.vocabulary} or create
your own domain-specific vocabulary.
* @return {@link org.apache.streampipes.model.schema.EventPropertyPrimitive}
*/
public static EventPropertyPrimitive longEp(Label label, String runtimeName,
String semanticType) {
return ep(label, XSD.LONG.toString(), runtimeName, semanticType);
}
- @Deprecated(forRemoval = true, since = "0.97.0")
- public static EventPropertyPrimitive longEp(Label label, String runtimeName,
List<URI> domainProperties) {
- return ep(label, XSD.LONG.toString(), runtimeName, domainProperties);
- }
-
- public static EventPropertyPrimitive integerEp(Label label, String
runtimeName, String semanticType, Float
- minValue, Float maxValue, Float step) {
+ public static EventPropertyPrimitive integerEp(
+ Label label, String runtimeName, String semanticType, Float
+ minValue, Float maxValue, Float step
+ ) {
return integerEp(label, runtimeName, semanticType, new
QuantitativeValue(minValue, maxValue, step));
}
- public static EventPropertyPrimitive integerEp(Label label, String
runtimeName, String semanticType,
- QuantitativeValue
valueSpecification) {
+ public static EventPropertyPrimitive integerEp(
+ Label label, String runtimeName, String semanticType,
+ QuantitativeValue valueSpecification
+ ) {
EventPropertyPrimitive ep = ep(label, XSD.INTEGER.toString(), runtimeName,
semanticType);
ep.setValueSpecification(valueSpecification);
return ep;
@@ -345,24 +337,21 @@ public class EpProperties {
return ep(label, XSD.DOUBLE.toString(), runtimeName, semanticType);
}
- public static EventPropertyPrimitive doubleEp(Label label, String
runtimeName, String semanticType, Float minValue,
- Float maxValue, Float step) {
+ public static EventPropertyPrimitive doubleEp(
+ Label label, String runtimeName, String semanticType, Float minValue,
+ Float maxValue, Float step
+ ) {
EventPropertyPrimitive ep = ep(label, XSD.DOUBLE.toString(), runtimeName,
semanticType);
ep.setValueSpecification(new QuantitativeValue(minValue, maxValue, step));
return ep;
}
- public static EventPropertyPrimitive ep(Label label,
- String runtimeType,
- String runtimeName,
- String semanticType) {
- return getPreparedProperty(label, new EventPropertyPrimitive(runtimeType,
runtimeName, "", semanticType));
- }
-
- @Deprecated(forRemoval = true, since = "0.97.0")
- private static EventPropertyPrimitive ep(Label label, String runtimeType,
String runtimeName, List<URI>
- domainProperties) {
- String semanticType = domainProperties.isEmpty() ? null :
domainProperties.get(0).toString();
+ public static EventPropertyPrimitive ep(
+ Label label,
+ String runtimeType,
+ String runtimeName,
+ String semanticType
+ ) {
return getPreparedProperty(label, new EventPropertyPrimitive(runtimeType,
runtimeName, "", semanticType));
}