Search in sources :

Example 1 with ValueConditionType

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

the class OmlRdfGenerator method getValueConditions.

/**
 * Converts from the list of restrictions to the collection of the
 * ValueConditionType
 *
 * @param restrictions
 * @return
 */
private Collection<? extends ValueConditionType> getValueConditions(List<Restriction> restrictions) {
    if (restrictions != null) {
        ArrayList<ValueConditionType> vcTypes = new ArrayList<ValueConditionType>(restrictions.size());
        ValueConditionType vcType;
        Restriction restriction;
        Iterator<?> iterator = restrictions.iterator();
        while (iterator.hasNext()) {
            restriction = (Restriction) iterator.next();
            vcType = getValueConditionType(restriction);
            vcTypes.add(vcType);
        }
        return vcTypes;
    }
    return new ArrayList<ValueConditionType>();
}
Also used : Restriction(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction) ArrayList(java.util.ArrayList) ValueConditionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueConditionType)

Example 2 with ValueConditionType

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

the class OmlRdfGenerator method getValueConditionType.

/**
 * converts from OML Restriction to the JAXB ValueConditionType
 *
 * @param restriction
 * @return
 */
private ValueConditionType getValueConditionType(Restriction restriction) {
    ValueConditionType vcType = new ValueConditionType();
    vcType.setRestriction(getRestrictionType(restriction));
    if (restriction.getSeq() != null) {
        vcType.setSeq(restriction.getSeq());
    }
    return vcType;
}
Also used : ValueConditionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueConditionType)

Example 3 with ValueConditionType

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

ValueConditionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueConditionType)3 Restriction (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction)2 ArrayList (java.util.ArrayList)2 ValueExprType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType)1