Search in sources :

Example 1 with ValueExprType

use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType in project hale by halestudio.

the class OmlRdfGenerator method getJAXBValueExpressions.

private Collection<? extends ValueExprType> getJAXBValueExpressions(List<IValueExpression> value) {
    List<ValueExprType> vExpressions = new ArrayList<ValueExprType>(value.size());
    Iterator<?> iterator = value.iterator();
    ValueExprType veType;
    while (iterator.hasNext()) {
        ValueExpression ve = (ValueExpression) iterator.next();
        veType = new ValueExprType();
        if (ve.getLiteral() != null) {
            veType.setLiteral(ve.getLiteral());
        }
        if (ve.getMax() != null) {
            veType.setMax(ve.getMax());
        }
        if (ve.getMin() != null) {
            veType.setMin(ve.getMin());
        }
        if (ve.getApply() != null) {
            veType.setApply(getApplayType(ve.getApply()));
        }
        vExpressions.add(veType);
    }
    return vExpressions;
}
Also used : 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 2 with ValueExprType

use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType in project hale by halestudio.

the class OmlRdfGenerator method getValueExpressionTypes.

// /**
// * Converts from OML Restriction to the JAXB PropertyValueRestrictionType
// *
// * @param restriction
// * @return
// */
// private PropValueRestrictionType getPropertyValueRestrictionType(Restriction restriction) {
// PropValueRestrictionType pvrType = new PropValueRestrictionType();
// if (restriction != null) {
// if (restriction.getComparator() != null) {
// pvrType.setComparator(getComparator(restriction.getComparator()));
// }
// if (restriction.getValue() != null) {
// pvrType.getValue().addAll(getValueExpressionTypes(restriction.getValue()));
// }
// }
// return pvrType;
// }
/**
 * Converts from List of ValueExpression to the Collection of ValueExprType
 *
 * @param value
 * @return
 */
private Collection<? extends ValueExprType> getValueExpressionTypes(List<IValueExpression> values) {
    if (values != null) {
        ArrayList<ValueExprType> veTypes = new ArrayList<ValueExprType>(values.size());
        ValueExprType veType;
        ValueExpression expression;
        Iterator<?> iterator = values.iterator();
        while (iterator.hasNext()) {
            expression = (ValueExpression) iterator.next();
            veType = getValueExprType(expression);
            veTypes.add(veType);
        }
        return veTypes;
    }
    return new ArrayList<ValueExprType>();
}
Also used : 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 3 with ValueExprType

use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType 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 4 with ValueExprType

use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType in project hale by halestudio.

the class OmlRdfReader method getRestrictions.

/**
 * converts from a list of the ClassConditionType to the list of the
 * Restriction type
 *
 * @param List of ClassConditionType
 * @return
 */
private List<Restriction> getRestrictions(List<ClassConditionType> classConditions) {
    List<Restriction> restrictions = new ArrayList<Restriction>(classConditions.size());
    Iterator<ClassConditionType> iterator = classConditions.iterator();
    Restriction restriction = null;
    ClassConditionType classCondition;
    while (iterator.hasNext()) {
        classCondition = iterator.next();
        RestrictionType rType = classCondition.getRestriction();
        if (rType != null) {
            // set value expression if exist
            if (rType.getValue() != null) {
                List<ValueExprType> valueExpr = rType.getValue();
                restriction = new Restriction(getValueExpression(valueExpr));
            } else {
                throw new IllegalStateException("Can't create restriction");
            }
            // set value class to add about and resource document
            ValueClass vClass = new ValueClass();
            ValueClassType vcType = rType.getValueClass();
            if (vcType != null) {
                vClass.setAbout(vcType.getAbout());
                vClass.setResource(vcType.getResource());
                vClass.getValue().addAll(getValueExpression(vcType.getValue()));
                restriction.setValueClass(vClass);
            }
            if (rType.getComparator() != null) {
                restriction.setComparator(getComparator(rType.getComparator()));
            }
            if (rType.getCqlStr() != null) {
                restriction.setCqlStr(rType.getCqlStr());
            }
        }
        // TODO clear with MdV
        // restriction = new Restriction(null,
        // getValueExpression(valueExpr));
        restrictions.add(restriction);
    }
    return restrictions;
}
Also used : ClassConditionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassConditionType) Restriction(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction) ValueClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType) ArrayList(java.util.ArrayList) ValueExprType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType) IValueClass(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass) ValueClass(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueClass) DomainRestrictionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.DomainRestrictionType) RestrictionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RestrictionType) RangeRestrictionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RangeRestrictionType)

Example 5 with ValueExprType

use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType in project hale by halestudio.

the class OmlRdfReader method getValueCondition.

/**
 * Converts from List<ValueConditionType> to List<Restriction>
 *
 * @param valueCondition
 * @return
 */
private List<Restriction> getValueCondition(List<ValueConditionType> valueCondition) {
    List<Restriction> restrictions = new ArrayList<Restriction>(valueCondition.size());
    Iterator<ValueConditionType> iterator = valueCondition.iterator();
    Restriction restriction;
    List<ValueExprType> valueExpr = null;
    while (iterator.hasNext()) {
        ValueConditionType condition = iterator.next();
        // get List<ValueExpressionType>
        if (condition.getRestriction() != null && condition.getRestriction().getValue() != null) {
            valueExpr = condition.getRestriction().getValue();
        }
        if ((valueExpr == null || valueExpr.size() == 0) && condition.getRestriction().getValueClass() != null) {
            valueExpr = condition.getRestriction().getValueClass().getValue();
        }
        // TODO:clear with MdV
        // restriction = new Restriction(null,
        // getValueExpression(valueExpr));
        restriction = new Restriction(getValueExpression(valueExpr));
        if (condition.getRestriction() != null && condition.getRestriction().getComparator() != null) {
            restriction.setComparator(getComparator(condition.getRestriction().getComparator()));
        }
        // add Sequence ID if it exists
        if (condition.getSeq() != null) {
            restriction.setSeq(condition.getSeq());
        }
        // TODO add Property onAttribute
        restrictions.add(restriction);
    }
    return restrictions;
}
Also used : Restriction(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction) ArrayList(java.util.ArrayList) ValueExprType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType) ValueConditionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueConditionType)

Aggregations

ValueExprType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType)5 ArrayList (java.util.ArrayList)5 ValueExpression (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueExpression)3 IValueExpression (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueExpression)3 Restriction (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction)2 ValueClass (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueClass)1 IValueClass (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass)1 ClassConditionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassConditionType)1 DomainRestrictionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.DomainRestrictionType)1 RangeRestrictionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RangeRestrictionType)1 RestrictionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RestrictionType)1 ValueClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType)1 ValueConditionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueConditionType)1