Search in sources :

Example 46 with QueryNode

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

the class ComponentSearchRelationNormalizer method replicateFromJoinTarget.

private void replicateFromJoinTarget(Join join, QueryNode targetNode, List<QueryNode> nodes, AtomicLong maxID) {
    QueryNode newTargetNode = new QueryNode(maxID.incrementAndGet(), targetNode, false);
    newTargetNode.setArtificial(true);
    newTargetNode.setVariable("x" + newTargetNode.getId() + "(" + targetNode.getVariable() + ")");
    newTargetNode.setThisNodeAsTarget(join);
    Identical identJoin = new Identical(newTargetNode);
    targetNode.addOutgoingJoin(identJoin);
    nodes.add(newTargetNode);
}
Also used : Identical(annis.sqlgen.model.Identical) QueryNode(annis.model.QueryNode)

Example 47 with QueryNode

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

the class ComponentSearchRelationNormalizer method createJoinMap.

private Multimap<QueryNode, Join> createJoinMap(List<QueryNode> nodes) {
    Multimap<QueryNode, Join> result = HashMultimap.create();
    for (QueryNode n : nodes) {
        for (Join j : n.getOutgoingJoins()) {
            if (j instanceof Dominance || j instanceof PointingRelation) {
                if (j.getTarget() != null) {
                    result.put(n, j);
                    result.put(j.getTarget(), j);
                }
            }
        }
    }
    return result;
}
Also used : PointingRelation(annis.sqlgen.model.PointingRelation) QueryNode(annis.model.QueryNode) Join(annis.model.Join) Dominance(annis.sqlgen.model.Dominance)

Example 48 with QueryNode

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

the class JoinListener method enterRootTerm.

@Override
public void enterRootTerm(AqlParser.RootTermContext ctx) {
    QueryNode target = nodeByRef(ctx.left);
    Preconditions.checkArgument(target != null, errorLHS("root") + ": " + ctx.getText());
    target.setRoot(true);
}
Also used : QueryNode(annis.model.QueryNode)

Example 49 with QueryNode

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

the class JoinListener method enterNotequalvalue.

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

Example 50 with QueryNode

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

the class JoinListener method enterCommonparent.

@Override
public void enterCommonparent(AqlParser.CommonparentContext 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 Sibling(right, label)));
}
Also used : QueryNode(annis.model.QueryNode) Sibling(annis.sqlgen.model.Sibling)

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