use of org.vcell.sybil.models.dublincore.DublinCoreDate in project vcell by virtualcell.
the class MiriamTreeModel method createTree.
private void createTree() {
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);
}
}
use of org.vcell.sybil.models.dublincore.DublinCoreDate in project vcell by virtualcell.
the class MIRIAMAnnotationEditor method addTimeUTCDialog.
// public void addFreeTextDialog() {
// Identifiable identifiable = getSelectedIdentifiable();
// if (identifiable==null){
// DialogUtils.showErrorDialog(this, "no component selected for annotation");
// return;
// }
// String freeTextAnnotation = vcMetaData.getFreeTextAnnotation(identifiable);
// if (freeTextAnnotation==null){
// freeTextAnnotation = "";
// }
// try {
// freeTextAnnotation = DialogUtils.showInputDialog0(this, "annotation with free text", freeTextAnnotation);
// vcMetaData.setFreeTextAnnotation(identifiable, freeTextAnnotation);
// } catch (UtilCancelException e1) {
// e1.printStackTrace();
// }
// }
public void addTimeUTCDialog() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
getJTextFieldTimeUTC().setText(sdf.format(new Date()));
if (PopupGenerator.showComponentOKCancelDialog(MIRIAMAnnotationEditor.this, getJPanelTimeUTC(), "Define New Date") == JOptionPane.OK_OPTION) {
String dateString = getJTextFieldTimeUTC().getText();
vcMetaData.getMiriamManager().addDate(getSelectedIdentifiable(), (DublinCoreQualifier.DateQualifier) getJComboBoxTimeUTCType().getSelectedItem(), new DublinCoreDate(dateString));
// String qualifierName = (String)jComboBoxQualifier.getSelectedItem();
// URI qualifierURI = null;
// if(qualifierName.endsWith("(bio)")){
// qualifierURI = new URI(XMLTags.BMBIOQUAL_NAMESPACE_URI);
// }else if(qualifierName.endsWith("(model)")){
// qualifierURI = new URI(XMLTags.BMMODELQUAL_NAMESPACE_URI);
// }
// qualifierName = qualifierName.substring(0,qualifierName.indexOf(" ("));
// Element newID =
// MIRIAMHelper.createRDFIdentifier((String)jComboBoxURI.getSelectedItem(), jTextFieldFormalID.getText());
// MIRIAMHelper.addIdentifierToAnnotation(
// newID,
// getSelectedMIRIAMAnnotatable().getMIRIAMAnnotation(),
// qualifierName,
// qualifierURI);
}
}
use of org.vcell.sybil.models.dublincore.DublinCoreDate 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;
}
Aggregations