Search in sources :

Example 1 with PredicateFilterAxis

use of org.sirix.axis.filter.PredicateFilterAxis in project sirix by sirixdb.

the class PipelineBuilder method addPredicate.

/**
 * Adds a predicate to the pipeline.
 *
 * @param pRtx transaction to operate with
 */
public void addPredicate(final XdmNodeReadTrx pRtx) {
    assert getPipeStack().size() >= 2;
    final Axis predicate = getPipeStack().pop().getExpr();
    if (predicate instanceof LiteralExpr) {
        predicate.hasNext();
        // if is numeric literal -> abbrev for position()
        final int type = pRtx.getTypeKey();
        if (type == pRtx.keyForName("xs:integer") || type == pRtx.keyForName("xs:double") || type == pRtx.keyForName("xs:float") || type == pRtx.keyForName("xs:decimal")) {
            throw new IllegalStateException("function fn:position() is not implemented yet.");
        // getExpression().add(
        // new PosFilter(transaction, (int)
        // Double.parseDouble(transaction
        // .getValue())));
        // return; // TODO: YES! it is dirty!
        // AtomicValue pos =
        // new AtomicValue(mTransaction.getItem().getRawValue(),
        // mTransaction
        // .keyForName("xs:integer"));
        // long position = mTransaction.getItemList().addItem(pos);
        // mPredicate.reset(mTransaction.getItem().getKey());
        // IAxis function =
        // new FNPosition(mTransaction, new ArrayList<IAxis>(),
        // FuncDef.POS.getMin(), FuncDef.POS
        // .getMax(),
        // mTransaction.keyForName(FuncDef.POS.getReturnType()));
        // IAxis expectedPos = new LiteralExpr(mTransaction, position);
        // 
        // mPredicate = new ValueComp(mTransaction, function,
        // expectedPos, CompKind.EQ);
        }
    }
    getExpression().add(new PredicateFilterAxis(pRtx, predicate));
}
Also used : LiteralExpr(org.sirix.service.xml.xpath.expr.LiteralExpr) ModOpAxis(org.sirix.service.xml.xpath.operators.ModOpAxis) RangeAxis(org.sirix.service.xml.xpath.expr.RangeAxis) AddOpAxis(org.sirix.service.xml.xpath.operators.AddOpAxis) ExceptAxis(org.sirix.service.xml.xpath.expr.ExceptAxis) Axis(org.sirix.api.Axis) MulOpAxis(org.sirix.service.xml.xpath.operators.MulOpAxis) UnionAxis(org.sirix.service.xml.xpath.expr.UnionAxis) IfAxis(org.sirix.service.xml.xpath.expr.IfAxis) IntersectAxis(org.sirix.service.xml.xpath.expr.IntersectAxis) IDivOpAxis(org.sirix.service.xml.xpath.operators.IDivOpAxis) DupFilterAxis(org.sirix.service.xml.xpath.filter.DupFilterAxis) PredicateFilterAxis(org.sirix.axis.filter.PredicateFilterAxis) VariableAxis(org.sirix.service.xml.xpath.expr.VariableAxis) ForAxis(org.sirix.axis.ForAxis) SequenceAxis(org.sirix.service.xml.xpath.expr.SequenceAxis) FilterAxis(org.sirix.axis.filter.FilterAxis) SubOpAxis(org.sirix.service.xml.xpath.operators.SubOpAxis) DivOpAxis(org.sirix.service.xml.xpath.operators.DivOpAxis) PredicateFilterAxis(org.sirix.axis.filter.PredicateFilterAxis)

Aggregations

Axis (org.sirix.api.Axis)1 ForAxis (org.sirix.axis.ForAxis)1 FilterAxis (org.sirix.axis.filter.FilterAxis)1 PredicateFilterAxis (org.sirix.axis.filter.PredicateFilterAxis)1 ExceptAxis (org.sirix.service.xml.xpath.expr.ExceptAxis)1 IfAxis (org.sirix.service.xml.xpath.expr.IfAxis)1 IntersectAxis (org.sirix.service.xml.xpath.expr.IntersectAxis)1 LiteralExpr (org.sirix.service.xml.xpath.expr.LiteralExpr)1 RangeAxis (org.sirix.service.xml.xpath.expr.RangeAxis)1 SequenceAxis (org.sirix.service.xml.xpath.expr.SequenceAxis)1 UnionAxis (org.sirix.service.xml.xpath.expr.UnionAxis)1 VariableAxis (org.sirix.service.xml.xpath.expr.VariableAxis)1 DupFilterAxis (org.sirix.service.xml.xpath.filter.DupFilterAxis)1 AddOpAxis (org.sirix.service.xml.xpath.operators.AddOpAxis)1 DivOpAxis (org.sirix.service.xml.xpath.operators.DivOpAxis)1 IDivOpAxis (org.sirix.service.xml.xpath.operators.IDivOpAxis)1 ModOpAxis (org.sirix.service.xml.xpath.operators.ModOpAxis)1 MulOpAxis (org.sirix.service.xml.xpath.operators.MulOpAxis)1 SubOpAxis (org.sirix.service.xml.xpath.operators.SubOpAxis)1