Search in sources :

Example 1 with Transformation

use of eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation in project hale by halestudio.

the class OmlRdfReader method getTransformation.

/**
 * Converts from the FunctionType to the Transformation
 *
 * @param transf
 * @return
 */
private Transformation getTransformation(FunctionType transf) {
    Transformation trans = new Transformation();
    if (transf != null) {
        // set Service
        if (transf.getResource() != null) {
            Resource resource = new Resource(transf.getResource());
            trans.setService(resource);
            // set parameter list
            if (transf.getParam() != null) {
                trans.setParameters(getParameters(transf.getParam()));
            }
        } else {
            trans = null;
        }
    }
    return trans;
}
Also used : Transformation(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation) Resource(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.Resource)

Example 2 with Transformation

use of eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation in project hale by halestudio.

the class OmlRdfReader method getEntity.

/**
 * Converts from the JAXB generated EntityType to the {@link IEntity}
 *
 * @param entity
 * @return
 */
private IEntity getEntity(JAXBElement<? extends EntityType> jaxbEntity) {
    EntityType entityType = jaxbEntity.getValue();
    // TODO allow to instantiate entity as Property, FeatureClass, Relation,
    // ComposedFeatureClass, ComposedFeatureType, composedRelation
    // instantiate entity es property
    Entity entity = null;
    IAbout about = null;
    // TODO add convertion to the RelationType if needed
    if (entityType instanceof PropertyType) {
        // make decision whether it is ComposedProperty
        if (((PropertyType) entityType).getPropertyComposition() != null) {
            PropertyCompositionType propCompType = ((PropertyType) entityType).getPropertyComposition();
            // instantiate entity as ComposedProperty
            if (entityType.getAbout() != null) {
                about = new About(entityType.getAbout());
            }
            entity = new ComposedProperty(getOperator(propCompType.getOperator()), about);
            if (propCompType.getCollection() != null && propCompType.getCollection().getItem().size() > 0) {
                // set collection
                ((ComposedProperty) entity).setCollection(getPropertyCollection(propCompType.getCollection()));
            } else if (propCompType.getProperty() != null) {
                // set Property
                ((ComposedProperty) entity).getCollection().add(getProperty(propCompType.getProperty()));
            } else if (propCompType.getRelation() != null) {
                // set Relation
                ((ComposedProperty) entity).setRelation(getOMLRelation(propCompType.getRelation()));
            }
        // set ComposedProperty specific members
        } else {
            // instantiate entity as property
            if (entityType.getAbout() != null) {
                about = new About(entityType.getAbout());
            }
            entity = new Property(about);
        }
        // set property-specific members to the entity
        PropertyType propertyType = ((PropertyType) entityType);
        // set domainRestriction
        if (propertyType.getDomainRestriction() != null) {
            ((Property) entity).setDomainRestriction(getDomainRestriction(propertyType.getDomainRestriction()));
        }
        // set typeCondition
        if (propertyType.getTypeCondition() != null) {
            ((Property) entity).setTypeCondition(propertyType.getTypeCondition());
        }
        // set value conditions
        if (propertyType.getValueCondition() != null) {
            ((Property) entity).setValueCondition(getValueCondition(propertyType.getValueCondition()));
        }
    } else if (entityType instanceof ClassType) {
        // initiates entity as FeatureType
        ClassType cType = (ClassType) entityType;
        if (entityType.getAbout() != null) {
            about = new About(entityType.getAbout());
        }
        entity = new FeatureClass(about);
        // set attribute occurence conditions if exist
        if (cType.getAttributeOccurenceCondition() != null) {
            ((FeatureClass) entity).setAttributeOccurenceCondition(getRestrictions(cType.getAttributeOccurenceCondition()));
        }
        // set attribute type conditions if exist
        if (cType.getAttributeTypeCondition() != null) {
            ((FeatureClass) entity).setAttributeTypeCondition(getRestrictions(cType.getAttributeTypeCondition()));
        }
        // set attribute value conditions if exist
        if (cType.getAttributeValueCondition() != null) {
            ((FeatureClass) entity).setAttributeValueCondition(getRestrictions(cType.getAttributeValueCondition()));
        }
    } else {
        throw new IllegalArgumentException("Illegal entity type given");
    }
    if (entityType.getTransf() != null) {
        // set Transformation to Entity
        Transformation transformation = getTransformation(entityType.getTransf());
        entity.setTransformation(transformation);
    }
    // set About
    About eabout = new About(UUID.randomUUID());
    if (entityType.getAbout() != null) {
        eabout.setAbout(entityType.getAbout());
    }
    entity.setAbout(eabout);
    // set Labels
    if (entityType.getLabel() != null) {
        entity.setLabel(entityType.getLabel());
    }
    return entity;
}
Also used : EntityType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.EntityType) PropertyCompositionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType) Entity(eu.esdihumboldt.hale.io.oml.internal.goml.align.Entity) IEntity(eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity) Transformation(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout) PropertyType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType) ClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassType) ValueClassType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property) FeatureClass(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass) About(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)

Example 3 with Transformation

use of eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation in project hale by halestudio.

the class FeatureClass method deepCopy.

@Override
public IEntity deepCopy() {
    FeatureClass result = new FeatureClass(new About(this.getAbout().getAbout()));
    Transformation t = new Transformation(this.getTransformation().getService());
    List<IParameter> parameters = new ArrayList<IParameter>();
    for (IParameter p : this.getTransformation().getParameters()) {
        parameters.add(new Parameter(p.getName(), p.getValue()));
    }
    t.setParameters(parameters);
    result.setTransformation(t);
    List<String> newLabels = new ArrayList<String>();
    for (String label : this.getLabel()) {
        newLabels.add(label);
    }
    result.setLabel(newLabels);
    return result;
}
Also used : Transformation(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation) IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ArrayList(java.util.ArrayList) IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) Parameter(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Parameter) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout) About(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)

Example 4 with Transformation

use of eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation in project hale by halestudio.

the class Property method deepCopy.

@Override
public IEntity deepCopy() {
    Property result = new Property(new About(this.getAbout().getAbout()));
    Transformation t = new Transformation(this.getTransformation().getService());
    List<IParameter> parameters = new ArrayList<IParameter>();
    for (IParameter p : this.getTransformation().getParameters()) {
        parameters.add(new Parameter(p.getName(), p.getValue()));
    }
    t.setParameters(parameters);
    result.setTransformation(t);
    List<String> newLabels = new ArrayList<String>();
    for (String label : this.getLabel()) {
        newLabels.add(label);
    }
    result.setLabel(newLabels);
    return result;
}
Also used : Transformation(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation) IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ArrayList(java.util.ArrayList) IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) Parameter(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Parameter) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout) DetailedAbout(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.DetailedAbout) About(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)

Aggregations

Transformation (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation)4 About (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)3 IAbout (eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)3 Parameter (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Parameter)2 IParameter (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter)2 ArrayList (java.util.ArrayList)2 Entity (eu.esdihumboldt.hale.io.oml.internal.goml.align.Entity)1 ComposedProperty (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty)1 FeatureClass (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass)1 Property (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)1 DetailedAbout (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.DetailedAbout)1 Resource (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.Resource)1 IEntity (eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity)1 ClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassType)1 EntityType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.EntityType)1 PropertyCompositionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType)1 PropertyType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType)1 ValueClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType)1