Package org.biopax.paxtools.controller
Class PathAccessor
java.lang.Object
org.biopax.paxtools.controller.PropertyAccessorAdapter<BioPAXElement,Object>
org.biopax.paxtools.controller.PathAccessor
- All Implemented Interfaces:
PropertyAccessor<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 Summary
FieldsFields inherited from class org.biopax.paxtools.controller.PropertyAccessorAdapter
multipleCardinality, range -
Constructor Summary
ConstructorsConstructorDescriptionPathAccessor(String path) This constructor defaults to BioPAX Level 3.PathAccessor(String path, BioPAXLevel level) Constructor for defining the access path via a XPath like string.PathAccessor(List<PropertyAccessor<? extends BioPAXElement, ?>> objectAccessors, BioPAXLevel level) Constructor for defining the access path with a list of accessors. -
Method Summary
Modifier and TypeMethodDescriptionbooleanapplies(BioPAXElement bpe) Returns the value of the bean using the default getMethod.getValueFromBeans(Collection<? extends BioPAXElement> beans) Returns the values for a collection of beans using the default getMethod.getValueFromModel(Model model) This method runs the path query on all the elements within the model.booleanChecks if the value is unkown.Methods inherited from class org.biopax.paxtools.controller.PropertyAccessorAdapter
getDomain, getRange, isMultipleCardinality
-
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
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
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
Description copied from interface:PropertyAccessorReturns 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:PropertyAccessorReturns the values for a collection of beans using the default getMethod.- Specified by:
getValueFromBeansin interfacePropertyAccessor<BioPAXElement,Object> - Overrides:
getValueFromBeansin classPropertyAccessorAdapter<BioPAXElement,Object> - Parameters:
beans- collection of BioPAX objects- Returns:
- an object as the value
- Throws:
IllegalBioPAXArgumentException
-
getValueFromModel
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
Description copied from interface:PropertyAccessorChecks 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
- Parameters:
bpe- BioPAXElement to be checked.- Returns:
- true if bpe is an instance of the domain of this accessor.
-