Search in sources :

Example 56 with QueryNode

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

the class QueryNodeListener method enterTextOnly.

@Override
public void enterTextOnly(AqlParser.TextOnlyContext ctx) {
    QueryNode target = newNode(ctx);
    target.setSpannedText(textFromSpec(ctx.txt), textMatchingFromSpec(ctx.txt, false));
}
Also used : QueryNode(annis.model.QueryNode)

Example 57 with QueryNode

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

the class QueryNodeListener method newNode.

private QueryNode newNode(ParserRuleContext ctx) {
    Long existingID = nodeIntervalToID.get(ctx.getSourceInterval());
    if (existingID == null) {
        throw new IllegalStateException("Could not find a node ID for interval " + ctx.getSourceInterval().toString());
    }
    QueryNode n = new QueryNode(existingID);
    if (lastVariableDefinition == null) {
        n.setVariable("" + n.getId());
    } else {
        n.setVariable(lastVariableDefinition);
    }
    lastVariableDefinition = null;
    n.setParseLocation(AnnisParserAntlr.getLocation(ctx.getStart(), ctx.getStop()));
    currentAlternative.put(existingID, n);
    localNodes.put(n.getVariable(), n);
    currentTokenPosition.put(ctx.getSourceInterval(), n);
    return n;
}
Also used : QueryNode(annis.model.QueryNode)

Example 58 with QueryNode

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

the class QueryNodeListener method enterAnnoOnlyExpr.

@Override
public void enterAnnoOnlyExpr(AqlParser.AnnoOnlyExprContext ctx) {
    QueryNode target = newNode(ctx);
    String namespace = ctx.qName().namespace == null ? null : ctx.qName().namespace.getText();
    QueryAnnotation anno = new QueryAnnotation(namespace, ctx.qName().name.getText());
    target.addNodeAnnotation(anno);
}
Also used : QueryNode(annis.model.QueryNode) QueryAnnotation(annis.model.QueryAnnotation)

Example 59 with QueryNode

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

the class QueryNodeListener method enterAnnoEqTextExpr.

@Override
public void enterAnnoEqTextExpr(AqlParser.AnnoEqTextExprContext ctx) {
    QueryNode target = newNode(ctx);
    String namespace = ctx.qName().namespace == null ? null : ctx.qName().namespace.getText();
    String name = ctx.qName().name.getText();
    String value = textFromSpec(ctx.txt);
    QueryNode.TextMatching matching = textMatchingFromSpec(ctx.txt, ctx.NEQ() != null);
    QueryAnnotation anno = new QueryAnnotation(namespace, name, value, matching);
    target.addNodeAnnotation(anno);
}
Also used : QueryNode(annis.model.QueryNode) QueryAnnotation(annis.model.QueryAnnotation)

Example 60 with QueryNode

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

the class QueryNodeListener method enterTokTextExpr.

@Override
public void enterTokTextExpr(AqlParser.TokTextExprContext ctx) {
    QueryNode target = newNode(ctx);
    target.setToken(true);
    QueryNode.TextMatching txtMatch = textMatchingFromSpec(ctx.textSpec(), ctx.NEQ() != null);
    String content = textFromSpec(ctx.textSpec());
    target.setSpannedText(content, txtMatch);
}
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