Search in sources :

Example 16 with QueryNode

use of annis.model.QueryNode in project ANNIS by korpling.

the class JoinListener method enterCommonancestor.

@Override
public void enterCommonancestor(AqlParser.CommonancestorContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String label = ctx.label == null ? null : ctx.label.getText();
    left.addOutgoingJoin(addParsedLocation(ctx, new CommonAncestor(right, label)));
}
Also used : CommonAncestor(annis.sqlgen.model.CommonAncestor) QueryNode(annis.model.QueryNode)

Example 17 with QueryNode

use of annis.model.QueryNode in project ANNIS by korpling.

the class JoinListener method enterDirectPrecedence.

@Override
public void enterDirectPrecedence(AqlParser.DirectPrecedenceContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String segmentationName = null;
    if (ctx.NAMED_PRECEDENCE() != null) {
        segmentationName = ctx.NAMED_PRECEDENCE().getText().substring(1);
    }
    left.addOutgoingJoin(addParsedLocation(ctx, new Precedence(right, 1, segmentationName)));
}
Also used : QueryNode(annis.model.QueryNode) Precedence(annis.sqlgen.model.Precedence)

Example 18 with QueryNode

use of annis.model.QueryNode in project ANNIS by korpling.

the class JoinListener method enterEqualvalue.

@Override
public void enterEqualvalue(AqlParser.EqualvalueContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    left.addOutgoingJoin(addParsedLocation(ctx, new EqualValue(right)));
}
Also used : QueryNode(annis.model.QueryNode) EqualValue(annis.sqlgen.model.EqualValue) NotEqualValue(annis.sqlgen.model.NotEqualValue)

Example 19 with QueryNode

use of annis.model.QueryNode in project ANNIS by korpling.

the class JoinListener method enterRangePointing.

@Override
public void enterRangePointing(AqlParser.RangePointingContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String label = getLayerName(ctx.POINTING(), 2);
    QueryNode.Range range = annisRangeFromARangeSpec(ctx.rangeSpec());
    if (range.getMin() == 0 || range.getMax() == 0) {
        throw new AnnisQLSemanticsException(AnnisParserAntlr.getLocation(ctx.getStart(), ctx.getStop()), "Distance can't be 0");
    } else if (range.getMin() > range.getMax()) {
        throw new AnnisQLSemanticsException(AnnisParserAntlr.getLocation(ctx.getStart(), ctx.getStop()), "Minimal distance can't be larger than maximal distance");
    }
    left.addOutgoingJoin(addParsedLocation(ctx, new PointingRelation(right, label, range.getMin(), range.getMax())));
}
Also used : PointingRelation(annis.sqlgen.model.PointingRelation) QueryNode(annis.model.QueryNode) AnnisQLSemanticsException(annis.exceptions.AnnisQLSemanticsException)

Example 20 with QueryNode

use of annis.model.QueryNode in project ANNIS by korpling.

the class QueryNodeListener method enterTokOnlyExpr.

@Override
public void enterTokOnlyExpr(AqlParser.TokOnlyExprContext ctx) {
    QueryNode target = newNode(ctx);
    target.setToken(true);
}
Also used : QueryNode(annis.model.QueryNode)

Aggregations

QueryNode (annis.model.QueryNode)67 Join (annis.model.Join)12 LinkedList (java.util.LinkedList)11 AnnisQLSemanticsException (annis.exceptions.AnnisQLSemanticsException)10 ArrayList (java.util.ArrayList)8 QueryAnnotation (annis.model.QueryAnnotation)7 Precedence (annis.sqlgen.model.Precedence)7 HashMap (java.util.HashMap)6 HashSet (java.util.HashSet)6 Dominance (annis.sqlgen.model.Dominance)5 PointingRelation (annis.sqlgen.model.PointingRelation)5 TestUtils.uniqueString (annis.test.TestUtils.uniqueString)5 TreeSet (java.util.TreeSet)5 Test (org.junit.Test)5 Identical (annis.sqlgen.model.Identical)4 LeftDominance (annis.sqlgen.model.LeftDominance)4 Near (annis.sqlgen.model.Near)4 RightDominance (annis.sqlgen.model.RightDominance)4 TestUtils.uniqueLong (annis.test.TestUtils.uniqueLong)4 QueryData (annis.ql.parser.QueryData)3