Search in sources :

Example 1 with ComposedProperty

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty in project hale by halestudio.

the class OmlRdfGenerator method getPropertyType.

/**
 * Converts from OML Property to the JAXB PropertyType
 *
 * @param property
 * @return
 */
private PropertyType getPropertyType(Property property) {
    PropertyType pType = new PropertyType();
    if (property != null) {
        IAbout about = property.getAbout();
        if (about != null)
            pType.setAbout(about.getAbout());
        if (property instanceof ComposedProperty) /* && this.propertyStack < propertyStackSize */
        {
            // this.propertyStack++;
            // in case it is a composed property add the property
            // composition
            // element
            PropertyCompositionType propCompType = new PropertyCompositionType();
            // set Relation
            propCompType.setRelation(getRelation(((ComposedProperty) property).getRelation()));
            // set property collection or single property
            if (((ComposedProperty) property).getCollection().size() > 1) {
                // set collection
                propCompType.setCollection(getPropertyCollection(((ComposedProperty) property).getCollection()));
            } else if (((ComposedProperty) property).getCollection().size() == 1) {
                // set single property
                propCompType.setProperty(getPropertyType(((ComposedProperty) property).getCollection().get(0)));
            }
            // set PropertyOperatorType
            propCompType.setOperator(getOperatorType(((ComposedProperty) property).getPropertyOperatorType()));
            pType.setPropertyComposition(propCompType);
        }
        if (property.getTransformation() != null) {
            pType.setTransf(getTransf(property.getTransformation()));
        }
        if (property.getDomainRestriction() != null) {
            pType.getDomainRestriction().addAll(getDomainRestrictionTypes(property.getDomainRestriction()));
        }
        if (property.getTypeCondition() != null) {
            pType.getTypeCondition().addAll(property.getTypeCondition());
        }
        if (property.getLabel() != null) {
            pType.getLabel().addAll(property.getLabel());
        }
        if (property.getValueCondition() != null) {
            pType.getValueCondition().addAll(getValueConditions(property.getValueCondition()));
        }
    }
    return pType;
}
Also used : PropertyCompositionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType) 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)

Example 2 with ComposedProperty

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty in project hale by halestudio.

the class OmlRdfGenerator method getPropertyCollection.

/**
 * Translate the list of the OML Properties To the Jaxb-based
 * PropertyCollectionType
 *
 * @param collection
 * @return
 */
private PropertyCollectionType getPropertyCollection(List<Property> collection) {
    PropertyCollectionType propCollectionType = new PropertyCollectionType();
    if (collection != null) {
        Iterator<?> iterator = collection.iterator();
        while (iterator.hasNext()) {
            // get property from a list
            Property property = (Property) iterator.next();
            // convert property to the property type
            // TODO could be the circular dependencies in case of
            // ComposedProperty
            PropertyType pType = getPropertyType(property);
            // add to the collection
            Item item = new Item();
            item.setProperty(pType);
            propCollectionType.getItem().add(item);
        }
    }
    return propCollectionType;
}
Also used : Item(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCollectionType.Item) PropertyCollectionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCollectionType) PropertyType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)

Example 3 with ComposedProperty

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty in project hale by halestudio.

the class OmlRdfReader method getProperty.

/**
 * Implements casting from the JAXB-Type to the OML Type for the Property
 * element.
 *
 * @param property jaxb-generated object
 * @return omlProperty
 */
private Property getProperty(PropertyType property) {
    Property omlProperty;
    // make decision: simple property or composed property
    if (property.getPropertyComposition() != null) {
        PropertyCompositionType pcType = property.getPropertyComposition();
        // initialize as composed property
        omlProperty = new ComposedProperty(getOperator(pcType.getOperator()), new About(""));
        // set collection of properties and/or relation
        if (pcType.getCollection() != null && pcType.getCollection().getItem() != null) {
            // set collection
            ((ComposedProperty) omlProperty).setCollection(getPropertyCollection(pcType.getCollection()));
        } else if (pcType.getProperty() != null) {
            // set a single property
            ((ComposedProperty) omlProperty).getCollection().add(getProperty(pcType.getProperty()));
        }
        if (pcType.getRelation() != null) {
            // set relation
            ((ComposedProperty) omlProperty).setRelation(getRelation(pcType.getRelation()));
        }
    } else {
        // initialize as property
        omlProperty = new Property(new About(""));
    }
    // set About
    if (property.getAbout() != null && !property.getAbout().equals("")) {
        omlProperty.setAbout(new About(property.getAbout()));
    }
    // set domain restriction
    if (property.getDomainRestriction() != null) {
        omlProperty.setDomainRestriction(getDomainRestriction(property.getDomainRestriction()));
    }
    // set label
    if (property.getLabel() != null) {
        omlProperty.setLabel(property.getLabel());
    }
    // set transformation
    if (property.getTransf() != null) {
        omlProperty.setTransformation(getTransformation(property.getTransf()));
    }
    // set type condition
    if (property.getTypeCondition() != null) {
        omlProperty.setTypeCondition(property.getTypeCondition());
    }
    // set value condition
    if (property.getValueCondition() != null) {
        omlProperty.setValueCondition(getValueCondition(property.getValueCondition()));
    }
    return omlProperty;
}
Also used : PropertyCompositionType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property) About(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)

