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

Function main

org/src/cosql.rs:711–764  ·  view source on GitHub ↗

Test the parser

()

Source from the content-addressed store, hash-verified

709
710// Test the parser
711fn main() {
712 let input = r#"
713 define entity person as
714 name: string,
715 age: int,
716 email: string;
717
718 define relationship works_in as
719 (employee: person, department: department);
720
721 insert $john isa person (
722 name: "John Doe",
723 age: 30,
724 email: "john@example.com"
725 );
726
727 insert $job1 (
728 employee: $john,
729 department: $tech_dept
730 ) forms works_in;
731
732 match
733 $person isa person (name: $name, age: $age),
734 $age > 25
735 get $name;
736
737 define rule infer_senior_employee as
738 match
739 $employee isa person (
740 name: $name,
741 hire_date: $hire_date
742 ),
743 ($employee, $company) forms employment (
744 role: $role
745 )
746
747 infer derive
748 extend $employee (
749 seniority: "Senior"
750 ),
751 ($employee, $company) forms senior_role (
752 role: $role
753 );
754 "#;
755
756 match parse_cos_graph_query(input) {
757 Ok((_, queries)) => {
758 for query in queries {
759 println!("{:#?}", query);
760 }
761 }
762 Err(e) => println!("Error: {:?}", e),
763 }
764}

Callers

nothing calls this directly

Calls 1

parse_cos_graph_queryFunction · 0.85

Tested by

no test coverage detected