Search in sources :

Example 1 with Identifiable

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

the class ReactionPropertiesPanel method updateAnnotationIconLabel.

private void updateAnnotationIconLabel() {
    Identifiable identifiable = AnnotationsPanel.getIdentifiable(reactionStep);
    String freeText = bioModel.getVCMetaData().getFreeTextAnnotation(identifiable);
    MiriamManager miriamManager = bioModel.getVCMetaData().getMiriamManager();
    TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
    Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
    Icon icon1 = null;
    Icon icon2 = null;
    Icon icon = null;
    if (freeText != null && !freeText.isEmpty()) {
        icon2 = VCellIcons.noteIcon;
    }
    if (refGroupMap != null && !refGroupMap.isEmpty()) {
        icon1 = VCellIcons.linkIcon;
    }
    if (icon1 != null && icon2 != null) {
        icon = VCellIcons.addIcon(icon1, icon2);
    } else if (icon1 == null) {
        // icon2 mai be also null, no prob
        icon = icon2;
    } else if (icon2 == null) {
        icon = icon1;
    }
    annotationIconLabel.setIcon(icon);
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) Icon(javax.swing.Icon) Map(java.util.Map) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Example 2 with Identifiable

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

the class AnnotationsPanel method addIdentifier.

// -------------------------------------------------------------------------------------------------------
private void addIdentifier() {
    if (PopupGenerator.showComponentOKCancelDialog(AnnotationsPanel.this, getJPanelNewIdentifier(), "Define New Formal Identifier") != JOptionPane.OK_OPTION) {
        return;
    }
    MIRIAMQualifier qualifier = (MIRIAMQualifier) getJComboBoxQualifier().getSelectedItem();
    MiriamManager.DataType objectNamespace = (MiriamManager.DataType) getJComboBoxURI().getSelectedItem();
    String objectID = getJTextFieldFormalID().getText();
    if (objectID.compareTo("NewID") == 0) {
        return;
    }
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    HashSet<MiriamResource> miriamResources = new HashSet<MiriamResource>();
    try {
        Identifiable entity = getIdentifiable(selectedObject);
        MiriamResource mr = miriamManager.createMiriamResource(objectNamespace.getBaseURN() + ":" + objectID);
        miriamResources.add(mr);
        miriamManager.addMiriamRefGroup(entity, qualifier, miriamResources);
        // System.out.println(vcMetaData.printRdfStatements());
        updateInterface();
        if (selectedObject instanceof ReactionStep) {
            // we tell ReactionPropertiesPanel to refresh the annotation icon
            ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
        }
    } catch (Exception e) {
        e.printStackTrace();
        DialogUtils.showErrorDialog(this, "Add Identifier failed:\n" + e.getMessage(), e);
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) VCMetaDataMiriamManager(cbit.vcell.biomodel.meta.VCMetaDataMiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) ReactionStep(cbit.vcell.model.ReactionStep) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) VCMetaDataDataType(cbit.vcell.biomodel.meta.VCMetaDataMiriamManager.VCMetaDataDataType) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) HashSet(java.util.HashSet) Identifiable(org.vcell.util.document.Identifiable)

Example 3 with Identifiable

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

the class MIRIAMAnnotationEditor method removeSelectedRefGroups.

public void removeSelectedRefGroups() {
    Object treeNode = jTreeMIRIAM.getLastSelectedPathComponent();
    if (treeNode instanceof IdentifiableNode) {
        Identifiable identifiable = ((IdentifiableNode) treeNode).getIdentifiable();
        Map<MiriamRefGroup, MIRIAMQualifier> refGroupsToRemove = vcMetaData.getMiriamManager().getAllMiriamRefGroups(identifiable);
        for (MiriamRefGroup refGroup : refGroupsToRemove.keySet()) {
            MIRIAMQualifier qualifier = refGroupsToRemove.get(refGroup);
            try {
                vcMetaData.getMiriamManager().remove(identifiable, qualifier, refGroup);
            } catch (URNParseFailureException e) {
                e.printStackTrace(System.out);
            }
        }
    }
}
Also used : IdentifiableNode(cbit.vcell.xml.gui.MiriamTreeModel.IdentifiableNode) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Example 4 with Identifiable

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

the class MIRIAMAnnotationEditor method addCreatorDialog.

public void addCreatorDialog() {
    if (PopupGenerator.showComponentOKCancelDialog(MIRIAMAnnotationEditor.this, getJPanelCreator(), "Define New Creator") == JOptionPane.OK_OPTION) {
        Identifiable identifiable = getSelectedIdentifiable();
        String familyName = getJTextFieldFamily().getText();
        String givenName = getJTextFieldGiven().getText();
        String email = getJTextFieldEmail().getText();
        String organization = getJTextFieldOrganization().getText();
        vcMetaData.getMiriamManager().addCreatorToAnnotation(identifiable, familyName, givenName, email, organization);
    // MIRIAMHelper.addCreatorToAnnotation(
    // getSelectedMIRIAMAnnotatable(),
    // getJTextFieldFamily().getText(),
    // getJTextFieldGiven().getText(),
    // getJTextFieldEmail().getText(),
    // getJTextFieldOrganization().getText());
    // MIRIAMHelper.addDateToAnnotation(
    // getSelectedMIRIAMAnnotatable(),
    // getJTextFieldTimeUTC().getText(),
    // (String)getJComboBoxTimeUTCType().getSelectedItem());
    }
}
Also used : Identifiable(org.vcell.util.document.Identifiable)

Example 5 with Identifiable

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

the class MiriamTreeModel method createTree.

private void createTree() {
    if (!createTree) {
        return;
    }
    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) TreeSet(java.util.TreeSet) Set(java.util.Set) 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) Map(java.util.Map) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Aggregations

Identifiable (org.vcell.util.document.Identifiable)24 MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)12 Map (java.util.Map)11 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)10 TreeMap (java.util.TreeMap)10 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)8 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)6 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)6 VCID (cbit.vcell.biomodel.meta.VCID)5 ReactionStep (cbit.vcell.model.ReactionStep)5 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)5 Registry (cbit.vcell.biomodel.meta.registry.Registry)4 ArrayList (java.util.ArrayList)4 VCMetaDataDataType (cbit.vcell.biomodel.meta.VCMetaDataMiriamManager.VCMetaDataDataType)3 HashMap (java.util.HashMap)3 Icon (javax.swing.Icon)3 Element (org.jdom.Element)3 Resource (org.openrdf.model.Resource)3 DataType (cbit.vcell.biomodel.meta.MiriamManager.DataType)2 VCMetaDataMiriamManager (cbit.vcell.biomodel.meta.VCMetaDataMiriamManager)2