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));
}
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;
}
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);
}
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);
}
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);
}
Aggregations