Skip to content

Commit 5b33111

Browse files
committed
Add test for negated queries
1 parent ec7a3ab commit 5b33111

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

  • graphannis/src/annis/db/aql

graphannis/src/annis/db/aql/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,4 +685,25 @@ mod tests {
685685
let it = execute_query_on_graph(&graph, &query, true, None).unwrap();
686686
assert_eq!(11, it.count());
687687
}
688+
689+
#[test]
690+
fn query_on_annotation_graph_with_negation() {
691+
let cargo_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
692+
let input_file = File::open(&cargo_dir.join("tests/SaltSampleCorpus.graphml")).unwrap();
693+
let (graph, _config_str): (AnnotationGraph, _) =
694+
graphannis_core::graph::serialization::graphml::import(input_file, false, |_status| {})
695+
.unwrap();
696+
697+
let query = parse("tok? !. tok", false).unwrap();
698+
let it = execute_query_on_graph(&graph, &query, true, None).unwrap();
699+
700+
let matches: Result<Vec<_>> = it.collect();
701+
let matches = matches.unwrap();
702+
assert_eq!(4, matches.len());
703+
// The match should not have 2 two nodes, but only one nde
704+
assert_eq!(1, matches[0].len());
705+
assert_eq!(1, matches[1].len());
706+
assert_eq!(1, matches[2].len());
707+
assert_eq!(1, matches[3].len());
708+
}
688709
}

0 commit comments

Comments
 (0)