All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.monnetproject.lemon.oils.impl.MultivariateRelationshipImpl Maven / Gradle / Ivy

package eu.monnetproject.lemon.oils.impl;

import eu.monnetproject.lemon.oils.MultivariateRelationship;
import eu.monnetproject.ontology.AnnotationValue;
import eu.monnetproject.ontology.Class;
import eu.monnetproject.ontology.Individual;
import eu.monnetproject.ontology.OntologyFactory;
import eu.monnetproject.ontology.Property;
import java.net.URI;
import java.util.Collection;
import java.util.HashSet;

/**
 *
 * @author John McCrae
 */
public class MultivariateRelationshipImpl implements MultivariateRelationship {
    private final Class clazz;

    public MultivariateRelationshipImpl(Class clazz) {
        this.clazz = clazz;
    }
    
    
    public Collection getRoles() {
        OntologyFactory factory = clazz.getOntology().getFactory();
        final Collection annotationValues = 
                clazz.getAnnotationValues(factory.makeAnnotationProperty(URI.create(LemonOilsImpl.LEMON_OILS+"role")));
        HashSet rval = new HashSet();
        for(AnnotationValue av : annotationValues) {
            if(av instanceof Individual) {
                rval.add(factory.makeObjectProperty(((Individual)av).getURI()));
            }
        }
        return rval;
    }

    public Class asClass() {
        return clazz;
    }
    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy