Search in sources :

Example 11 with Identifiable

use of org.vcell.util.document.Identifiable in project vcell by virtualcell.

the class MIRIAMAnnotationViewer method printResourceMappings.

public static String printResourceMappings(VCMetaData metaData) {
    StringBuffer strBuffer = new StringBuffer();
    strBuffer.append("\n\n ResourceMappings : \n");
    Set<Registry.Entry> entrySet = metaData.getRegistry().getAllEntries();
    for (Registry.Entry entry : entrySet) {
        Resource resource = entry.getResource();
        if (resource != null) {
            strBuffer.append(resource.stringValue());
            Identifiable identifiable = entry.getIdentifiable();
            strBuffer.append(" ============= " + metaData.getIdentifiableProvider().getVCID(identifiable).toASCIIString());
            strBuffer.append("\n");
        }
    }
    return strBuffer.toString();
}
Also used : Resource(org.openrdf.model.Resource) Registry(cbit.vcell.biomodel.meta.registry.Registry) Identifiable(org.vcell.util.document.Identifiable)

Example 12 with Identifiable

use of org.vcell.util.document.Identifiable in project vcell by virtualcell.

the class MiriamTreeModel method annotationChanged.

public void annotationChanged(AnnotationEvent annotationEvent) {
    Identifiable identifiable = annotationEvent.getIdentifiable();
    // if identifiable is not null, then we can repair just the subtree for that identifiable
    createTree();
    fireTreeStructureChanged(this, getPathToRoot(((DefaultMutableTreeNode) getRoot())), null, null);
}
Also used : Identifiable(org.vcell.util.document.Identifiable)

Example 13 with Identifiable

use of org.vcell.util.document.Identifiable in project vcell by virtualcell.

the class VCMetaDataMiriamManager method getDublinCoreDateMap.

// this is not yet cached.
public Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> getDublinCoreDateMap() {
    Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> map = new HashMap<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>>();
    Set<Entry> allEntries = vcMetaData.getRegistry().getAllEntries();
    Graph rdfData = vcMetaData.getRdfData();
    for (Entry entry : allEntries) {
        Resource resource = entry.getResource();
        if (resource != null) {
            Identifiable identifiable = entry.getIdentifiable();
            Map<DateQualifier, Set<DublinCoreDate>> qualifierDateMap = new HashMap<DateQualifier, Set<DublinCoreDate>>();
            for (DublinCoreQualifier.DateQualifier dateQualifier : AnnotationQualifiers.DC_date_all) {
                Set<DublinCoreDate> dateStrings = new HashSet<DublinCoreDate>();
                Iterator<Statement> stmtIter = rdfData.match(resource, dateQualifier.getProperty(), null);
                while (stmtIter.hasNext()) {
                    Statement statement = stmtIter.next();
                    Value dateObject = statement.getObject();
                    if (dateObject instanceof Literal) {
                        Literal dateLiteral = (Literal) dateObject;
                        String dateString = dateLiteral.stringValue();
                        dateStrings.add(new DublinCoreDate(dateString));
                    }
                }
                if (!dateStrings.isEmpty()) {
                    qualifierDateMap.put(dateQualifier, dateStrings);
                }
            }
            if (!qualifierDateMap.isEmpty()) {
                map.put(identifiable, qualifierDateMap);
            }
        }
    }
    return map;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate) HashMap(java.util.HashMap) Statement(org.openrdf.model.Statement) Resource(org.openrdf.model.Resource) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) Identifiable(org.vcell.util.document.Identifiable) Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) Graph(org.openrdf.model.Graph) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) DublinCoreQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier) Literal(org.openrdf.model.Literal) Value(org.openrdf.model.Value) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap) HashSet(java.util.HashSet)

Example 14 with Identifiable

use of org.vcell.util.document.Identifiable in project vcell by virtualcell.

the class AnnotationMapping method getRefInfo.

private HashMap<String, String> getRefInfo(BioModel bioModel, Identifiable identifiable) {
    HashMap<String, String> info = new HashMap<String, String>();
    VCMetaData vcMetaData = bioModel.getVCMetaData();
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
    Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
    if (refGroupMap != null) {
        for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
            MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
            String[] quaTemp = qualifier.toString().split("/");
            String bioQualifier = quaTemp[quaTemp.length - 1];
            bioQualifier = bioQualifier.substring(0, bioQualifier.length() - 1);
            for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
                String refSource = miriamResource.getMiriamURN();
                String[] temp = refSource.split(":");
                String sourceInfo = temp[2] + ":" + bioQualifier;
                String refId = miriamResource.getIdentifier();
                info.put(refId, sourceInfo);
            // System.out.println(refId + "*********" + sourceInfo);
            }
        }
    }
    return info;
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) HashMap(java.util.HashMap) Identifiable(org.vcell.util.document.Identifiable) VCMetaData(cbit.vcell.biomodel.meta.VCMetaData) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)

Aggregations

Identifiable (org.vcell.util.document.Identifiable)14 Map (java.util.Map)7 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)6 TreeMap (java.util.TreeMap)6 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)6 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)5 VCID (cbit.vcell.biomodel.meta.VCID)4 Registry (cbit.vcell.biomodel.meta.registry.Registry)3 HashMap (java.util.HashMap)3 Element (org.jdom.Element)3 Resource (org.openrdf.model.Resource)3 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)2 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)2 HashSet (java.util.HashSet)2 IdentityHashMap (java.util.IdentityHashMap)2 Set (java.util.Set)2 DublinCoreDate (org.vcell.sybil.models.dublincore.DublinCoreDate)2 DublinCoreQualifier (org.vcell.sybil.models.dublincore.DublinCoreQualifier)2 DateQualifier (org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier)2 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)2