use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForNodeDirectDominance.
/**
* WHERE conditions for direct dominance operator (>).
*/
@Theory
public void shouldGenerateWhereConditionsForNodeDirectDominance(String componentPredicate) {
// given
node23.addOutgoingJoin(new Dominance(node42, 1));
// then
checkEdgeConditions(componentPredicate, "d", null, false, join("=", "_rank23.id", "_rank42.parent"));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForIndirectDominance.
/**
* WHERE conditions for indirect dominance (>*).
*/
@Theory
public void shouldGenerateWhereConditionsForIndirectDominance(String componentPredicate) {
// given
node23.addOutgoingJoin(new Dominance(node42));
// then
checkEdgeConditions(componentPredicate, "d", null, true, join("<", "_rank23.pre", "_rank42.pre"), join("<", "_rank42.pre", "_rank23.post"));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForRangedDominance.
/**
* WHERE conditions for ranged dominance (>n,m).
*/
@Theory
public void shouldGenerateWhereConditionsForRangedDominance(String componentPredicate) {
// given
int min = uniqueInt(1, 10);
int max = min + uniqueInt(1, 10);
node23.addOutgoingJoin(new Dominance(node42, min, max));
// then
checkEdgeConditions(componentPredicate, "d", null, true, join("<", "_rank23.pre", "_rank42.pre"), join("<", "_rank42.pre", "_rank23.post"), between("_rank23.level", "_rank42.level", -min, -max));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method shouldGenerateWhereConditionsForExactDominance.
/**
* WHERE conditions for exact dominance (>n).
*/
@Theory
public void shouldGenerateWhereConditionsForExactDominance(String componentPredicate) {
// given
int distance = uniqueInt();
node23.addOutgoingJoin(new Dominance(node42, distance));
// then
checkEdgeConditions(componentPredicate, "d", null, true, join("<", "_rank23.pre", "_rank42.pre"), join("<", "_rank42.pre", "_rank23.post"), numberJoin("=", "_rank23.level", "_rank42.level", -distance));
}
use of annis.sqlgen.model.Dominance in project ANNIS by korpling.
the class TestDefaultWhereClauseGenerator method whereClauseForNodeEdgeAnnotation.
// WHERE condition for node annotation
@Test
public void whereClauseForNodeEdgeAnnotation() {
Dominance j = new Dominance(node23);
j.addEdgeAnnotation(new QueryAnnotation("namespace1", "name1"));
j.addEdgeAnnotation(new QueryAnnotation("namespace2", "name2", "value2", TextMatching.EXACT_EQUAL));
j.addEdgeAnnotation(new QueryAnnotation("namespace3", "name3", "value3", TextMatching.REGEXP_EQUAL));
node42.addOutgoingJoin(j);
checkWhereConditions("_rank_annotation23_1.qannotext LIKE 'namespace1:name1:%'", "_rank_annotation23_2.qannotext LIKE 'namespace2:name2:value2'", "_rank_annotation23_3.qannotext ~ '^(namespace3:name3:(value3))$'");
}
Aggregations