use of annis.model.QueryNode in project ANNIS by korpling.
the class JoinListener method enterRangeNear.
@Override
public void enterRangeNear(AqlParser.RangeNearContext ctx) {
QueryNode left = relationChain.get(relationIdx);
QueryNode right = relationChain.get(relationIdx + 1);
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");
} else {
String segmentationName = getLayerName(ctx.NAMED_NEAR());
left.addOutgoingJoin(addParsedLocation(ctx, new Near(right, range.getMin(), range.getMax(), segmentationName)));
}
}
use of annis.model.QueryNode in project ANNIS by korpling.
the class JoinListener method enterRangeDominance.
@Override
public void enterRangeDominance(AqlParser.RangeDominanceContext ctx) {
QueryNode left = relationChain.get(relationIdx);
QueryNode right = relationChain.get(relationIdx + 1);
String layer = getLayerName(ctx.NAMED_DOMINANCE());
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 Dominance(right, layer, range.getMin(), range.getMax())));
}
use of annis.model.QueryNode in project ANNIS by korpling.
the class JoinListener method enterBindingRelation.
@Override
public void enterBindingRelation(AqlParser.BindingRelationContext ctx) {
int numOfReferences = ctx.refOrNode().size();
relationIdx = 0;
relationChain.clear();
relationChain.ensureCapacity(numOfReferences);
for (int i = 0; i < numOfReferences; i++) {
QueryNode n = node(ctx.refOrNode(i));
if (n == null) {
throw new AnnisQLSemanticsException(AnnisParserAntlr.getLocation(ctx.getStart(), ctx.getStop()), "invalid reference to '" + ctx.refOrNode(i).getText() + "'");
}
relationChain.add(i, n);
}
}
use of annis.model.QueryNode in project ANNIS by korpling.
the class JoinListener method enterIndirectNear.
@Override
public void enterIndirectNear(AqlParser.IndirectNearContext ctx) {
QueryNode left = relationChain.get(relationIdx);
QueryNode right = relationChain.get(relationIdx + 1);
String segmentationName = getLayerName(ctx.NAMED_NEAR());
if (precedenceBound > 0) {
left.addOutgoingJoin(addParsedLocation(ctx, new Near(right, 1, precedenceBound, segmentationName)));
} else {
left.addOutgoingJoin(addParsedLocation(ctx, new Near(right, segmentationName)));
}
}
use of annis.model.QueryNode in project ANNIS by korpling.
the class JoinListener method enterDirectPointing.
@Override
public void enterDirectPointing(AqlParser.DirectPointingContext ctx) {
QueryNode left = relationChain.get(relationIdx);
QueryNode right = relationChain.get(relationIdx + 1);
String label = getLayerName(ctx.POINTING(), 2);
Join j = new PointingRelation(right, label, 1);
if (ctx.anno != null) {
LinkedList<QueryAnnotation> annotations = fromRelationAnnotation(ctx.anno);
for (QueryAnnotation a : annotations) {
j.addEdgeAnnotation(a);
}
}
left.addOutgoingJoin(addParsedLocation(ctx, j));
}
Aggregations