Class PathAccessor

All Implemented Interfaces:
PropertyAccessor<BioPAXElement,Object>

public class PathAccessor extends PropertyAccessorAdapter<BioPAXElement,Object>
This class is a composite property accessor that allows users to chain multiple property accessors to define paths in the BioPAX object graph. The path can be defined by either explicitly providing a set of property accessors or by an xPath like syntax. The path can contain transitive and or restricted sub paths: A transitive sub-path is traversed recursively as many times as possible. e.g. Complex/component* will return all components of the complex and the components of the components if those components are complex recursively. A restricted subpath is restricted with a class and only follows through the domains that are assignable from the the restriction class. e.g. Control/controlled:Pathway/name will only return the names of the pathways that are being controlled, but not interactions.
  • Field Details

    • log

      public static final org.slf4j.Logger log
  • Constructor Details

    • PathAccessor

      public PathAccessor(List<PropertyAccessor<? extends BioPAXElement,?>> objectAccessors, BioPAXLevel level)
      Constructor for defining the access path with a list of accessors. All of the accessors must be of the same level. In the case one accessor's range can not be assigned by the domain of the next( broken path), this accessor will return an empty set.
      Parameters:
      objectAccessors - A list of object accessors.
      level - biopax level
    • PathAccessor

      public PathAccessor(String path, BioPAXLevel level)
      Constructor for defining the access path via a XPath like string.
      Parameters:
      path - The string defining the path. The following operators can be used:
      • The first token is the class name of the starting domain.
      • The next tokens are names of the properties, separated by "/"
      • A property step can be restricted to a domain by defining the restriction class with ":" after the property
      • A property step can be declared transitive by adding a "*" at the end.
      • Two accessors can be joined by "|" (Currently not implemented)
      • A subpath can be defined by a substring enclosed in "(" ")"
      • Subpaths can also be restricted or made transitive
      level - BioPAX level that this path is defined in.
    • PathAccessor

      public PathAccessor(String path)
      This constructor defaults to BioPAX Level 3.
      Parameters:
      path - The string defining the path. The following operators can be used:
      • The first token is the class name of the starting domain.
      • The next tokens are names of the properties, separated by "/"
      • A property step can be restricted to a domain by defining the restriction class with ":" after the property
      • A property step can be declared transitive by adding a "*" at the end.
      • Two accessors can be joined by "|" (Currently not implemented)
      • A subpath can be defined by a substring enclosed in "(" ")"
      • Subpaths can also be restricted or made transitive
  • Method Details

    • getValueFromBean

      public Set getValueFromBean(BioPAXElement bean) throws IllegalBioPAXArgumentException
      Description copied from interface: PropertyAccessor
      Returns the value of the bean using the default getMethod.
      Parameters:
      bean - the object whose property is requested
      Returns:
      an object as the value
      Throws:
      IllegalBioPAXArgumentException
    • getValueFromBeans

      public Set getValueFromBeans(Collection<? extends BioPAXElement> beans) throws IllegalBioPAXArgumentException
      Description copied from interface: PropertyAccessor
      Returns the values for a collection of beans using the default getMethod.
      Specified by:
      getValueFromBeans in interface PropertyAccessor<BioPAXElement,Object>
      Overrides:
      getValueFromBeans in class PropertyAccessorAdapter<BioPAXElement,Object>
      Parameters:
      beans - collection of BioPAX objects
      Returns:
      an object as the value
      Throws:
      IllegalBioPAXArgumentException
    • getValueFromModel

      public Set getValueFromModel(Model model)
      This method runs the path query on all the elements within the model.
      Parameters:
      model - to be queried
      Returns:
      a merged set of all values that is reachable by the paths starting from all applicable objects in the model. For example running ProteinReference/xref:UnificationXref on the model will get all the unification xrefs of all ProteinReferences.
    • isUnknown

      public boolean isUnknown(Object value)
      Description copied from interface: PropertyAccessor
      Checks if the value is unkown. In this context a value is regarded to be unknown if it is null (unset).
      Parameters:
      value - the value to be checked
      Returns:
      true if the value is unknown
    • applies

      public boolean applies(BioPAXElement bpe)
      Parameters:
      bpe - BioPAXElement to be checked.
      Returns:
      true if bpe is an instance of the domain of this accessor.