Search in sources :

Example 1 with Relation

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

the class OmlRdfGenerator method getEntityType.

/**
 * converts from IEntity to the Jaxb generated EntityType
 *
 * @param entity
 * @return
 */
private JAXBElement<? extends EntityType> getEntityType(IEntity entity) {
    JAXBElement<? extends EntityType> eType = null;
    if (entity != null) {
        if (entity instanceof Property) {
            // instantiate as PropertyType
            Property property = (Property) entity;
            PropertyType pType = getPropertyType(property);
            eType = new JAXBElement<PropertyType>(new QName("http://www.omwg.org/TR/d7/ontology/alignment", "Property"), PropertyType.class, pType);
        } else if (entity instanceof FeatureClass) {
            // instantiate as ClassType
            FeatureClass feature = (FeatureClass) entity;
            ClassType cType = getClassType(feature);
            eType = new JAXBElement<ClassType>(new QName("http://www.omwg.org/TR/d7/ontology/alignment", "Class"), ClassType.class, cType);
        } else if (entity instanceof Relation) {
        // instantiate as RelationType
        // TODO add implementation, for the next release
        } else if (entity instanceof PropertyQualifier) {
        // instantiate as PropertyQualifierType
        // TODO add implementation, will get the examples from MDV
        }
    }
    return eType;
}
Also used : Relation(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Relation) QName(javax.xml.namespace.QName) PropertyType(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.PropertyType) JAXBElement(javax.xml.bind.JAXBElement) 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) PropertyQualifier(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.PropertyQualifier)

Example 2 with Relation

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

the class OmlRdfReader method getOMLRelation.

/**
 * Converts from the JAXB-Based RelationType to the OML Relation
 *
 * @param relation
 * @return
 */
private Relation getOMLRelation(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RelationType relationType) {
    Relation relation = null;
    IAbout about = null;
    List<FeatureClass> features = null;
    if (relationType != null) {
        if (relationType.getAbout() != null) {
            about = new About(relationType.getAbout());
        }
        relation = new Relation(about);
        // set label list
        if (relation.getLabel() != null) {
            relation.setLabel(relationType.getLabel());
        }
        // set transformation
        if (relationType.getTransf() != null) {
            relation.setTransformation(getTransformation(relationType.getTransf()));
        }
        // set Range Restriction
        if (relationType.getRangeRestriction() != null) {
            features = new ArrayList<FeatureClass>();
            features.add(getRangeRestriction(relationType.getRangeRestriction()));
            relation.setRangeRestriction(features);
        }
        // set Domain Restriction
        if (relationType.getDomainRestriction() != null) {
            features = new ArrayList<FeatureClass>();
            features.add(getDomainRestriction(relationType.getDomainRestriction()));
            relation.setDomainRestriction(features);
        }
    }
    return relation;
}
Also used : Relation(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Relation) IAbout(eu.esdihumboldt.hale.io.oml.internal.model.rdf.IAbout) 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 Relation

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

the class OmlRdfReader method getRelation.

/**
 * Implements casting from the JAXB-Type to the OML Type for the Relation
 * element.
 *
 * @param relation jaxb-generated object
 * @return omlRelation
 */
private Relation getRelation(eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.RelationType relation) {
    Relation omlRelation = new Relation(new About(""));
    if (relation != null) {
        // set about
        if (relation.getAbout() != null && !relation.getAbout().equals("")) {
            omlRelation.setAbout(new About(relation.getAbout()));
        }
        // set domain restriction
        if (relation.getDomainRestriction() != null) {
            FeatureClass domainRestriction = getDomainRestriction(relation.getDomainRestriction());
            ArrayList<FeatureClass> domainRestrictions = new ArrayList<FeatureClass>();
            domainRestrictions.add(domainRestriction);
            omlRelation.setDomainRestriction(domainRestrictions);
        }
        // set label
        if (relation.getLabel() != null && relation.getLabel().size() > 0) {
            omlRelation.setLabel(relation.getLabel());
        }
        // set transformation
        if (relation.getTransf() != null) {
            omlRelation.setTransformation(getTransformation(relation.getTransf()));
        }
        // set Range Restriction
        if (relation.getRangeRestriction() != null) {
            FeatureClass omlRangeRestriction = getRangeRestriction(relation.getRangeRestriction());
            List<FeatureClass> omlRangeRestrictions = new ArrayList<FeatureClass>();
            omlRangeRestrictions.add(omlRangeRestriction);
            omlRelation.setRangeRestriction(omlRangeRestrictions);
        }
    }
    return omlRelation;
}
Also used : Relation(eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Relation) ArrayList(java.util.ArrayList) 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)

Aggregations

FeatureClass (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.FeatureClass)3 Relation (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.Relation)3 About (eu.esdihumboldt.hale.io.oml.internal.goml.rdf.About)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 PropertyQualifier (eu.esdihumboldt.hale.io.oml.internal.goml.omwg.PropertyQualifier)1 ClassType (eu.esdihumboldt.hale.io.oml.internal.model.generated.oml.ClassType)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 ArrayList (java.util.ArrayList)1 JAXBElement (javax.xml.bind.JAXBElement)1 QName (javax.xml.namespace.QName)1