Search in sources :

Example 1 with RefGroup

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));
}
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 2 with RefGroup

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;
}
Also used : Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) HashMap(java.util.HashMap) MIRIAMizer(org.vcell.sybil.models.miriam.MIRIAMizer) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) RefGroup(org.vcell.sybil.models.miriam.RefGroup)

Example 3 with RefGroup

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

Aggregations

Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)3 MIRIAMizer (org.vcell.sybil.models.miriam.MIRIAMizer)3 RefGroup (org.vcell.sybil.models.miriam.RefGroup)3 HashSet (java.util.HashSet)2 Resource (org.openrdf.model.Resource)2 MIRIAMRef (org.vcell.sybil.models.miriam.MIRIAMRef)2 HashMap (java.util.HashMap)1 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)1