Search in sources :

Example 1 with Property

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property 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 2 with Property

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property 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 3 with Property

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property 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 4 with Property

use of eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property 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)

Example 5 with Property

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

the class GeographicalNameTranslator method getNewParameters.

/**
 * @see eu.esdihumboldt.hale.io.oml.helper.FunctionTranslator#getNewParameters(java.util.List,
 *      eu.esdihumboldt.hale.common.align.io.impl.internal.CellBean,
 *      eu.esdihumboldt.hale.common.core.io.report.IOReporter,
 *      eu.esdihumboldt.hale.io.oml.internal.model.align.ICell)
 */
@Override
public List<ParameterValueBean> getNewParameters(List<ParameterValueBean> params, CellBean cellBean, IOReporter reporter, ICell cell) {
    // create the new parameter list
    List<ParameterValueBean> newParams = new ArrayList<ParameterValueBean>();
    IEntity source = cell.getEntity1();
    if (source instanceof ComposedProperty) {
        ComposedProperty cp = (ComposedProperty) source;
        // usually the composed property should only have one element in the
        // collection
        Property coll = cp.getCollection().get(0);
        // that should be a composed property too
        if (coll instanceof ComposedProperty) {
            ComposedProperty comProp = (ComposedProperty) coll;
            // parameters defined by the parameter page
            List<IParameter> pageParams = comProp.getTransformation().getParameters();
            // add each parameter defined by the parameter page
            for (IParameter p : pageParams) {
                newParams.add(new ParameterValueBean(p.getName(), p.getValue()));
            }
            // the collection of the collection contains the parameters
            // defined for the spellings
            List<Property> props = comProp.getCollection();
            for (Property prop : props) {
                // each property has a list of 3 parameters (text, script,
                // transliterationScheme)
                List<IParameter> spellingParams = prop.getTransformation().getParameters();
                for (IParameter p : spellingParams) {
                    newParams.add(new ParameterValueBean(p.getName(), p.getValue()));
                }
            }
        }
    }
    return newParams;
}
Also used : IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) IEntity(eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) ParameterValueBean(eu.esdihumboldt.hale.common.align.io.impl.internal.ParameterValueBean) ArrayList(java.util.ArrayList) ComposedProperty(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty) Property(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)

Aggregations

ComposedProperty (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty)8 Property (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)8 FeatureClass (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass)3 PropertyType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType)3 About (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)2 IEntity (eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity)2 ClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassType)2 Item (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCollectionType.Item)2 PropertyCompositionType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyCompositionType)2 ValueClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ValueClassType)2 IAbout (eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)2 ArrayList (java.util.ArrayList)2 QName (javax.xml.namespace.QName)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