Example 4 with ComposedProperty

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty in project hale by halestudio.

the class EntityHelper method getShortName.

/**
 * Get a short name for the given entity
 *
 * @param entity the entity
 * @return the short name
 */
public static String getShortName(IEntity entity) {
    if (entity.equals(Entity.NULL_ENTITY)) {
        // $NON-NLS-1$
        return "None";
    }
    if (entity instanceof ComposedProperty) {
        ComposedProperty cp = (ComposedProperty) entity;
        Iterator<Property> it = cp.getCollection().iterator();
        StringBuffer result = new StringBuffer();
        while (it.hasNext()) {
            result.append(getShortName(it.next()));
            if (it.hasNext()) {
                // $NON-NLS-1$
                result.append(" & ");
            }
        }
        return result.toString();
    }
    if (entity.getAbout() != null && entity.getAbout().getAbout() != null) {
        String label = entity.getAbout().getAbout();
        // $NON-NLS-1$
        String[] nameparts = label.split("\\/");
        if (entity instanceof Property && nameparts.length >= 2) {
            // $NON-NLS-1$
            return nameparts[nameparts.length - 2] + "." + nameparts[nameparts.length - 1];
        } else {
            return nameparts[nameparts.length - 1];
        }
    }
    // $NON-NLS-1$
    return "unnamed";
}
Also used : ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)

Example 5 with ComposedProperty

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty in project hale by halestudio.

the class OmlReader method setBeanLists.

private void setBeanLists(IEntity entity, List<NamedEntityBean> list, TypeIndex schema) {
    if (entity.getAbout().getAbout().equals(Entity.NULL_ENTITY.getAbout().getAbout())) {
        return;
    }
    if (entity instanceof ComposedFeatureClass) {
        ComposedFeatureClass cfc = (ComposedFeatureClass) entity;
        List<FeatureClass> coll = cfc.getCollection();
        for (FeatureClass fc : coll) {
            setBeanLists(fc, list, schema);
        }
    } else if (entity instanceof ComposedProperty) {
        ComposedProperty cp = (ComposedProperty) entity;
        List<Property> coll = cp.getCollection();
        for (Property prop : coll) {
            setBeanLists(prop, list, schema);
        }
    } else if (entity instanceof FeatureClass) {
        // get the detailed about-information
        IDetailedAbout about = DetailedAbout.getDetailedAbout(entity.getAbout(), false);
        TypeBean typeBean = new TypeBean();
        setTypeNameBean(typeBean, about, schema);
        NamedEntityBean namedEntityBean = new NamedEntityBean();
        namedEntityBean.setEntity(typeBean);
        namedEntityBean.setName(null);
        list.add(namedEntityBean);
    } else if (entity instanceof Property) {
        // get the detailed about-information
        IDetailedAbout about = DetailedAbout.getDetailedAbout(entity.getAbout(), true);
        PropertyBean prop = new PropertyBean();
        List<ChildContextBean> childList = new ArrayList<ChildContextBean>();
        List<String> props = about.getProperties();
        for (String property : props) {
            ChildContextBean ccb = new ChildContextBean();
            ccb.setChildName(new QName(property));
            childList.add(ccb);
        }
        setTypeNameBean(prop, about, schema);
        prop.setProperties(childList);
        NamedEntityBean namedEntityBean = new NamedEntityBean();
        namedEntityBean.setEntity(prop);
        namedEntityBean.setName(null);
        list.add(namedEntityBean);
    }
}
Also used : QName(javax.xml.namespace.QName) TypeBean(eu.esdihumboldt.hale.common.align.io.impl.internal.TypeBean) ComposedFeatureClass(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedFeatureClass) ComposedFeatureClass(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedFeatureClass) FeatureClass(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass) ChildContextBean(eu.esdihumboldt.hale.common.align.io.impl.internal.ChildContextBean) NamedEntityBean(eu.esdihumboldt.hale.common.align.io.impl.internal.NamedEntityBean) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) IDetailedAbout(eu.esdihumboldt.hale.io.oml.internal.goml.rdf.IDetailedAbout) List(java.util.List) ArrayList(java.util.ArrayList) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property) PropertyBean(eu.esdihumboldt.hale.common.align.io.impl.internal.PropertyBean)

Aggregations

ComposedProperty (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty)7 Property (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)6 PropertyCompositionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType)3 PropertyType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType)3 IAbout (eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)3 FeatureClass (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass)2 About (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)2 IEntity (eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity)2 ArrayList (java.util.ArrayList)2 ChildContextBean (eu.esdihumboldt.hale.common.align.io.impl.internal.ChildContextBean)1 NamedEntityBean (eu.esdihumboldt.hale.common.align.io.impl.internal.NamedEntityBean)1 ParameterValueBean (eu.esdihumboldt.hale.common.align.io.impl.internal.ParameterValueBean)1 PropertyBean (eu.esdihumboldt.hale.common.align.io.impl.internal.PropertyBean)1 TypeBean (eu.esdihumboldt.hale.common.align.io.impl.internal.TypeBean)1 Entity (eu.esdihumboldt.hale.io.oml.internal.goml.align.Entity)1 Transformation (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation)1 ComposedFeatureClass (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedFeatureClass)1 IDetailedAbout (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.IDetailedAbout)1 IParameter (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter)1 ClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassType)1