MCPcopy Create free account
hub / github.com/comnik/declarative-dataflow / main

Function main

experiments/src/bin/labelprop.rs:17–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15use Value::Eid;
16
17fn main() {
18 timely::execute(Configuration::Thread, move |worker| {
19 let mut server = Server::<Duration, u64>::new(Default::default());
20 let (send_results, results) = channel();
21
22 let (x, y, z) = (0, 1, 2);
23 let rules = vec![
24 Rule {
25 name: "label".to_string(),
26 plan: Plan::Union(Union {
27 variables: vec![x, y],
28 plans: vec![
29 Plan::MatchA(x, ":node".to_string(), y),
30 Plan::Join(Join {
31 variables: vec![z],
32 left_plan: Box::new(Plan::MatchA(z, ":edge".to_string(), y)),
33 right_plan: Box::new(Plan::NameExpr(vec![x, z], "label".to_string())),
34 }),
35 ],
36 }),
37 },
38 Rule {
39 name: "labelprop".to_string(),
40 plan: Plan::NameExpr(vec![x, y], "label".to_string()),
41 // plan: Plan::Aggregate(Aggregate {
42 // variables: vec![x, y],
43 // key_variables: vec![],
44 // plan: Box::new(Plan::NameExpr(vec![x, y], "label".to_string())),
45 // aggregation_fn: AggregationFn::COUNT
46 // })
47 },
48 ];
49
50 let edge_source = Source::CsvFile(CsvFile {
51 has_headers: false,
52 delimiter: b' ',
53 path: "/Users/niko/data/labelprop/edges.httpd_df".to_string(),
54 eid_offset: 0,
55 timestamp_offset: None,
56 flexible: false,
57 comment: None,
58 schema: vec![(":edge".to_string(), (1, Eid(0)))],
59 });
60 let node_source = Source::CsvFile(CsvFile {
61 has_headers: false,
62 delimiter: b' ',
63 path: "/Users/niko/data/labelprop/nodes.httpd_df".to_string(),
64 eid_offset: 0,
65 timestamp_offset: None,
66 flexible: false,
67 comment: None,
68 schema: vec![(":node".to_string(), (1, Eid(0)))],
69 });
70
71 worker.dataflow::<Duration, _, _>(|scope| {
72 server.register_source(edge_source, scope).unwrap();
73 server.register_source(node_source, scope).unwrap();
74

Callers

nothing calls this directly

Calls 5

register_sourceMethod · 0.80
registerMethod · 0.80
interestMethod · 0.80
countMethod · 0.80
CsvFileClass · 0.50

Tested by

no test coverage detected