Search in sources :

Example 6 with QueryNode

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

the class JoinListener method enterDirectNear.

@Override
public void enterDirectNear(AqlParser.DirectNearContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String segmentationName = getLayerName(ctx.NAMED_NEAR());
    left.addOutgoingJoin(addParsedLocation(ctx, new Near(right, 1, segmentationName)));
}
Also used : QueryNode(annis.model.QueryNode) Near(annis.sqlgen.model.Near)

Example 7 with QueryNode

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

the class JoinListener method nodeByDef.

private QueryNode nodeByDef(AqlParser.ReferenceNodeContext ctx) {
    if (ctx.VAR_DEF() == null) {
        QueryNode result = tokenPositions.get(alternativeIndex).get(ctx.variableExpr().getSourceInterval());
        if (result == null) {
            return null;
        } else {
            return result;
        }
    } else {
        String varDefText = ctx.VAR_DEF().getText();
        // remove trailing #
        varDefText = varDefText.substring(0, varDefText.length() - 1);
        return alternativeNodes.get(alternativeIndex).get(varDefText);
    }
}
Also used : QueryNode(annis.model.QueryNode)

Example 8 with QueryNode

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

the class JoinListener method enterIndirectDominance.

@Override
public void enterIndirectDominance(AqlParser.IndirectDominanceContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String layer = getLayerName(ctx.NAMED_DOMINANCE());
    left.addOutgoingJoin(addParsedLocation(ctx, new Dominance(right, layer)));
}
Also used : QueryNode(annis.model.QueryNode) RightDominance(annis.sqlgen.model.RightDominance) Dominance(annis.sqlgen.model.Dominance) LeftDominance(annis.sqlgen.model.LeftDominance)

Example 9 with QueryNode

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

the class JoinListener method enterArityTerm.

@Override
public void enterArityTerm(AqlParser.ArityTermContext ctx) {
    QueryNode target = nodeByRef(ctx.left);
    Preconditions.checkArgument(target != null, errorLHS("arity") + ": " + ctx.getText());
    target.setArity(annisRangeFromARangeSpec(ctx.rangeSpec()));
}
Also used : QueryNode(annis.model.QueryNode)

Example 10 with QueryNode

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

the class JoinListener method enterIndirectPointing.

@Override
public void enterIndirectPointing(AqlParser.IndirectPointingContext ctx) {
    QueryNode left = relationChain.get(relationIdx);
    QueryNode right = relationChain.get(relationIdx + 1);
    String label = getLayerName(ctx.POINTING(), 2);
    left.addOutgoingJoin(addParsedLocation(ctx, new PointingRelation(right, label)));
}
Also used : PointingRelation(annis.sqlgen.model.PointingRelation) 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