@Override public boolean match(EventSchema offer, EventSchema requirement, List<MatchingResultMessage> errorLog) { boolean matches = MatchingUtils.nullCheck(offer, requirement) || requirement.getEventProperties() .stream() .allMatch(req -> offer .getEventProperties() .stream() .anyMatch(of -> new PropertyMatch().match(of, req, errorLog))); //if (!matches) buildErrorMessage(errorLog, builtText(requirement)); return matches; }
private boolean inStream(SpDataStream stream, URI mapsFrom) { return stream .getEventSchema() .getEventProperties() .stream().anyMatch(ep -> ep.getElementId().equals(mapsFrom.toString())); }
private String makeEvent() { JsonObject jsonObject = new JsonObject(); for (EventProperty property : schema.getEventProperties()) { jsonObject.add(property.getRuntimeName(), makeValue(property)); } return jsonObject.toString(); }
@Override public EventSchema buildFromOneStream(SpDataStream stream) { properties.addAll(stream.getEventSchema().getEventProperties()); properties.addAll(renameDuplicates(stream.getEventSchema().getEventProperties())); return new EventSchema(properties); }
public Object nextEvent() { return formatGenerator.makeOutputFormat(makeEvent(new HashMap<>(), schema.getEventProperties())); }
@Override public EventSchema buildFromOneStream(SpDataStream stream) { properties.addAll(stream.getEventSchema().getEventProperties()); properties.addAll(renameDuplicates(stream.getEventSchema().getEventProperties())); return new EventSchema(properties); }
private String getElementId(String humanDescription) throws Exception { for(EventProperty p : streamToReplace.getEventSchema().getEventProperties()) { if (p.getRuntimeName().equals(humanDescription)) return p.getElementId(); } throw new Exception("Property not found"); }
@Override public EventSchema buildFromTwoStreams(SpDataStream stream1, SpDataStream stream2) { properties.addAll(renameDuplicates(stream1.getEventSchema().getEventProperties())); properties.addAll(renameDuplicates(stream2.getEventSchema().getEventProperties())); return new EventSchema(properties); }
public List<String> getOutputProperties() { return SchemaUtils.toPropertyList(outputStream.getEventSchema().getEventProperties()); }
@Override public EventSchema buildFromOneStream(SpDataStream stream) { return makeList(stream.getEventSchema().getEventProperties()); }
@Override public EventSchema buildFromTwoStreams(SpDataStream stream1, SpDataStream stream2) { properties.addAll(renameDuplicates(stream1.getEventSchema().getEventProperties())); properties.addAll(renameDuplicates(stream2.getEventSchema().getEventProperties())); return new EventSchema(properties); }
public List<String> mappingPropertyValues(String staticPropertyName, boolean completeNames, URI propertyURI) { for (SpDataStream stream : sepaElement.getInputStreams()) { List<String> matchedProperties = getMappingPropertyName(stream.getEventSchema().getEventProperties(), propertyURI, completeNames, ""); if (matchedProperties.size() > 0) { return matchedProperties; } } return null; //TODO: exceptions }
@Override public EventSchema buildFromTwoStreams(SpDataStream stream1, SpDataStream stream2) { EventSchema resultSchema = new EventSchema(); List<EventProperty> properties = new ArrayList<>(); properties.addAll(stream1.getEventSchema().getEventProperties()); if (strategy.isKeepBoth()) { properties.addAll(new PropertyDuplicateRemover(properties, stream2.getEventSchema().getEventProperties()).rename()); } resultSchema.setEventProperties(properties); return resultSchema; }
public static GuessSchema guessSchma(EventSchema eventSchema, List<Map<String, Object>> nElements) { GuessSchema result = new GuessSchema(); List<DomainPropertyProbabilityList> allDomainPropertyProbabilities = getDomainPropertyProbabitlyList(eventSchema.getEventProperties(), nElements, new ArrayList<>()); result.setEventSchema(eventSchema); result.setPropertyProbabilityList(allDomainPropertyProbabilities); return result; }
BindingParams(I graph) { this.graph = graph; this.inEventTypes = new HashMap<>(); graph.getInputStreams().forEach(is -> inEventTypes.put(is.getEventGrounding().getTransportProtocol().getTopicDefinition().getActualTopicName(), SchemaUtils .toRuntimeMap (is.getEventSchema().getEventProperties()))); graph.getInputStreams().forEach(s -> inputStreamParams.add(new InputStreamParams(s))); }
public Builder getEventStream(Builder b, SpDataStream spDataStream, int n) { b = getEventProperties(b, spDataStream.getEventSchema().getEventProperties(), n); b.addStatement( "$T stream$L = $T.createStream($S, $S, $S).schema($T.create().properties(eventProperties$L).build()).build()", JFC.EVENT_STREAM, n, JFC.STREAM_BUILDER, spDataStream.getName(), spDataStream.getDescription(), spDataStream.getUri(), JFC.SCHEMA_BUILDER, n); return b; }
public Builder getEventStream(Builder b, SpDataStream spDataStream, int n) { b = getEventProperties(b, spDataStream.getEventSchema().getEventProperties(), n); b.addStatement( "$T stream$L = $T.createStream($S, $S, $S).schema($T.create().properties(eventProperties$L).build()).build()", JFC.EVENT_STREAM, n, JFC.STREAM_BUILDER, spDataStream.getName(), spDataStream.getDescription(), spDataStream.getUri(), JFC.SCHEMA_BUILDER, n); return b; }
public EventSchema generateSchema(EventSchema schemaRequirement, boolean minimumSchema) { EventSchema schema = new EventSchema(); for(EventProperty requiredProperty : schemaRequirement.getEventProperties()) { if (requiredProperty instanceof EventPropertyPrimitive) schema.addEventProperty(new EventPropertyPrimitive(((EventPropertyPrimitive) requiredProperty).getRuntimeType(), MonitoringUtils.randomKey(), "", requiredProperty.getDomainProperties())); //else if (requiredProperty instanceof EventPropertyNested) } return schema; }
public EventProcessorBindingParams(DataProcessorInvocation graph) { super(new DataProcessorInvocation(graph)); this.outEventType = SchemaUtils.toRuntimeMap(graph.getOutputStream().getEventSchema().getEventProperties()); outputStream = graph.getOutputStream(); EventGrounding outputGrounding = outputStream.getEventGrounding(); outName = outputGrounding.getTransportProtocol().getTopicDefinition().getActualTopicName(); }
public EventProcessorBindingParams(DataProcessorInvocation graph) { super(new DataProcessorInvocation(graph)); this.outEventType = SchemaUtils.toRuntimeMap(graph.getOutputStream().getEventSchema().getEventProperties()); outputStream = graph.getOutputStream(); EventGrounding outputGrounding = outputStream.getEventGrounding(); outName = outputGrounding.getTransportProtocol().getTopicDefinition().getActualTopicName(); }