public DomainStaticProperty(DomainStaticProperty other) { super(other); this.requiredClass = other.getRequiredClass(); this.supportedProperties = new Cloner().supportedProperties(other.getSupportedProperties()); }
/** * * @param label: A human-readable label that describes the required static property. * @param requiredConceptUri: Limits the search for matching instance in the knowledge base to an instance of this * concept. * @param supportedOntologyProperties: All RDF properties any instance of the provided concept must provide. Use * {@link org.streampipes.sdk.helpers.OntologyProperties} to assign supported properties. * @return */ public BU requiredOntologyConcept(Label label, String requiredConceptUri, SupportedProperty... supportedOntologyProperties) { DomainStaticProperty dsp = prepareStaticProperty(label, new DomainStaticProperty()); dsp.setSupportedProperties(Arrays.asList(supportedOntologyProperties)); dsp.setRequiredClass(requiredConceptUri); this.staticProperties.add(dsp); return me(); }
/** * Defines the requirement for an instance that is defined in the knowledge base. * @param label: A human-readable label that describes the required static property. * @param supportedOntologyProperties: All RDF properties any instance in the knowledge base must provide. Use * {@link org.streampipes.sdk.helpers.OntologyProperties} to assign supported properties. * @return */ public BU requiredOntologyConcept(Label label, SupportedProperty... supportedOntologyProperties) { DomainStaticProperty dsp = prepareStaticProperty(label, new DomainStaticProperty()); dsp.setSupportedProperties(Arrays.asList(supportedOntologyProperties)); this.staticProperties.add(dsp); return me(); }
public <V> V supportedOntologyPropertyValue(String domainPropertyInternalId, String propertyId, Class<V> targetClass) { DomainStaticProperty dsp = getStaticPropertyByName(domainPropertyInternalId, DomainStaticProperty.class); return typeParser.parse(dsp .getSupportedProperties() .stream() .filter(sp -> sp.getPropertyId().equals(propertyId)) .findFirst() .map(SupportedProperty::getValue) .get(), targetClass); }
public StaticProperty staticProperty(StaticProperty o) { if (o instanceof FreeTextStaticProperty) { return new FreeTextStaticProperty((FreeTextStaticProperty) o); } else if (o instanceof OneOfStaticProperty) { return new OneOfStaticProperty((OneOfStaticProperty) o); } else if (o instanceof RemoteOneOfStaticProperty) { return new RemoteOneOfStaticProperty((RemoteOneOfStaticProperty) o); } else if (o instanceof MappingPropertyNary) { return new MappingPropertyNary((MappingPropertyNary) o); } else if (o instanceof DomainStaticProperty) { return new DomainStaticProperty((DomainStaticProperty) o); } else if (o instanceof AnyStaticProperty) { return new AnyStaticProperty((AnyStaticProperty) o); } else if (o instanceof CollectionStaticProperty) { return new CollectionStaticProperty((CollectionStaticProperty) o); } else if (o instanceof MatchingStaticProperty) { return new MatchingStaticProperty((MatchingStaticProperty) o); } else if (o instanceof RuntimeResolvableOneOfStaticProperty) { return new RuntimeResolvableOneOfStaticProperty((RuntimeResolvableOneOfStaticProperty) o); } else if (o instanceof RuntimeResolvableAnyStaticProperty) { return new RuntimeResolvableAnyStaticProperty((RuntimeResolvableAnyStaticProperty) o); } else { return new MappingPropertyUnary((MappingPropertyUnary) o); } }
private DataSinkInvocation updateKafkaSec(DataSinkInvocation actionClient, PipelineModificationMessage message) { List<StaticProperty> properties = message.getPipelineModifications().get(0).getStaticProperties(); List<StaticProperty> newStaticProperties = new ArrayList<>(); for (StaticProperty p : properties) { if (p instanceof FreeTextStaticProperty ||p instanceof DomainStaticProperty) { if (p instanceof FreeTextStaticProperty) { if (p.getInternalName().equals("topic")) ((FreeTextStaticProperty) p).setValue(outputTopic); } else if (p instanceof DomainStaticProperty) { for(SupportedProperty sp : ((DomainStaticProperty) p).getSupportedProperties()) { if (sp.getPropertyId().equals("http://schema.org/kafkaHost")) sp.setValue(String .valueOf(BackendConfig.INSTANCE.getKafkaHost())); else if (sp.getPropertyId().equals("http://schema.org/kafkaPort")) sp.setValue(String .valueOf(BackendConfig.INSTANCE.getKafkaPort())); } } } newStaticProperties.add(p); } actionClient.setStaticProperties(newStaticProperties); return actionClient; }
private DataSinkInvocation updateKafkaSec(DataSinkInvocation actionClient, PipelineModificationMessage message) { List<StaticProperty> properties = message.getPipelineModifications().get(0).getStaticProperties(); List<StaticProperty> newStaticProperties = new ArrayList<>(); for (StaticProperty p : properties) { if (p instanceof FreeTextStaticProperty ||p instanceof DomainStaticProperty) { if (p instanceof FreeTextStaticProperty) { if (p.getInternalName().equals("topic")) ((FreeTextStaticProperty) p).setValue(outputTopic); } else if (p instanceof DomainStaticProperty) { for(SupportedProperty sp : ((DomainStaticProperty) p).getSupportedProperties()) { if (sp.getPropertyId().equals("http://schema.org/kafkaHost")) sp.setValue(String .valueOf(BackendConfig.INSTANCE.getKafkaHost())); else if (sp.getPropertyId().equals("http://schema.org/kafkaPort")) sp.setValue(String .valueOf(BackendConfig.INSTANCE.getKafkaPort())); } } } newStaticProperties.add(p); } actionClient.setStaticProperties(newStaticProperties); return actionClient; }