Search in sources :

Example 1 with RdfObjectProxy

use of org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy in project vcell by virtualcell.

the class Control method replace.

public void replace(HashMap<String, BioPaxObject> resourceMap, HashSet<BioPaxObject> replacedBPObjects) {
    super.replace(resourceMap, replacedBPObjects);
    // we can have a combination of controllers
    for (int i = 0; i < pathwayControllers.size(); i++) {
        Pathway controller = pathwayControllers.get(i);
        if (controller instanceof RdfObjectProxy) {
            RdfObjectProxy rdfObjectProxy = (RdfObjectProxy) controller;
            if (rdfObjectProxy.getID() != null) {
                BioPaxObject concreteObject = resourceMap.get(rdfObjectProxy.getID());
                if (concreteObject != null) {
                    if (concreteObject instanceof Pathway) {
                        pathwayControllers.set(i, (Pathway) concreteObject);
                    } else {
                        pathwayControllers.remove(i);
                    }
                }
            }
        }
    }
    // we assume we can only have one "controlled" entity
    if (controlledInteraction instanceof RdfObjectProxy) {
        RdfObjectProxy rdfObjectProxy = (RdfObjectProxy) controlledInteraction;
        if (rdfObjectProxy.getID() != null) {
            BioPaxObject concreteObject = resourceMap.get(rdfObjectProxy.getID());
            if (concreteObject != null) {
                if (concreteObject instanceof Interaction) {
                    controlledInteraction = (Interaction) concreteObject;
                    controlledPathway = null;
                } else if (concreteObject instanceof Pathway) {
                    controlledInteraction = null;
                    controlledPathway = (Pathway) concreteObject;
                }
            }
        }
    }
}
Also used : RdfObjectProxy(org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)

Example 2 with RdfObjectProxy

use of org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy in project vcell by virtualcell.

the class GroupObject method replace.

public void replace(HashMap<String, BioPaxObject> resourceMap, HashSet<BioPaxObject> replacedBPObjects) {
    super.replace(resourceMap, replacedBPObjects);
    HashSet<BioPaxObject> gObjects = new HashSet<BioPaxObject>();
    for (BioPaxObject bpo : groupedObjects) {
        if (bpo instanceof RdfObjectProxy) {
            RdfObjectProxy rdfObjectProxy = (RdfObjectProxy) bpo;
            if (rdfObjectProxy.getID() != null) {
                BioPaxObject concreteObject = resourceMap.get(rdfObjectProxy.getID());
                if (concreteObject != null) {
                    gObjects.add(concreteObject);
                }
            }
        } else {
            gObjects.add(bpo);
        }
    }
    setGroupedeObjects(gObjects);
}
Also used : RdfObjectProxy(org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy) HashSet(java.util.HashSet)

Example 3 with RdfObjectProxy

use of org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy in project vcell by virtualcell.

the class InteractionImpl method replace.

public void replace(HashMap<String, BioPaxObject> resourceMap, HashSet<BioPaxObject> replacedBPObjects) {
    super.replace(resourceMap, replacedBPObjects);
    for (int i = 0; i < interactionTypes.size(); i++) {
        InteractionVocabulary thing = interactionTypes.get(i);
        if (thing instanceof RdfObjectProxy) {
            RdfObjectProxy rdfObjectProxy = (RdfObjectProxy) thing;
            if (rdfObjectProxy.getID() != null) {
                BioPaxObject concreteObject = resourceMap.get(rdfObjectProxy.getID());
                if (concreteObject != null) {
                    interactionTypes.set(i, (InteractionVocabulary) concreteObject);
                }
            }
        }
    }
    for (int i = 0; i < participants.size(); i++) {
        InteractionParticipant thing = participants.get(i);
        if (thing.getPhysicalEntity() instanceof RdfObjectProxy) {
            RdfObjectProxy rdfObjectProxy = (RdfObjectProxy) thing.getPhysicalEntity();
            if (rdfObjectProxy.getID() != null) {
                BioPaxObject concreteObject = resourceMap.get(rdfObjectProxy.getID());
                if (concreteObject != null) {
                    PhysicalEntity physicalEntity = (PhysicalEntity) concreteObject;
                    participants.set(i, new InteractionParticipant(this, physicalEntity, thing.getType()));
                }
            }
        }
    }
}
Also used : RdfObjectProxy(org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)

Example 4 with RdfObjectProxy

use of org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy in project vcell by virtualcell.

the class PathwayReaderBiopax3 method addAttributes.

private void addAttributes(BioPaxObject bioPaxObject, Element element) {
    int count = 0;
    for (Object attr : element.getAttributes()) {
        Attribute attribute = (Attribute) attr;
        if (attribute.getName().equals("ID")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                showUnexpected(attribute);
            } else {
                String uri = context.unAbbreviateURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
                count++;
            }
        } else if (attribute.getName().equals("resource")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                String uri = context.unRelativizeURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
                count++;
            } else {
                showUnexpected(attribute);
            }
        } else if (attribute.getName().equals("about")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                // TODO: can this ever happen?
                String uri = context.unRelativizeURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
                count++;
            } else {
                String uri = context.unRelativizeURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
                count++;
            }
        } else if (attribute.getName().equals("nodeID")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                // TODO: can this ever happen?
                ((RdfObjectProxy) bioPaxObject).setID(attribute.getValue());
                count++;
            } else {
                bioPaxObject.setID(attribute.getValue());
                count++;
            }
        } else {
            showUnexpected(attribute);
        }
    }
    if (count < 1) {
        System.out.println(element + " has neither ID nor resource attributes.");
    }
    if (count > 1) {
        System.out.println(element + " has multiple ID and/or resource attributes.");
    }
}
Also used : Attribute(org.jdom.Attribute) GroupObject(org.vcell.pathway.GroupObject) BioPaxObject(org.vcell.pathway.BioPaxObject) RdfObjectProxy(org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)

Example 5 with RdfObjectProxy

use of org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy in project vcell by virtualcell.

the class PathwayReader method addAttributes.

private void addAttributes(BioPaxObject bioPaxObject, Element element) {
    for (Object attr : element.getAttributes()) {
        Attribute attribute = (Attribute) attr;
        if (attribute.getName().equals("ID")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                showUnexpected(attribute, bioPaxObject);
            } else {
                String uri = context.unAbbreviateURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
            }
        } else if (attribute.getName().equals("resource")) {
            if (bioPaxObject instanceof RdfObjectProxy) {
                String uri = context.unRelativizeURI(element, attribute.getValue());
                bioPaxObject.setID(uri);
            } else {
                showUnexpected(attribute, bioPaxObject);
            }
        } else {
            showUnexpected(attribute, bioPaxObject);
        }
    }
}
Also used : Attribute(org.jdom.Attribute) BioPaxObject(org.vcell.pathway.BioPaxObject) RdfObjectProxy(org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)

Aggregations

RdfObjectProxy (org.vcell.pathway.persistence.BiopaxProxy.RdfObjectProxy)5 Attribute (org.jdom.Attribute)2 BioPaxObject (org.vcell.pathway.BioPaxObject)2 HashSet (java.util.HashSet)1 GroupObject (org.vcell.pathway.GroupObject)1