use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup in project vcell by virtualcell.
the class VCMetaData method cleanupMetadata.
public void cleanupMetadata() {
Set<Registry.Entry> entries = registry.getAllEntries();
for (Registry.Entry entry : entries) {
Identifiable entryIdentifiable = entry.getIdentifiable();
VCID vcid = identifiableProvider.getVCID(entryIdentifiable);
Identifiable identifiable = identifiableProvider.getIdentifiableObject(vcid);
if (identifiable == null) {
// use miriamManager to remove RDF statements from resource for identifiable
try {
Map<MiriamRefGroup, MIRIAMQualifier> miriamRefGps = getMiriamManager().getAllMiriamRefGroups(entryIdentifiable);
if (miriamRefGps != null) {
for (Map.Entry<MiriamRefGroup, MIRIAMQualifier> groupEntry : miriamRefGps.entrySet()) {
MiriamRefGroup refGroup = groupEntry.getKey();
MIRIAMQualifier qualifier = groupEntry.getValue();
getMiriamManager().remove(entryIdentifiable, qualifier, refGroup);
}
}
} catch (URNParseFailureException e) {
e.printStackTrace(System.out);
}
// set nonRDF annotations to null
NonRDFAnnotation nonRDFAnnotation = getExistingNonRDFAnnotation(entryIdentifiable);
if (nonRDFAnnotation != null) {
nonRDFAnnotation.setFreeTextAnnotation(null);
nonRDFAnnotation.setXhtmlNotes(null);
nonRDFAnnotation.setXmlAnnotations(null);
}
System.err.println("Deleting resource for identifiable '" + entryIdentifiable.toString() + "' since it is not found in " + identifiableProvider.getClass().getName());
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup 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.MiriamRefGroup in project vcell by virtualcell.
the class BioModelPropertiesPanel method updateInterface.
/**
* Comment
*/
private void updateInterface() {
if (bioModel == null || bioModelWindowManager == null) {
return;
}
nameLabel.setText(bioModel.getName());
Version version = bioModel.getVersion();
if (version != null) {
ownerLabel.setText(version.getOwner().getName());
lastModifiedLabel.setText(version.getDate().toString());
try {
BioModelInfo bioModelInfo = bioModelWindowManager.getRequestManager().getDocumentManager().getBioModelInfo(version.getVersionKey());
permissionLabel.setText(bioModelInfo.getVersion().getGroupAccess().getDescription());
} catch (DataAccessException e) {
e.printStackTrace();
}
changePermissionButton.setEnabled(true);
}
webLinksPanel.removeAll();
webLinksPanel.setLayout(new GridLayout(0, 1));
Set<MiriamRefGroup> resources = new HashSet<MiriamRefGroup>();
Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
resources.addAll(isDescribedByAnnotation);
resources.addAll(isAnnotation);
for (MiriamRefGroup refGroup : resources) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
LinkNode linkNode = new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources);
final String link = linkNode.getLink();
String labelText = miriamResources.getDataType() == null ? "" : miriamResources.getDataType().getDataTypeName();
String toolTip = null;
if (link != null) {
toolTip = "double-click to open link " + link;
labelText = "<html><b>" + labelText + "</b> " + "<font color=blue><a href=" + link + ">" + link + "</a></font></html>";
}
JLabel label = new JLabel(labelText);
label.addMouseListener(new MouseListener() {
public void mouseReleased(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
DialogUtils.browserLauncher(BioModelPropertiesPanel.this, link, "failed to open " + link);
}
}
});
label.setToolTipText(toolTip);
webLinksPanel.add(label);
}
}
applicationsPanel.removeAll();
int gridy = 0;
SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
if (simulationContexts != null) {
for (int i = 0; i < simulationContexts.length; i++) {
SimulationContext simContext = simulationContexts[i];
JLabel label = new JLabel(simContext.getName());
label.setFont(label.getFont().deriveFont(Font.BOLD));
if (simContext.isRuleBased()) {
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appRbmNonspIcon);
}
} else if (simContext.isStoch()) {
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appStoNonspIcon);
} else {
label.setIcon(VCellIcons.appStoSpatialIcon);
}
} else {
// deterministic
if (simContext.getGeometry().getDimension() == 0) {
label.setIcon(VCellIcons.appDetNonspIcon);
} else {
label.setIcon(VCellIcons.appDetSpatialIcon);
}
}
GridBagConstraints gbc = new java.awt.GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = gridy++;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.anchor = GridBagConstraints.FIRST_LINE_START;
if (i > 0) {
gbc.insets = new Insets(4, 0, 0, 0);
}
applicationsPanel.add(label, gbc);
Geometry geometry = simContext.getGeometry();
String geometryText = "Compartmental geometry";
if (geometry != null) {
Version geometryVersion = geometry.getVersion();
int dimension = geometry.getDimension();
if (dimension > 0) {
String description = geometry.getDimension() + "D " + (geometry.getGeometrySpec().hasImage() ? "image" : "analytic") + " geometry";
geometryText = description;
if (geometryVersion != null) {
geometryText += " - " + geometryVersion.getName();
}
}
}
JLabel geometryLabel = new JLabel(geometryText);
geometryLabel.setIcon(VCellIcons.geometryIcon);
JLabel detStochLabel = new JLabel(simContext.getMathType().getDescription());
detStochLabel.setIcon(VCellIcons.mathTypeIcon);
gbc.insets = new Insets(2, 20, 2, 2);
gbc.gridy = gridy++;
applicationsPanel.add(detStochLabel, gbc);
gbc.gridy = gridy++;
if (i == simulationContexts.length - 1) {
gbc.weighty = 1.0;
}
applicationsPanel.add(geometryLabel, gbc);
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup in project vcell by virtualcell.
the class BioModelTreeModel method addBioModelContents.
/**
* Insert the method's description here.
* Creation date: (11/28/00 2:41:43 PM)
* @param bioModelNode cbit.vcell.desktop.BioModelNode
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
private void addBioModelContents(BioModelNode bioModelNode, BioModel bioModel) {
//
if (bioModel == null) {
return;
}
// bioModelNode.add(new BioModelNode(bioModel.getModel(),false));
// if (bioModel.getDescription() != null && !bioModel.getDescription().equals("")){
bioModelNode.add(new BioModelNode(new Annotation(bioModel.getVCMetaData().getFreeTextAnnotation(bioModel)), false));
// }
Set<MiriamRefGroup> isDescribedByAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_isDescribedBy);
for (MiriamRefGroup refGroup : isDescribedByAnnotation) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
bioModelNode.add(new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_isDescribedBy, miriamResources));
}
}
Set<MiriamRefGroup> isAnnotation = bioModel.getVCMetaData().getMiriamManager().getMiriamRefGroups(bioModel, MIRIAMQualifier.MODEL_is);
for (MiriamRefGroup refGroup : isAnnotation) {
for (MiriamResource miriamResources : refGroup.getMiriamRefs()) {
bioModelNode.add(new MiriamTreeModel.LinkNode(MIRIAMQualifier.MODEL_is, miriamResources));
}
}
SimulationContext[] scArray = bioModel.getSimulationContexts();
if (scArray != null) {
for (int i = 0; i < scArray.length; i++) {
BioModelNode scNode = new BioModelNode(scArray[i], true);
bioModelNode.add(scNode);
// scNode.add(new BioModelNode(scArray[i].getModel(),false));
// add application type node
MathType typeInfo = scArray[i].getMathType();
BioModelNode appTypeNode = new BioModelNode(typeInfo, false);
appTypeNode.setRenderHint("type", "AppType");
scNode.add(appTypeNode);
//
// Display Annotation on tree
//
scNode.add(new BioModelNode(new Annotation(scArray[i].getDescription()), false));
scNode.add(new BioModelNode(scArray[i].getGeometry(), false));
if (scArray[i].getMathDescription() != null) {
scNode.add(new BioModelNode(scArray[i].getMathDescription(), false));
} else {
scNode.add(new BioModelNode("math not generated", false));
}
//
// add simulations to simulationContext
//
Simulation[] simArray = bioModel.getSimulations();
if (simArray != null) {
for (int j = 0; j < simArray.length; j++) {
if (simArray[j].getMathDescription() == scArray[i].getMathDescription()) {
BioModelNode simNode = new BioModelNode(simArray[j], true);
scNode.add(simNode);
//
// add simulation children (simulation annotations)
//
// if (simArray[j].getDescription() != null && simArray[j].getDescription().length() > 0){
simNode.add(new BioModelNode(new Annotation(simArray[j].getDescription()), false));
// }
// simNode.add(new BioModelNode(simArray[i].getMathDescription(),false));
// simNode.add(new BioModelNode(simArray[i].getMathOverrides(),false));
// simNode.add(new BioModelNode(simArray[i].getMeshSpecification(),false));
// simNode.add(new BioModelNode(simArray[i].getSolverTaskDescription(),false));
}
}
}
}
}
}
use of cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup 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;
}
Aggregations