Search in sources :

Example 1 with RDFObjectSets

use of org.vcell.sybil.rdf.pool.RDFObjectSets in project vcell by virtualcell.

the class RDFEvaluator method getProperties.

public <T, T2> RDFObjectSets<T2> getProperties(T subject, RDFObjectPool<T> pool, URI property, RDFObjectPool<T2> pool2) {
    RDFValueSets valueSets = getProperties(subject, pool, property);
    Set<T2> objects = new HashSet<T2>();
    Map<Resource, Set<Resource>> unsupported = new HashMap<Resource, Set<Resource>>();
    for (Resource objectResource : valueSets.getResources()) {
        Set<Resource> types = getProperties(objectResource, RDF.TYPE).getResources();
        try {
            T2 object2 = pool2.getOrCreateObject(objectResource, types);
            objects.add(object2);
        } catch (UnsupportedRDFTypeException e) {
            unsupported.put(objectResource, types);
        }
    }
    return new RDFObjectSets<T2>(valueSets, objects, unsupported);
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) HashMap(java.util.HashMap) UnsupportedRDFTypeException(org.vcell.sybil.rdf.pool.UnsupportedRDFTypeException) RDFValueSets(org.vcell.sybil.rdf.nodestore.RDFValueSets) Resource(org.openrdf.model.Resource) RDFObjectSets(org.vcell.sybil.rdf.pool.RDFObjectSets) HashSet(java.util.HashSet)

Aggregations

HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Resource (org.openrdf.model.Resource)1 RDFValueSets (org.vcell.sybil.rdf.nodestore.RDFValueSets)1 RDFObjectSets (org.vcell.sybil.rdf.pool.RDFObjectSets)1 UnsupportedRDFTypeException (org.vcell.sybil.rdf.pool.UnsupportedRDFTypeException)1