use of org.vcell.util.document.Identifiable 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;
}
use of org.vcell.util.document.Identifiable 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;
}
use of org.vcell.util.document.Identifiable in project vcell by virtualcell.
the class AnnotationsPanel method initializeComboBoxURI.
@SuppressWarnings("unchecked")
private void initializeComboBoxURI() {
Identifiable entity = getIdentifiable(selectedObject);
defaultComboBoxModelURI.removeAllElements();
List<String> tooltips = new ArrayList<String>();
List<DataType> dataTypeList = new ArrayList<>();
if (entity == null) {
for (DataType dt : vcMetaData.getMiriamManager().getAllDataTypes().values()) {
dataTypeList.add(dt);
}
} else {
for (DataType dt : VCMetaDataMiriamManager.getSpecificDataTypes(entity)) {
dataTypeList.add(dt);
}
}
Collections.sort(dataTypeList);
for (DataType dt : dataTypeList) {
tooltips.add(dt.getDescription());
defaultComboBoxModelURI.addElement(dt);
}
((ComboboxToolTipRenderer) getJComboBoxURI().getRenderer()).setTooltips(tooltips);
}
use of org.vcell.util.document.Identifiable in project vcell by virtualcell.
the class AnnotationsPanel method updateInterface.
private void updateInterface() {
if (bioModel == null) {
return;
}
Identifiable entity = getIdentifiable(selectedObject);
if (selectedObject != null && entity != null) {
getJComboBoxURI().setEnabled(true);
getJTextFieldFormalID().setEnabled(true);
getJButtonAddRef().setEnabled(true);
getJButtonRemoveText().setEnabled(true);
VCMetaDataDataType mdt = (VCMetaDataDataType) getJComboBoxURI().getSelectedItem();
miriamTreeModel.createTree(entity);
String freeText = bioModel.getVCMetaData().getFreeTextAnnotation(entity);
if (freeText == null || freeText.isEmpty()) {
annotationTextArea.setText(null);
} else {
annotationTextArea.setText(freeText);
}
annotationTextArea.setEditable(true);
annotationTextArea.setCaretPosition(0);
} else {
getJComboBoxURI().setEnabled(false);
getJTextFieldFormalID().setEnabled(false);
getJButtonAddRef().setEnabled(false);
getJButtonRemoveText().setEnabled(false);
miriamTreeModel.createTree(null);
annotationTextArea.setText(null);
annotationTextArea.setEditable(false);
}
}
use of org.vcell.util.document.Identifiable in project vcell by virtualcell.
the class AnnotationsPanel method changeTextAnnotation.
private void changeTextAnnotation() {
try {
if (bioModel == null || selectedObject == null) {
return;
}
Identifiable entity = getIdentifiable(selectedObject);
String textAreaStr = (annotationTextArea.getText() == null || annotationTextArea.getText().length() == 0 ? null : annotationTextArea.getText());
String oldText = bioModel.getVCMetaData().getFreeTextAnnotation(entity);
if (textAreaStr == null || textAreaStr.isEmpty() || emptyHtmlText.equals(textAreaStr)) {
// no annotation now, the field is empty
// delete, if there's something previously saved
bioModel.getVCMetaData().deleteFreeTextAnnotation(entity);
if (selectedObject instanceof ReactionStep) {
// we tell ReactionPropertiesPanel to refresh the annotation icon
((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
}
} else if (!Compare.isEqualOrNull(oldText, textAreaStr)) {
// some text annotation different from what's already saved
// overwrite
bioModel.getVCMetaData().setFreeTextAnnotation(entity, textAreaStr);
if (selectedObject instanceof ReactionStep) {
// we tell ReactionPropertiesPanel to refresh the text annotation icon
((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
}
}
} catch (Exception e) {
e.printStackTrace(System.out);
PopupGenerator.showErrorDialog(this, "Annotation Error\n" + e.getMessage(), e);
}
}
Aggregations