Search in sources :

Example 31 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class OntologyInfo method sortResources.

public static void sortResources(List<Resource> resources, Filter filter) {
    for (int iLast = resources.size() - 2; iLast >= 0; --iLast) {
        for (int i = 0; i <= iLast; ++i) {
            Resource r1 = resources.get(i);
            Resource r2 = resources.get(i + 1);
            if (filter.compare(r1, r2) > 0) {
                resources.set(i, r2);
                resources.set(i + 1, r1);
            }
        }
    }
}
Also used : Resource(org.openrdf.model.Resource)

Example 32 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class OntUtil method makeAllDisjoint.

public static void makeAllDisjoint(Graph model, Resource... classes) {
    for (Resource class1 : classes) {
        for (Resource class2 : classes) {
            if (!class1.equals(class2)) {
                model.add(class1, OWL.DISJOINTWITH, class2);
                model.add(class2, OWL.DISJOINTWITH, class1);
            }
        }
    }
}
Also used : Resource(org.openrdf.model.Resource)

Example 33 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class OntUtil method makeDisjointSubClasses.

public static void makeDisjointSubClasses(Graph model, Resource base, Collection<? extends Resource> subClasses) {
    for (Resource subClass1 : subClasses) {
        model.add(subClass1, RDFS.SUBCLASSOF, base);
        for (Resource subClass2 : subClasses) {
            if (!subClass1.equals(subClass2)) {
                model.add(subClass1, OWL.DISJOINTWITH, subClass2);
                model.add(subClass2, OWL.DISJOINTWITH, subClass1);
            }
        }
    }
}
Also used : Resource(org.openrdf.model.Resource)

Example 34 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class VCMetaDataMiriamManager method remove.

public void remove(Identifiable identifiable, MIRIAMQualifier miriamQualifier, MiriamRefGroup miriamRefGroup) throws URNParseFailureException {
    Entry openEntry = vcMetaData.getRegistry().getEntry(identifiable);
    Resource resource = openEntry.getResource();
    MIRIAMizer miriamizer = new MIRIAMizer();
    RefGroup sybilRefGroup = miriamizer.newRefGroup(vcMetaData.getRdfData(), resource, miriamQualifier);
    Set<MIRIAMRef> sybilMiriamRefs = new HashSet<MIRIAMRef>();
    Set<MiriamResource> miriamResources = miriamRefGroup.getMiriamRefs();
    for (MiriamResource miriamResource : miriamResources) {
        sybilMiriamRefs.add(MIRIAMRef.createFromURN(miriamResource.getMiriamURN()));
    }
    for (MIRIAMRef sybilMiriamRef : sybilMiriamRefs) {
        sybilRefGroup.add(vcMetaData.getRdfData(), sybilMiriamRef);
    }
    miriamizer.deleteRefGroup(vcMetaData.getRdfData(), resource, sybilRefGroup);
    invalidateCache(identifiable);
    vcMetaData.fireAnnotationEventListener(new VCMetaData.AnnotationEvent(identifiable));
}
Also used : MIRIAMRef(org.vcell.sybil.models.miriam.MIRIAMRef) Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) MIRIAMizer(org.vcell.sybil.models.miriam.MIRIAMizer) Resource(org.openrdf.model.Resource) RefGroup(org.vcell.sybil.models.miriam.RefGroup) HashSet(java.util.HashSet)

Example 35 with Resource

use of org.openrdf.model.Resource in project vcell by virtualcell.

the class VCMetaDataMiriamManager method removeStoredCrossReferencedLink.

public void removeStoredCrossReferencedLink(MiriamResource miriamResource, URL url) {
    ValueFactory valueFactory = vcMetaData.getRdfData().getValueFactory();
    Resource resource = valueFactory.createURI(miriamResource.getMiriamURN());
    Iterator<Statement> iter = vcMetaData.getRdfData().match(resource, MIRIAM.BioProperties.isDescribedBy, valueFactory.createLiteral(url.toString()));
    while (iter.hasNext()) {
        iter.next();
        iter.remove();
    }
}
Also used : Statement(org.openrdf.model.Statement) Resource(org.openrdf.model.Resource) ValueFactory(org.openrdf.model.ValueFactory)

Aggregations

Resource (org.openrdf.model.Resource)60 Statement (org.openrdf.model.Statement)22 URI (org.openrdf.model.URI)20 Value (org.openrdf.model.Value)17 HashSet (java.util.HashSet)14 Graph (org.openrdf.model.Graph)7 Literal (org.openrdf.model.Literal)6 SailConnection (org.openrdf.sail.SailConnection)5 SailException (org.openrdf.sail.SailException)5 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)4 NotifyingSailConnection (org.openrdf.sail.NotifyingSailConnection)4 Map (java.util.Map)3 Set (java.util.Set)3 Element (org.jdom.Element)3 HashGraph (org.sbpax.impl.HashGraph)3 VCID (cbit.vcell.biomodel.meta.VCID)2 Registry (cbit.vcell.biomodel.meta.registry.Registry)2 Edge (com.tinkerpop.blueprints.Edge)2