Search in sources :

Example 6 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier in project vcell by virtualcell.

the class MIRIAMAnnotationEditor method removeSelectedRefGroups.

public void removeSelectedRefGroups() {
    Object treeNode = jTreeMIRIAM.getLastSelectedPathComponent();
    if (treeNode instanceof IdentifiableNode) {
        Identifiable identifiable = ((IdentifiableNode) treeNode).getIdentifiable();
        Map<MiriamRefGroup, MIRIAMQualifier> refGroupsToRemove = vcMetaData.getMiriamManager().getAllMiriamRefGroups(identifiable);
        for (MiriamRefGroup refGroup : refGroupsToRemove.keySet()) {
            MIRIAMQualifier qualifier = refGroupsToRemove.get(refGroup);
            try {
                vcMetaData.getMiriamManager().remove(identifiable, qualifier, refGroup);
            } catch (URNParseFailureException e) {
                e.printStackTrace(System.out);
            }
        }
    }
}
Also used : IdentifiableNode(cbit.vcell.xml.gui.MiriamTreeModel.IdentifiableNode) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Example 7 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier 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);
        }
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) DataType(cbit.vcell.biomodel.meta.MiriamManager.DataType) UtilCancelException(org.vcell.util.UtilCancelException) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) HashSet(java.util.HashSet)

Example 8 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier 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);
    }
}
Also used : IdentifiableComparator(cbit.vcell.biomodel.meta.IdentifiableComparator) MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) TreeSet(java.util.TreeSet) Set(java.util.Set) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) BioModelNode(cbit.vcell.desktop.BioModelNode) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) TreeSet(java.util.TreeSet) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) VCID(cbit.vcell.biomodel.meta.VCID) DublinCoreDate(org.vcell.sybil.models.dublincore.DublinCoreDate) Annotation(cbit.vcell.desktop.Annotation) Identifiable(org.vcell.util.document.Identifiable) DateQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier.DateQualifier) DublinCoreQualifier(org.vcell.sybil.models.dublincore.DublinCoreQualifier) Map(java.util.Map) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier)

Example 9 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier in project vcell by virtualcell.

the class MiriamTreeModel method createTree.

public void createTree(Identifiable identifiable) {
    if (identifiable == null) {
        ((DefaultMutableTreeNode) getRoot()).removeAllChildren();
        fireTreeStructureChanged(this, getPathToRoot(((DefaultMutableTreeNode) getRoot())), null, null);
        return;
    }
    ((DefaultMutableTreeNode) getRoot()).removeAllChildren();
    MiriamManager miriamManager = vcMetaData.getMiriamManager();
    TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
    Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
    VCID vcid = vcMetaData.getIdentifiableProvider().getVCID(identifiable);
    // Map<Identifiable, Map<DateQualifier, Set<DublinCoreDate>>> dateMapMap = miriamManager.getDublinCoreDateMap();
    // Map<DateQualifier, Set<DublinCoreDate>> dateMap = dateMapMap.get(identifiable);
    List<LinkNode> nodeList = new ArrayList<>();
    if (refGroupMap != null) {
        for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
            MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
            for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
                LinkNode ln = new LinkNode(qualifier, miriamResource);
                nodeList.add(ln);
            }
        }
        Collections.sort(nodeList);
        for (LinkNode ln : nodeList) {
            ((DefaultMutableTreeNode) getRoot()).add(ln);
        }
    }
    // if (dateMap!=null){
    // for (DublinCoreQualifier.DateQualifier qualifier : dateMap.keySet()){
    // Set<DublinCoreDate> dates = dateMap.get(qualifier);
    // for (DublinCoreDate date : dates){
    // ((DefaultMutableTreeNode)getRoot()).add(new DateNode(qualifier,date));
    // }
    // }
    // }
    fireTreeStructureChanged(this, getPathToRoot(((DefaultMutableTreeNode) getRoot())), null, null);
}
Also used : VCID(cbit.vcell.biomodel.meta.VCID) MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) ArrayList(java.util.ArrayList) Identifiable(org.vcell.util.document.Identifiable) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) Map(java.util.Map) TreeMap(java.util.TreeMap) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)

Example 10 with MIRIAMQualifier

use of org.vcell.sybil.models.miriam.MIRIAMQualifier 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);
        if (vcid == null) {
            continue;
        }
        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());
        }
    }
}
Also used : Registry(cbit.vcell.biomodel.meta.registry.Registry) Identifiable(org.vcell.util.document.Identifiable) Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) Entry(cbit.vcell.biomodel.meta.registry.Registry.Entry) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) TreeMap(java.util.TreeMap) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)

Aggregations

MIRIAMQualifier (org.vcell.sybil.models.miriam.MIRIAMQualifier)21 MiriamManager (cbit.vcell.biomodel.meta.MiriamManager)12 MiriamRefGroup (cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup)12 Identifiable (org.vcell.util.document.Identifiable)12 MiriamResource (cbit.vcell.biomodel.meta.MiriamManager.MiriamResource)9 Map (java.util.Map)9 TreeMap (java.util.TreeMap)9 URNParseFailureException (org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException)7 HashSet (java.util.HashSet)4 Entry (cbit.vcell.biomodel.meta.registry.Registry.Entry)3 ReactionStep (cbit.vcell.model.ReactionStep)3 Icon (javax.swing.Icon)3 DataType (cbit.vcell.biomodel.meta.MiriamManager.DataType)2 VCID (cbit.vcell.biomodel.meta.VCID)2 VCMetaData (cbit.vcell.biomodel.meta.VCMetaData)2 VCMetaDataMiriamManager (cbit.vcell.biomodel.meta.VCMetaDataMiriamManager)2 Registry (cbit.vcell.biomodel.meta.registry.Registry)2 StructureToolShapeIcon (cbit.vcell.graph.gui.StructureToolShapeIcon)2 SpeciesContext (cbit.vcell.model.SpeciesContext)2 LinkNode (cbit.vcell.xml.gui.MiriamTreeModel.LinkNode)2