Search in sources :

Example 1 with ValueClassType

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

the class OmlRdfGenerator method getValueClasses.

/**
 * Converts from list of the OML Classes to the list of the JAXB generated
 * classes
 *
 * @param valueClasses
 * @return
 */
private List<ValueClassType> getValueClasses(List<IValueClass> valueClasses) {
    List<ValueClassType> vcTypes = new ArrayList<ValueClassType>();
    if (valueClasses != null) {
        ValueClassType vcType = new ValueClassType();
        IValueClass vClass;
        Iterator<IValueClass> iterator = valueClasses.iterator();
        while (iterator.hasNext()) {
            vClass = iterator.next();
            if (vClass.getAbout() != null) {
                vcType.setAbout(vClass.getAbout());
            }
            if (vClass.getResource() != null) {
                vcType.setResource(vClass.getResource());
            }
            if (vClass.getValue() != null) {
                vcType.getValue().addAll(getValueExpressionTypes(vClass.getValue()));
            }
            vcTypes.add(vcType);
        }
    }
    return vcTypes;
}
Also used : IValueClass(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass) ValueClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType) ArrayList(java.util.ArrayList)

Example 2 with ValueClassType

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

the class OmlRdfReader method getValueClass.

/**
 * Converts from List of JAXB Value Class objects to the list of the OML
 * objects
 *
 * @param valueClass
 * @return
 */
private List<IValueClass> getValueClass(List<ValueClassType> valueClass) {
    List<IValueClass> oValueClasses = new ArrayList<IValueClass>();
    IValueClass oValueClass = new ValueClass();
    Iterator<ValueClassType> iterator = valueClass.iterator();
    ValueClassType vcType;
    while (iterator.hasNext()) {
        vcType = iterator.next();
        // set about
        if (vcType.getAbout() != null) {
            ((ValueClass) oValueClass).setAbout(vcType.getAbout());
        }
        // set resource
        if (vcType.getResource() != null) {
            ((ValueClass) oValueClass).setResource(vcType.getResource());
        }
        // setValueExpression
        if (vcType.getValue() != null) {
            ((ValueClass) oValueClass).setValue(getValueExpression(vcType.getValue()));
        }
        oValueClasses.add(oValueClass);
    }
    return oValueClasses;
}
Also used : IValueClass(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass) ValueClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType) ArrayList(java.util.ArrayList) IValueClass(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass) ValueClass(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueClass)

Example 3 with ValueClassType

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

the class OmlRdfGenerator method getValueClass.

/**
 * Converts from List of HUMBOLDT OML ValueExpression To the JAXB generated
 * ValueClassType
 *
 * @param value
 * @return
 */
private ValueClassType getValueClass(List<IValueExpression> value) {
    if (getJAXBValueExpressions(value) != null) {
        ValueClassType vcType = new ValueClassType();
        vcType.getValue().addAll(getJAXBValueExpressions(value));
        return vcType;
    }
    return null;
}
Also used : ValueClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType)

Example 4 with ValueClassType

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

Aggregations

ValueClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType)4 IValueClass (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IValueClass)3 ArrayList (java.util.ArrayList)3 ValueClass (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.ValueClass)2 Restriction (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Restriction)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 ValueExprType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueExprType)1