use of cbit.vcell.biomodel.meta.MiriamManager 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("• " + prettyResourceName + " <b>" + preferredName + "</b><br>");
List<URL> linkURLs = miriamManager.getStoredCrossReferencedLinks(resource);
for (URL url : linkURLs) {
buffer.append(" - <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());
}
}
use of cbit.vcell.biomodel.meta.MiriamManager 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);
}
use of cbit.vcell.biomodel.meta.MiriamManager 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);
}
}
use of cbit.vcell.biomodel.meta.MiriamManager in project vcell by virtualcell.
the class MIRIAMAnnotationEditor method addIdentifierDialog.
public void addIdentifierDialog() {
if (PopupGenerator.showComponentOKCancelDialog(MIRIAMAnnotationEditor.this, getJPanelNewIdentifier(), "Define New Formal Identifier") == JOptionPane.OK_OPTION) {
MIRIAMQualifier qualifier = (MIRIAMQualifier) jComboBoxQualifier.getSelectedItem();
MiriamManager.DataType objectNamespace = (MiriamManager.DataType) jComboBoxURI.getSelectedItem();
String objectID = jTextFieldFormalID.getText();
MiriamManager miriamManager = vcMetaData.getMiriamManager();
HashSet<MiriamResource> miriamResources = new HashSet<MiriamResource>();
try {
miriamResources.add(miriamManager.createMiriamResource(objectNamespace.getBaseURN() + ":" + objectID));
miriamManager.addMiriamRefGroup(getSelectedIdentifiable(), qualifier, miriamResources);
} catch (Exception e) {
e.printStackTrace();
DialogUtils.showErrorDialog(this, "Add Identifier failed:\n" + e.getMessage(), e);
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager 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);
}
}
Aggregations