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

Function test_inference_parser

src/cosql/inference/mod.rs:49–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47
48 #[test]
49 fn test_inference_parser() {
50 let values = [
51 (
52 r#"$person1 isa person (
53 name: $name,
54 age: 18,
55 gender: "M"
56 )"#,
57 Inference::EntityInference(EntityInference {
58 variable: "person1".to_string(),
59 entity_type: "person".to_string(),
60 attributes: vec![
61 Attribute {
62 name: "name".to_string(),
63 value: Value::Variable("name".to_string()),
64 },
65 Attribute {
66 name: "age".to_string(),
67 value: Value::Int(18),
68 },
69 Attribute {
70 name: "gender".to_string(),
71 value: Value::String("M".to_string()),
72 },
73 ],
74 }),
75 ),
76 (
77 r#"$city1 isa city (
78 name: "New York"
79 )"#,
80 Inference::EntityInference(EntityInference {
81 variable: "city1".to_string(),
82 entity_type: "city".to_string(),
83 attributes: vec![Attribute {
84 name: "name".to_string(),
85 value: Value::String("New York".to_string()),
86 }],
87 }),
88 ),
89 (
90 "(
91 $person1,
92 $company1
93 ) forms works_in (
94 since: 2-10-1999
95 )",
96 Inference::RelationshipInference(RelationshipInference {
97 roles: vec![
98 Role {
99 role: None,
100 entity: "person1".to_string(),
101 },
102 Role {
103 role: None,
104 entity: "company1".to_string(),
105 },
106 ],

Callers

nothing calls this directly

Calls 4

EntityInferenceClass · 0.85
parse_inferenceFunction · 0.85

Tested by

no test coverage detected