use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassConditionType in project hale by halestudio.
the class OmlRdfGenerator method getConditions.
/**
* Converts from List of OML Restrictions to the List of the Jaxb
* ClassConditionType
*
* @param attributeTypeCondition
* @return
*/
private Collection<? extends ClassConditionType> getConditions(List<Restriction> restrictions) {
if (restrictions != null) {
ArrayList<ClassConditionType> conditions = new ArrayList<ClassConditionType>(restrictions.size());
ClassConditionType condition;
Restriction restriction;
Iterator<?> iterator = restrictions.iterator();
while (iterator.hasNext()) {
restriction = (Restriction) iterator.next();
if (restriction != null) {
condition = new ClassConditionType();
condition.setRestriction(getRestrictionType(restriction));
conditions.add(condition);
}
}
return conditions;
}
return new ArrayList<ClassConditionType>();
}
use of eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassConditionType 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;
}
Aggregations