Search in sources :

Example 1 with DublinCoreDate

use of org.vcell.sybil.models.dublincore.DublinCoreDate in project vcell by virtualcell.

the class MiriamTreeModel method createTree.

private void createTree() {
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
    Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> dateMapMap = miriamManager.getDublinCoreDateMap();
    Set<Identifiable> identifiables = vcMetaData.getIdentifiableProvider().getAllIdentifiables();
    TreeSet<Identifiable> sortedIdentifiables = new TreeSet<Identifiable>(new IdentifiableComparator(vcMetaData.getIdentifiableProvider()));
    sortedIdentifiables.addAll(identifiables);
    ((DefaultMutableTreeNode) getRoot()).removeAllChildren();
    for (Identifiable identifiable : sortedIdentifiables) {
        Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
        Map<DateQualifier, Set<DublinCoreDate>> dateMap = dateMapMap.get(identifiable);
        VCID vcid = vcMetaData.getIdentifiableProvider().getVCID(identifiable);
        String modelComponentType = vcid.getClassName();
        String modelComponentName = vcid.getLocalName();
        IdentifiableNode modelComponentNode = new IdentifiableNode(identifiable, modelComponentType + " : " + modelComponentName);
        String freeTextAnnotation = vcMetaData.getFreeTextAnnotation(identifiable);
        if (freeTextAnnotation != null) {
            modelComponentNode.add(new BioModelNode(new Annotation(freeTextAnnotation), false));
        } else {
            modelComponentNode.add(new BioModelNode(new Annotation(""), false));
        }
        if (refGroupMap != null) {
            for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
                MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
                for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
                    LinkNode linkNode = new LinkNode(qualifier, miriamResource);
                    modelComponentNode.add(linkNode);
                }
            }
        }
        if (dateMap != null) {
            for (DublinCoreQualifier.DateQualifier qualifier : dateMap.keySet()) {
                Set<DublinCoreDate> dates = dateMap.get(qualifier);
                for (DublinCoreDate date : dates) {
                    modelComponentNode.add(new DateNode(qualifier, date));
                }
            }
        }
        ((DefaultMutableTreeNode) getRoot()).add(modelComponentNode);
    }
}
Also used : IdentifiableComparator(cbit.vcell.biomodel.meta.IdentifiableComparator) MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) Set(java.util.Set) TreeSet(java.util.TreeSet) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BioModelNode(cbit.vcell.desktop.BioModelNode) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) TreeSet(java.util.TreeSet) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) VCID(cbit.vcell.biomodel.meta.VCID) DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate) Annotation(cbit.vcell.desktop.Annotation) Identifiable(org.vcell.util.document.Identifiable) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) DublinCoreQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier) TreeMap(java.util.TreeMap) Map(java.util.Map) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Example 2 with DublinCoreDate

use of org.vcell.sybil.models.dublincore.DublinCoreDate in project vcell by virtualcell.

the class MIRIAMAnnotationEditor method addTimeUTCDialog.

// public void addFreeTextDialog() {
// Identifiable identifiable = getSelectedIdentifiable();
// if (identifiable==null){
// DialogUtils.showErrorDialog(this, "no component selected for annotation");
// return;
// }
// String freeTextAnnotation = vcMetaData.getFreeTextAnnotation(identifiable);
// if (freeTextAnnotation==null){
// freeTextAnnotation = "";
// }
// try {
// freeTextAnnotation = DialogUtils.showInputDialog0(this, "annotation with free text", freeTextAnnotation);
// vcMetaData.setFreeTextAnnotation(identifiable, freeTextAnnotation);
// } catch (UtilCancelException e1) {
// e1.printStackTrace();
// }
// }
public void addTimeUTCDialog() {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
    getJTextFieldTimeUTC().setText(sdf.format(new Date()));
    if (PopupGenerator.showComponentOKCancelDialog(MIRIAMAnnotationEditor.this, getJPanelTimeUTC(), "Define New Date") == JOptionPane.OK_OPTION) {
        String dateString = getJTextFieldTimeUTC().getText();
        vcMetaData.getMiriamManager().addDate(getSelectedIdentifiable(), (DublinCoreQualifier.DateQualifier) getJComboBoxTimeUTCType().getSelectedItem(), new DublinCoreDate(dateString));
    // String qualifierName = (String)jComboBoxQualifier.getSelectedItem();
    // URI qualifierURI = null;
    // if(qualifierName.endsWith("(bio)")){
    // qualifierURI = new URI(XMLTags.BMBIOQUAL_NAMESPACE_URI);
    // }else if(qualifierName.endsWith("(model)")){
    // qualifierURI = new URI(XMLTags.BMMODELQUAL_NAMESPACE_URI);
    // }
    // qualifierName = qualifierName.substring(0,qualifierName.indexOf(" ("));
    // Element newID =
    // MIRIAMHelper.createRDFIdentifier((String)jComboBoxURI.getSelectedItem(), jTextFieldFormalID.getText());
    // MIRIAMHelper.addIdentifierToAnnotation(
    // newID,
    // getSelectedMIRIAMAnnotatable().getMIRIAMAnnotation(),
    // qualifierName,
    // qualifierURI);
    }
}
Also used : DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate) DublinCoreQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate)

Example 3 with DublinCoreDate

use of org.vcell.sybil.models.dublincore.DublinCoreDate 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)

Aggregations

DublinCoreDate (org.vcell.sybil.models.dublincore.DublinCoreDate)3 DublinCoreQualifier (org.vcell.sybil.models.dublincore.DublinCoreQualifier)3 Map (java.util.Map)2 Set (java.util.Set)2 TreeMap (java.util.TreeMap)2 DateQualifier (org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier)2 Identifiable (org.vcell.util.document.Identifiable)2 IdentifiableComparator (cbit.vcell.biomodel.meta.IdentifiableComparator)1 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)1 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)1 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)1 VCID (cbit.vcell.biomodel.meta.VCID)1 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)1 Annotation (cbit.vcell.desktop.Annotation)1 BioModelNode (cbit.vcell.desktop.BioModelNode)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 TreeSet (java.util.TreeSet)1