use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class JoinListener method enterDirectDominance.
@Override
public void enterDirectDominance(AqlParser.DirectDominanceContext ctx) {
QueryNode left = relationChain.get(relationIdx);
QueryNode right = relationChain.get(relationIdx + 1);
String layer = getLayerName(ctx.NAMED_DOMINANCE());
Join j;
if (ctx.LEFT_CHILD() != null) {
j = new LeftDominance(right, layer);
} else if (ctx.RIGHT_CHILD() != null) {
j = new RightDominance(right, layer);
} else {
j = new Dominance(right, layer, 1);
}
left.addOutgoingJoin(addParsedLocation(ctx, j));
if (ctx.anno != null) {
LinkedList<QueryAnnotation> annotations = fromRelationAnnotation(ctx.anno);
for (QueryAnnotation a : annotations) {
j.addEdgeAnnotation(a);
}
}
}
use of annis.sqlgen.model.Dominance 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)));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForNodeNamedDirectDominance.
/**
* WHERE conditions for named direct dominance operator (> name).
*/
@Theory
public void shouldGenerateWhereConditionsForNodeNamedDirectDominance(String componentPredicate) {
// given
String componentName = uniqueString();
node23.addOutgoingJoin(new Dominance(node42, componentName, 1));
// then
checkEdgeConditions(componentPredicate, "d", componentName, false, join("=", "_rank23.id", "_rank42.parent"));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method whereClauseForNodeEdgeAnnotationNot.
@Test
public void whereClauseForNodeEdgeAnnotationNot() {
Dominance j = new Dominance(node23);
j.addEdgeAnnotation(new QueryAnnotation("namespace2", "name2", "value2", TextMatching.EXACT_NOT_EQUAL));
j.addEdgeAnnotation(new QueryAnnotation("namespace3", "name3", "value3", TextMatching.REGEXP_NOT_EQUAL));
node42.addOutgoingJoin(j);
checkWhereConditions("_rank_annotation23_1.qannotext NOT LIKE 'namespace2:name2:value2'", "_rank_annotation23_1.qannotext LIKE 'namespace2:name2:%'", "_rank_annotation23_2.qannotext !~ '^(namespace3:name3:(value3))$'", "_rank_annotation23_2.qannotext LIKE 'namespace3:name3:%'");
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForNamedAndAnnotatedDirectDominance.
/**
* WHERE conditions for annotated named direct dominance (> name
* [annotation]).
*/
@Theory
public void shouldGenerateWhereConditionsForNamedAndAnnotatedDirectDominance(String componentPredicate) {
// given
String componentName = uniqueString();
Join j = new Dominance(node42, componentName, 1);
node23.addOutgoingJoin(j);
j.addEdgeAnnotation(new QueryAnnotation("namespace3", "name3", "value3", TextMatching.REGEXP_EQUAL));
// then
checkEdgeConditions(componentPredicate, "d", componentName, false, join("=", "_rank23.id", "_rank42.parent"));
checkWhereConditions(node42, "_rank_annotation42.qannotext ~ '^(namespace3:name3:(value3))$'");
}
Aggregations