Search in sources :

Example 6 with IValueExpression

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;
}
Also used : IValueExpression(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression) ValueExpression(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueExpression) IValueExpression(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression) ArrayList(java.util.ArrayList) ValueExprType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType)

Example 7 with IValueExpression

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;
}
Also used : IValueExpression(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression)

Example 8 with IValueExpression

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;
}
Also used : IValueExpression(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression)

Aggregations

IValueExpression (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression)8 ArrayList (java.util.ArrayList)4 ValueExpression (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueExpression)3 ValueExprType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType)3 Joiner (com.google.common.base.Joiner)1 ParameterValueBean (eu.esdihumboldt.hale.common.align.io.impl.internal.ParameterValueBean)1 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 Restriction (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1