MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_query_parser

Function test_query_parser

src/cosql/query.rs:47–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46 #[test]
47 fn test_query_parser() {
48 // the `parse_query` function assumes the `match` part is already consumed
49 let values = [
50 (
51 "
52 $employee1 isa person (
53 name: $name1
54 ),
55 $employee2 isa person (
56 name: $name2
57 ),
58 $project isa project (
59 name: $project_name
60 ),
61 ($employee1, $project) forms assigned_to,
62 ($employee2, $project) forms assigned_to,
63 $employee1 != $employee2
64 get $name1, $name2, $project_name;",
65 Query {
66 patterns: vec![
67 Pattern::EntityPattern(EntityPattern {
68 variable: "employee1".to_string(),
69 entity_type: "person".to_string(),
70 attributes: vec![Attribute {
71 name: "name".to_string(),
72 value: Value::Variable("name1".to_string()),
73 }],
74 }),
75 Pattern::EntityPattern(EntityPattern {
76 variable: "employee2".to_string(),
77 entity_type: "person".to_string(),
78 attributes: vec![Attribute {
79 name: "name".to_string(),
80 value: Value::Variable("name2".to_string()),
81 }],
82 }),
83 Pattern::EntityPattern(EntityPattern {
84 variable: "project".to_string(),
85 entity_type: "project".to_string(),
86 attributes: vec![Attribute {
87 name: "name".to_string(),
88 value: Value::Variable("project_name".to_string()),
89 }],
90 }),
91 Pattern::RelationshipPattern(RelationshipPattern {
92 variable: None,
93 roles: vec![
94 Role {
95 role: None,
96 entity: "employee1".to_string(),
97 },
98 Role {
99 role: None,
100 entity: "project".to_string(),
101 },
102 ],
103 relationship_type: "assigned_to".to_string(),
104 attributes: vec![],

Callers

nothing calls this directly

Calls 1

parse_queryFunction · 0.85

Tested by

no test coverage detected