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);
}
}
}
}
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);
}
}
}
}
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);
}
}
}
}
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));
}
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();
}
}
Aggregations