Search in sources :

Example 1 with IParameter

use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.

the class OmlRdfReader method getParameters.

private List<IParameter> getParameters(List<ParamType> param) {
    List<IParameter> params = new ArrayList<IParameter>(param.size());
    Iterator<ParamType> iterator = param.iterator();
    ParamType paramType;
    IParameter parameter;
    while (iterator.hasNext()) {
        paramType = iterator.next();
        List<String> values = paramType.getValue();
        String value;
        if (values != null && !values.isEmpty()) {
            value = values.get(0);
        } else {
            // TODO what should be the default empty value?
            value = null;
        // null or empty string?
        }
        parameter = new Parameter(paramType.getName(), value);
        params.add(parameter);
    }
    return params;
}
Also used : IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ArrayList(java.util.ArrayList) Parameter(eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Parameter) IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ParamType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ParamType)

Example 2 with IParameter

use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.

the class OmlReader method setParameters.

private void setParameters(CellBean cellBean, IEntity entity, IOReporter reporter, ICell cell) {
    String transId = entity.getTransformation().getService().getLocation();
    // get the list of parameters
    List<IParameter> list = entity.getTransformation().getParameters();
    // create a list of ParameterValue (because
    // setTransformationParameters needs a list)
    List<ParameterValueBean> params = new ArrayList<ParameterValueBean>();
    for (int i = 0; i < list.size(); i++) {
        String name = list.get(i).getName();
        String value = list.get(i).getValue();
        // create the ParameterValue for the CellBean
        ParameterValueBean paramVal = new ParameterValueBean(name, value);
        // add the ParameterValue
        params.add(paramVal);
    }
    // set the new transformation parameters
    if (map.containsKey(transId)) {
        cellBean.setTransformationParameters(map.get(transId).getNewParameters(params, cellBean, reporter, cell));
    } else {
        cellBean.setTransformationParameters(params);
    }
}
Also used : IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ParameterValueBean(eu.esdihumboldt.hale.common.align.io.impl.internal.ParameterValueBean) ArrayList(java.util.ArrayList)

Example 3 with IParameter

use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter 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)

Example 4 with IParameter

use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter in project hale by halestudio.

the class OmlRdfGenerator method getParameters.

/**
 * Converts from List of OML IParameter to the collecion of the JAXB
 * ParameterType
 *
 * @param parameters
 * @return
 */
private Collection<? extends ParamType> getParameters(List<IParameter> parameters) {
    if (parameters != null) {
        ArrayList<ParamType> pTypes = new ArrayList<ParamType>(parameters.size());
        ParamType pType;
        IParameter param;
        Iterator<?> iterator = parameters.iterator();
        while (iterator.hasNext()) {
            param = (IParameter) iterator.next();
            pType = getParameterType(param);
            pTypes.add(pType);
        }
        return pTypes;
    }
    return new ArrayList<ParamType>();
}
Also used : IParameter(eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter) ArrayList(java.util.ArrayList) ParamType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ParamType)

Example 5 with IParameter

use of eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter 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)

Aggregations

IParameter (eu.esdihumboldt.hale.io.oml.internal.model.align.ext.IParameter)6 ArrayList (java.util.ArrayList)6 Parameter (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Parameter)3 ParameterValueBean (eu.esdihumboldt.hale.common.align.io.impl.internal.ParameterValueBean)2 Transformation (eu.esdihumboldt.hale.io.oml.internal.goml.oml.ext.Transformation)2 About (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)2 ParamType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ParamType)2 IAbout (eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout)2 ComposedProperty (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.ComposedProperty)1 Property (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Property)1 DetailedAbout (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.DetailedAbout)1 IEntity (eu.esdihumboldt.hale.io.oml.internal.model.align.IEntity)1