Search in sources :

Example 1 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier in project vcell by virtualcell.

the class SpeciesPropertiesPanel method updatePCLink.

private void updatePCLink() {
    try {
        StringBuffer buffer = new StringBuffer("<html>");
        MiriamManager miriamManager = bioModel.getModel().getVcMetaData().getMiriamManager();
        Map<MiriamRefGroup, MIRIAMQualifier> refGroups = miriamManager.getAllMiriamRefGroups(getSpeciesContext().getSpecies());
        if (refGroups != null && refGroups.size() > 0) {
            for (MiriamRefGroup refGroup : refGroups.keySet()) {
                Set<MiriamResource> miriamResources = refGroup.getMiriamRefs();
                for (MiriamResource resource : miriamResources) {
                    String urn = resource.getMiriamURN();
                    String preferredName = "";
                    if (urn != null && urn.length() > 0) {
                        String prettyName = miriamManager.getPrettyName(resource);
                        if (prettyName != null) {
                            preferredName = "[" + prettyName + "]";
                        }
                        String prettyResourceName = urn.replaceFirst("urn:miriam:", "");
                        buffer.append("&#x95;&nbsp;" + prettyResourceName + "&nbsp;<b>" + preferredName + "</b><br>");
                        List<URL> linkURLs = miriamManager.getStoredCrossReferencedLinks(resource);
                        for (URL url : linkURLs) {
                            buffer.append("&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<a href=\"" + url.toString() + "\">" + url.toString() + "</a><br>");
                        }
                    }
                }
            }
        }
        buffer.append("</html>");
        getPCLinkValueEditorPane().setText(buffer.toString());
        getPCLinkValueEditorPane().setCaretPosition(0);
    } catch (Exception ex) {
        ex.printStackTrace(System.out);
        DialogUtils.showErrorDialog(this, ex.getMessage());
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) URL(java.net.URL) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) PropertyVetoException(java.beans.PropertyVetoException) ExpandVetoException(javax.swing.tree.ExpandVetoException) MalformedURLException(java.net.MalformedURLException)

Example 2 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier 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 3 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier 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 4 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier in project vcell by virtualcell.

the class AnnotationsPanel method initializeComboBoxQualifier.

private void initializeComboBoxQualifier() {
    // Set<MIRIAMQualifier> MIRIAM_all;
    // AnnotationQualifiers.MIRIAM_all;
    List<MIRIAMQualifier> qualifierList = new ArrayList<>();
    for (MIRIAMQualifier qualifier : AnnotationQualifiers.MIRIAM_all) {
        qualifierList.add(qualifier);
    }
    Collections.sort(qualifierList);
    for (MIRIAMQualifier qualifier : qualifierList) {
        defaultComboBoxModelQualifier.addElement(qualifier);
    }
}
Also used : ArrayList(java.util.ArrayList) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Example 5 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier in project vcell by virtualcell.

the class MIRIAMAnnotationEditor method getQualifierComboBoxModel.

private DefaultComboBoxModel getQualifierComboBoxModel() {
    if (qualifierComboBoxModel == null) {
        qualifierComboBoxModel = new DefaultComboBoxModel();
        Set<MIRIAMQualifier> allQualifiers = AnnotationQualifiers.MIRIAM_all;
        for (MIRIAMQualifier qualifier : allQualifiers) {
            qualifierComboBoxModel.addElement(qualifier);
        }
    }
    return qualifierComboBoxModel;
}
Also used : DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Aggregations

MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)21 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)12 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)12 Identifiable (org.vcell.util.document.Identifiable)12 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)9 Map (java.util.Map)9 TreeMap (java.util.TreeMap)9 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)7 HashSet (java.util.HashSet)4 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)3 ReactionStep (cbit.vcell.model.ReactionStep)3 Icon (javax.swing.Icon)3 DataType (cbit.vcell.biomodel.meta.MiriamManager.DataType)2 VCID (cbit.vcell.biomodel.meta.VCID)2 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)2 VCMetaDataMiriamManager (cbit.vcell.biomodel.meta.VCMetaDataMiriamManager)2 Registry (cbit.vcell.biomodel.meta.registry.Registry)2 StructureToolShapeIcon (cbit.vcell.graph.gui.StructureToolShapeIcon)2 SpeciesContext (cbit.vcell.model.SpeciesContext)2 LinkNode (cbit.vcell.xml.gui.MiriamTreeModel.LinkNode)2