use of org.vcell.sybil.models.miriam.RefGroup 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.vcell.sybil.models.miriam.RefGroup in project vcell by virtualcell.
the class VCMetaDataMiriamManager method queryAllMiriamRefGroups.
private Map<MiriamRefGroup, MIRIAMQualifier> queryAllMiriamRefGroups(Identifiable identifiable) {
Entry entry = vcMetaData.getRegistry().getEntry(identifiable);
if (entry.getResource() == null) {
return null;
}
MIRIAMizer miriamizer = new MIRIAMizer();
Map<RefGroup, MIRIAMQualifier> allRefGroups = miriamizer.getAllRefGroups(vcMetaData.getRdfData(), entry.getResource());
Map<MiriamRefGroup, MIRIAMQualifier> wrappedRefGroups = new HashMap<MiriamRefGroup, MIRIAMQualifier>();
for (RefGroup refGroup : allRefGroups.keySet()) {
MiriamRefGroup miriamRefGroup = new VCMetaDataMiriamRefGroup(refGroup);
MIRIAMQualifier miriamQualifier = allRefGroups.get(refGroup);
wrappedRefGroups.put(miriamRefGroup, miriamQualifier);
}
return wrappedRefGroups;
}
use of org.vcell.sybil.models.miriam.RefGroup in project vcell by virtualcell.
the class VCMetaDataMiriamManager method addMiriamRefGroup.
public void addMiriamRefGroup(Identifiable identifiable, MIRIAMQualifier miriamQualifier, Set<MiriamResource> miriamResources) throws URNParseFailureException {
Entry entry = vcMetaData.getRegistry().getEntry(identifiable);
Resource resource = entry.getResource();
if (resource == null) {
String newURIString = vcMetaData.getRegistry().generateFreeURI(identifiable);
resource = entry.setURI(vcMetaData.getRdfData(), newURIString);
}
MIRIAMizer miriamizer = new MIRIAMizer();
RefGroup sybilRefGroup = miriamizer.newRefGroup(vcMetaData.getRdfData(), resource, miriamQualifier);
Set<MIRIAMRef> sybilMiriamRefs = new HashSet<MIRIAMRef>();
for (MiriamResource miriamResource : miriamResources) {
sybilMiriamRefs.add(MIRIAMRef.createFromURN(miriamResource.getMiriamURN()));
}
for (MIRIAMRef sybilMiriamRef : sybilMiriamRefs) {
sybilRefGroup.add(vcMetaData.getRdfData(), sybilMiriamRef);
}
invalidateCache(identifiable);
vcMetaData.fireAnnotationEventListener(new VCMetaData.AnnotationEvent(identifiable));
}
Aggregations