Search in sources :

Example 6 with AbstractAxis

use of org.sirix.axis.AbstractAxis in project sirix by sirixdb.

the class FMSE method getLabels.

/**
 * Creates a flat list of all nodes by doing an in-order-traversal. NOTE: Since this is not a
 * binary tree, we use post-order-traversal (wrong in paper). For each node type (element,
 * attribute, text, comment, ...) there is a separate list.
 *
 * @param rtx {@link XdmNodeReadTrx} reference
 * @param visitor {@link LabelFMSEVisitor} used to save node type/list
 */
private void getLabels(final XdmNodeReadTrx rtx, final LabelFMSEVisitor visitor) {
    assert rtx != null;
    assert visitor != null;
    final long nodeKey = rtx.getNodeKey();
    for (final AbstractAxis axis = new PostOrderAxis(rtx); axis.hasNext(); ) {
        axis.next();
        if (axis.getTrx().getNodeKey() == nodeKey) {
            break;
        }
        axis.getTrx().acceptVisitor(visitor);
    }
    rtx.acceptVisitor(visitor);
}
Also used : PostOrderAxis(org.sirix.axis.PostOrderAxis) AbstractAxis(org.sirix.axis.AbstractAxis)

Example 7 with AbstractAxis

use of org.sirix.axis.AbstractAxis in project sirix by sirixdb.

the class XPathParser method parseAbbrevForwardStep.

/**
 * Parses the the rule AbrevForwardStep according to the following production rule:
 * <p>
 * [31] AbbrevForwardStep ::= "@"? NodeTest .
 * </p>
 *
 * @return FilterAxis
 */
private AbstractAxis parseAbbrevForwardStep() {
    AbstractAxis axis;
    boolean isAttribute;
    if (is(TokenType.AT, true) || mToken.getContent().equals("attribute") || mToken.getContent().equals("schema-attribute")) {
        // in case of .../attribute(..), or .../schema-attribute() the
        // default
        // axis
        // is the attribute axis
        axis = new AttributeAxis(getTransaction());
        isAttribute = true;
    } else {
        // default axis is the child axis
        axis = new ChildAxis(getTransaction());
        isAttribute = false;
    }
    final Filter filter = parseNodeTest(isAttribute);
    return new FilterAxis(axis, filter);
}
Also used : ChildAxis(org.sirix.axis.ChildAxis) ItemFilter(org.sirix.axis.filter.ItemFilter) AttributeFilter(org.sirix.axis.filter.AttributeFilter) NameFilter(org.sirix.axis.filter.NameFilter) TypeFilter(org.sirix.axis.filter.TypeFilter) NestedFilter(org.sirix.axis.filter.NestedFilter) DocumentRootNodeFilter(org.sirix.axis.filter.DocumentRootNodeFilter) CommentFilter(org.sirix.axis.filter.CommentFilter) WildcardFilter(org.sirix.axis.filter.WildcardFilter) PIFilter(org.sirix.axis.filter.PIFilter) SchemaElementFilter(org.sirix.service.xml.xpath.filter.SchemaElementFilter) Filter(org.sirix.api.Filter) SchemaAttributeFilter(org.sirix.service.xml.xpath.filter.SchemaAttributeFilter) TextFilter(org.sirix.axis.filter.TextFilter) ElementFilter(org.sirix.axis.filter.ElementFilter) NodeFilter(org.sirix.axis.filter.NodeFilter) AbstractAxis(org.sirix.axis.AbstractAxis) AttributeAxis(org.sirix.axis.AttributeAxis) FilterAxis(org.sirix.axis.filter.FilterAxis)

Aggregations

AbstractAxis (org.sirix.axis.AbstractAxis)7 Test (org.junit.Test)2 Filter (org.sirix.api.Filter)2 AttributeAxis (org.sirix.axis.AttributeAxis)2 ChildAxis (org.sirix.axis.ChildAxis)2 PostOrderAxis (org.sirix.axis.PostOrderAxis)2 AttributeFilter (org.sirix.axis.filter.AttributeFilter)2 CommentFilter (org.sirix.axis.filter.CommentFilter)2 DocumentRootNodeFilter (org.sirix.axis.filter.DocumentRootNodeFilter)2 ElementFilter (org.sirix.axis.filter.ElementFilter)2 ItemFilter (org.sirix.axis.filter.ItemFilter)2 NameFilter (org.sirix.axis.filter.NameFilter)2 NestedFilter (org.sirix.axis.filter.NestedFilter)2 NodeFilter (org.sirix.axis.filter.NodeFilter)2 PIFilter (org.sirix.axis.filter.PIFilter)2 TextFilter (org.sirix.axis.filter.TextFilter)2 TypeFilter (org.sirix.axis.filter.TypeFilter)2 WildcardFilter (org.sirix.axis.filter.WildcardFilter)2 SchemaAttributeFilter (org.sirix.service.xml.xpath.filter.SchemaAttributeFilter)2 SchemaElementFilter (org.sirix.service.xml.xpath.filter.SchemaElementFilter)2