|
XPathFilter
Explains basic usage of the XPathFilter
Featured XPathFilterThe com.semagia.tmapix.filter.xpath package provides a com.semagia.tmapix.filter.IFilter implementation that utilizes XPath 1.0 expressions to navigate through the Topic Maps - Data Model (TMDM). The axes names are aligned to TMDM, an overview can be found at XPathAxes. QuickstartIn your application you should always use the IFilter interface since it keeps your implementation independent of the concrete IFilter implementation. To create a IFilter which utilizes XPath, use the com.semagia.tmapix.filter.xpath.XPathFilter: import com.semagia.tmapix.filter.IFilter;
import com.semagia.tmapix.filter.xpath.XPathFilter;
IFilter<Role> filter = XPathFilter.create("role");
// Iterates through all roles the topic is playing
for (Role role: filter.match(topic)) {
doSomethingWith(role);
}XPathFilter.create(String) is a factory method to create new instances of IFilter. In case the expression is not a valid (i.e. a syntax error occurs), a RuntimeException is thrown. |
► Sign in to add a comment