use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression in project hale by halestudio.
the class OmlRdfReader method getValueExpression.
/**
* Conversts from the list of <ValueExprType> to the list of ValueExpression
*
* @param valueExpr
* @return
*/
private List<IValueExpression> getValueExpression(List<ValueExprType> valueExpr) {
List<IValueExpression> omlExpressions = new ArrayList<IValueExpression>(valueExpr.size());
ValueExpression omlExpr;
Iterator<ValueExprType> iterator = valueExpr.iterator();
while (iterator.hasNext()) {
ValueExprType jaxbExpr = iterator.next();
if (jaxbExpr.getLiteral() != null) {
omlExpr = new ValueExpression(jaxbExpr.getLiteral());
if (jaxbExpr.getMax() != null) {
omlExpr.setMax(jaxbExpr.getMax());
}
if (jaxbExpr.getMin() != null) {
omlExpr.setMin(jaxbExpr.getMin());
}
// TODO implement set Apply
// omlExpr.setApply(getFunction(jaxbExpr.getApply()));
omlExpressions.add(omlExpr);
}
}
return omlExpressions;
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression in project hale by halestudio.
the class EqualComparator method evaluate.
/*
* (non-Javadoc)
*
* @see
* eu.esdihumboldt.goml.omwg.comparator.IComparator#evaluate(java.util.List,
* java.util.List)
*/
@Override
public boolean evaluate(Restriction sourceRestriction, Property sourceProp) {
List<IValueExpression> sourceValues = sourceRestriction.getValue();
Object sourcePropValue = sourceProp.getValue();
LOG.debug("There are " + sourceValues.size() + " source values in the " + sourceRestriction);
LOG.debug("The source property value is: " + sourcePropValue);
// TODO Will there be a collection of source values for equals?.
for (IValueExpression value : sourceValues) {
if (sourcePropValue.equals(value.getLiteral())) {
LOG.debug("Found a match between " + sourcePropValue + " and " + value.getLiteral());
// The value is equal so we can return true.
return true;
}
}
LOG.debug("No matches found for " + sourcePropValue);
return false;
}
use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression in project hale by halestudio.
the class OneOfComparator method evaluate.
/*
* (non-Javadoc)
*
* @see
* eu.esdihumboldt.goml.omwg.comparator.IComparator#evaluate(java.util.List,
* java.util.List)
*/
@Override
public boolean evaluate(Restriction sourceRestriction, Property sourceProp) {
List<IValueExpression> sourceValues = sourceRestriction.getValue();
Object sourcePropValue = sourceProp.getValue();
LOG.debug("There are " + sourceValues.size() + " source values in the " + sourceRestriction);
LOG.debug("The source property value is: " + sourcePropValue);
for (IValueExpression value : sourceValues) {
// would have worked on the value object
if (sourcePropValue.equals(value.getLiteral())) {
// We have found one of the values so we can break and return
// true;
LOG.debug("Found a match between " + sourcePropValue + " and " + value.getLiteral());
return true;
}
}
LOG.debug("No matches found for " + sourcePropValue);
return false;
}
Aggregations