use of cbit.vcell.biomodel.meta.registry.Registry.Entry in project vcell by virtualcell.
the class VCMetaDataMiriamManager method queryAllMiriamRefGroups.
private Map<MiriamRefGroup, MIRIAMQualifier> queryAllMiriamRefGroups(Identifiable identifiable) {
Entry entry = vcMetaData.getRegistry().getEntry(identifiable);
if (entry.getResource() == null) {
return null;
}
MIRIAMizer miriamizer = new MIRIAMizer();
Map<RefGroup, MIRIAMQualifier> allRefGroups = miriamizer.getAllRefGroups(vcMetaData.getRdfData(), entry.getResource());
Map<MiriamRefGroup, MIRIAMQualifier> wrappedRefGroups = new HashMap<MiriamRefGroup, MIRIAMQualifier>();
for (RefGroup refGroup : allRefGroups.keySet()) {
MiriamRefGroup miriamRefGroup = new VCMetaDataMiriamRefGroup(refGroup);
MIRIAMQualifier miriamQualifier = allRefGroups.get(refGroup);
wrappedRefGroups.put(miriamRefGroup, miriamQualifier);
}
return wrappedRefGroups;
}
use of cbit.vcell.biomodel.meta.registry.Registry.Entry in project vcell by virtualcell.
the class XMLMetaDataWriter method createNonRDFAnnotationElement.
/**
* creating XMLMetaData element for nonRDFAnnotation element here since nonRDFAnnotation was made package level
* this is similar to XMLRDFWriter.createElement(metaData)
*
* @return the created NonRDFAnnotationListElement
*/
private static Element createNonRDFAnnotationElement(VCMetaData metaData, IdentifiableProvider identifiableProvider) {
Set<Map.Entry<Entry, NonRDFAnnotation>> allNonRdfAnnotations = metaData.getAllNonRDFAnnotations();
Element nonRDFAnnotationListElement = new Element(XMLMetaData.NONRDF_ANNOTATION_LIST_TAG);
Iterator<Map.Entry<Entry, NonRDFAnnotation>> iter = allNonRdfAnnotations.iterator();
while (iter.hasNext()) {
Map.Entry<Entry, NonRDFAnnotation> mapEntry = iter.next();
Entry openEntry = mapEntry.getKey();
NonRDFAnnotation nonRDFAnnotation = mapEntry.getValue();
VCID vcid = identifiableProvider.getVCID(openEntry.getIdentifiable());
Identifiable identifiable = identifiableProvider.getIdentifiableObject(vcid);
// only write out nonRDF annotation if identifiable in identifiableProvider is not null
if (identifiable != null) {
if (!nonRDFAnnotation.isEmpty()) {
Element nonRDFAnnotationElement = new Element(XMLMetaData.NONRDF_ANNOTATION_TAG);
nonRDFAnnotationElement.setAttribute(XMLMetaData.VCID_ATTR_TAG, vcid.toASCIIString());
nonRDFAnnotationListElement.addContent(nonRDFAnnotationElement);
String freeTextAnnotation = nonRDFAnnotation.getFreeTextAnnotation();
if (freeTextAnnotation != null && freeTextAnnotation.length() > 0) {
Element freeTextAnnotationElement = new Element(XMLMetaData.FREETEXT_TAG);
freeTextAnnotationElement.addContent(new Text(freeTextAnnotation));
nonRDFAnnotationElement.addContent(freeTextAnnotationElement);
}
Element xhtmlNotes = nonRDFAnnotation.getXhtmlNotes();
if (xhtmlNotes != null) {
// Element notesElement = new Element(XMLMetaData.NOTES_TAG);
// notesElement.addContent(xhtmlNotes));
nonRDFAnnotationElement.addContent(xhtmlNotes.detach());
}
Element[] otherAnnotations = nonRDFAnnotation.getXmlAnnotations();
if (otherAnnotations != null && otherAnnotations.length > 0) {
Element annotationListElement = new Element(XMLMetaData.ANNOTATION_LIST_TAG);
nonRDFAnnotationElement.addContent(annotationListElement);
for (int i = 0; i < otherAnnotations.length; i++) {
annotationListElement.addContent(otherAnnotations[i].detach());
}
}
}
}
}
return nonRDFAnnotationListElement;
}
use of cbit.vcell.biomodel.meta.registry.Registry.Entry in project vcell by virtualcell.
the class XMLMetaDataWriter method getElement.
public static Element getElement(VCMetaData metaData, IdentifiableProvider identifiableProvider) {
Element element = new Element(XMLMetaData.VCMETADATA_TAG);
Element elementRDF = metaData.createElement();
// add RDF data
if (elementRDF != null) {
element.addContent(elementRDF);
}
Element elementNonRDFList = createNonRDFAnnotationElement(metaData, identifiableProvider);
element.addContent(elementNonRDFList);
// add resource binding table
Element bindingListElement = new Element(XMLMetaData.URI_BINDING_LIST_TAG);
Set<Registry.Entry> resources = metaData.getRegistry().getAllEntries();
for (Registry.Entry entry : resources) {
VCID vcid = identifiableProvider.getVCID(entry.getIdentifiable());
Identifiable identifiable = identifiableProvider.getIdentifiableObject(vcid);
if (identifiable != null && entry.getResource() != null) {
Element entryElement = new Element(XMLMetaData.URI_BINDING_TAG);
Resource resource = entry.getResource();
if (resource != null) {
entryElement.setAttribute(XMLMetaData.URI_ATTR_TAG, resource.stringValue());
}
entryElement.setAttribute(XMLMetaData.VCID_ATTR_TAG, vcid.toASCIIString());
bindingListElement.addContent(entryElement);
}
}
element.addContent(bindingListElement);
return element;
}
use of cbit.vcell.biomodel.meta.registry.Registry.Entry in project vcell by virtualcell.
the class VCMetaData method getOrCreateNonRDFAnnotation.
private NonRDFAnnotation getOrCreateNonRDFAnnotation(Identifiable identifiable) {
Entry entry = registry.getEntry(identifiable);
NonRDFAnnotation nonRDFAnnotation = nonRDFAnnotationMap.get(entry);
if (nonRDFAnnotation == null) {
nonRDFAnnotation = new NonRDFAnnotation();
nonRDFAnnotationMap.put(entry, nonRDFAnnotation);
}
return nonRDFAnnotation;
}
use of cbit.vcell.biomodel.meta.registry.Registry.Entry in project vcell by virtualcell.
the class VCMetaData method getExistingNonRDFAnnotation.
private NonRDFAnnotation getExistingNonRDFAnnotation(Identifiable identifiable) {
Entry entry = registry.getEntry(identifiable);
NonRDFAnnotation nonRDFAnnotation = nonRDFAnnotationMap.get(entry);
return nonRDFAnnotation;
}
Aggregations