Changeset: 9f61a80042c6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9f61a80042c6
Modified Files:
        monetdb5/extras/jaql/expand.mal
        monetdb5/extras/jaql/filter.mal
        monetdb5/extras/jaql/jaqltest.mal
        monetdb5/extras/jaql/transform.mal
Branch: jacqueline
Log Message:

Remove case studies and working test files


diffs (241 lines):

diff --git a/monetdb5/extras/jaql/expand.mal b/monetdb5/extras/jaql/expand.mal
deleted file mode 100644
--- a/monetdb5/extras/jaql/expand.mal
+++ /dev/null
@@ -1,73 +0,0 @@
-# [ [3,65,8,72], [5,98,2,65] ] -> expand each arr
-# '[ [3,65,8,72], [5,98,2,65] ]' | as arr -> expand: arr => <result>
-# j_json( [ [3,65,8,72], [5,98,2,65] ] ) j_expand( j_var( arr ) , j_var( arr ) 
) j_output()
-
-include json;
-out := io.stdout();
-
-# j_json( [ [3,65,8,72], [5,98,2,65] ] )
-(x1,x2,x3,x4,x5,x6,x7) := json.shred("[ [3,65,8,72], [5,98,2,65,[]] ]");
-json.print(out, x1,x2,x3,x4,x5,x6,x7);
-
-# j_var( arr )
-o4 := algebra.selectH(x1, 0@0); # semantic: first is outermost array
-o0 := algebra.semijoin(x5, o4);
-o2 := bat.reverse(o0);
-o1 := algebra.semijoin(x1, o2);
-
-# j_var( arr )
-o3 := algebra.uselect(o1, 'a'); # ids from elems (all arrays match)
-
-# j_expand( o1 , o3 )
-# construct json with these elements in the outermost array
-o6 := algebra.semijoin(x5, o3);
-o7 := algebra.project(0@0, o6); # semantic: first is outermost array
-# remove nested arrays, collapse all of their content to top-level array
-o8 := algebra.sunion(o0, o6);
-o9 := algebra.sdifference(x5, o8);
-o5 := bat.insert(o9, o7);
-
-# j_output()
-out := io.stdout();
-json.print(out, x1,x2,x3,x4,o5,x6,x7);
-
-
-# [ {"name":"Jon Doe", "movie_ids":[3,65,8,72]}, {"name":"Jane Dean", 
"movie_ids":[5,98,2]} ] -> expand $.movie_ids;
-# jaql.x("[ {\"name\":\"Jon Doe\", \"movie_ids\":[3,65,8,72]}, 
{\"name\":\"Jane Dean\",\"movie_ids\":[5,98,2]} ] -> expand $.movie_ids;");
-# [ {"name":"Jon Doe", "movie_ids":[3,65,8,72]}, {"name":"Jane 
Dean","movie_ids":[5,98,2]} ] as $ -> expand: $.movie_ids => <result>
-# j_json( [ {"name":"Jon Doe", "movie_ids":[3,65,8,72]}, {"name":"Jane 
Dean","movie_ids":[5,98,2]} ] ) j_expand( j_var( $ ) , j_var( $. j_var( 
movie_ids ) ) ) j_output()
-
-# j_json( [ {"name":"Jon Doe", "movie_ids":[3,65,8,72]}, {"name":"Jane Dean", 
"movie_ids":[5,98,2]} ] )
-(x1,x2,x3,x4,x5,x6,x7) := json.shred("[ {\"name\":\"Jon Doe\", 
\"movie_ids\":[3,65,8,72]}, {\"name\":\"Jane Dean\",\"movie_ids\":[5,98,2]} ] 
-> expand $.movie_ids;");
-json.print(out, x1,x2,x3,x4,x5,x6,x7);
-
-# j_var( arr )
-o4 := algebra.selectH(x1, 0@0); # semantic: first is outermost array
-o0 := algebra.semijoin(x5, o4);
-o2 := bat.reverse(o0);
-o1 := algebra.semijoin(x1, o2);
-# = identical
-
-# j_var( $. j_var( movie_ids ) )
-# semantic: deref means object
-f0 := algebra.uselect(o1, 'o');
-f1 := algebra.semijoin(x6, f0);
-f2 := bat.reverse(f1);
-f3 := algebra.semijoin(x7, f2);
-f4 := algebra.uselect(f3, "movie_ids");
-f5 := algebra.semijoin(x1, f4);
-o3 := algebra.uselect(f5, 'a');  # only arrays match
-# = produces elems from x1 (identical interface)
-
-# j_expand( o1 , o3 )
-# construct json with these elements in the outermost array
-o6 := algebra.semijoin(x5, o3);
-o7 := algebra.project(0@0, o6); # semantic: first is outermost array
-# remove nested arrays, collapse all of their content to top-level array
-o8 := algebra.sunion(o0, o6);
-o9 := algebra.sdifference(x5, o8);
-o5 := bat.insert(o9, o7);
-# = identical
-
-# j_output()
-json.print(out, x1,x2,x3,x4,o5,x6,x7);
diff --git a/monetdb5/extras/jaql/filter.mal b/monetdb5/extras/jaql/filter.mal
deleted file mode 100644
--- a/monetdb5/extras/jaql/filter.mal
+++ /dev/null
@@ -1,47 +0,0 @@
-# [ {id:1, dept:1, income:12000},{id:2, dept:1, income:13000} ] -> filter 
$.dept == 1;
-# [ {id:1, dept:1, income:12000},{id:2, dept:1, income:13000} ] as $ -> 
filter: $.dept == 1 => <result>
-# j_json( [ {id:1, dept:1, income:12000},{id:2, dept:1, income:13000} ] ) 
j_filter( j_var( $ ) , j_pred( j_var( $. j_var( dept ) ) , == , 1 ) ) j_output()
-
-
-include json;
-
-# j_json( [ {id:1, dept:1, income:12000},{id:2, dept:2, income:13000} ] ) = x0
-(x1,x2,x3,x4,x5,x6,x7) := json.shred("[ {\"id\":1, \"dept\":1, 
\"income\":12000},{\"id\":2, \"dept\":2, \"income\":13000} ]");
-
-# j_var( $ ) over x0
-o9 := algebra.selectH(x1, 0@0);
-o0 := algebra.semijoin(x5, o9);
-o2 := bat.reverse(o0);
-o1 := algebra.semijoin(x1, o2);
-
-# j_var( $. j_var( dept ) -- deref must be object
-# (usage of var should be semantic check)
-o4 := algebra.select(o1, 'o');
-v0 := algebra.semijoin(x6, o4);
-v1 := bat.reverse(v0);
-n0 := algebra.semijoin(x7, v1);
-n1 := algebra.uselect(n0, "dept");
-n2 := algebra.semijoin(v1, n1);
-v2 := bat.reverse(n2);  # ids from elems that have matching "dept"
-
-# j_pred( n1 , == , 1 )
-# semantic: we request 1 (int), so only look in integers, probably too
-# limited
-i0 := algebra.semijoin(x3, n1);
-i1 := algebra.uselect(i0, 1:lng);  # argument
-n3 := algebra.semijoin(v1, i1);
-v3 := bat.reverse(n3);  # ids from elems that have matching "dept == 1"
-
-# j_filter( o1 , i1 ) = x9
-# filter operates on object here, so can simply remove all objects that
-# don't match from the array
-o5 := bat.reverse(o0);
-o6 := algebra.kdifference(o5, v3);
-o7 := bat.reverse(o6);
-o8 := algebra.difference(x5, o7);
-# construct result by replacing the original x5 with o8
-x5 := o8;
-
-# j_output()
-out := io.stdout();
-json.print(out, x1,x2,x3,x4,x5,x6,x7);
diff --git a/monetdb5/extras/jaql/jaqltest.mal 
b/monetdb5/extras/jaql/jaqltest.mal
deleted file mode 100644
--- a/monetdb5/extras/jaql/jaqltest.mal
+++ /dev/null
@@ -1,26 +0,0 @@
-include json;
-include jaql;
-
-#jaql.x("{}");
-io.print("1");
-jaql.x("A = B;");
-io.print("2a");
-jaql.x("test -> filter $.mgr;");
-io.print("2b");
-jaql.x("test -> filter each emp emp.mgr;");
-io.print("3");
-jaql.x("e -> filter $.mgr or $.income > 30000;");
-io.print("4");
-jaql.x("emps = [ {id:1, dept:1, income:12000},{id:2, dept:1, income:13000} 
];");
-io.print("5");
-jaql.x("[ {id:1, dept:1, income:12000},{id:2, dept:1, income:13000} ] -> 
filter $.dept == 1;");
-io.print("6");
-jaql.x("[ 1, 2, 3 ] -> transform {\"value\":$};");
-io.print("7");
-jaql.x("[ [3,65,8,72], [5,98,2,65] ] -> expand each arr;");
-io.print("8");
-jaql.x("[ {\"name\":\"Jon Doe\", \"movie_ids\":[3,65,8,72]}, {\"name\":\"Jane 
Dean\",\"movie_ids\":[5,98,2]} ] -> expand $.movie_ids;");
-#jaql.x("A -> expand -> transform $ * 2;");
-io.print("9");
-jaql.x("A -> expand $.ids;");
-
diff --git a/monetdb5/extras/jaql/transform.mal 
b/monetdb5/extras/jaql/transform.mal
deleted file mode 100644
--- a/monetdb5/extras/jaql/transform.mal
+++ /dev/null
@@ -1,75 +0,0 @@
-# [ 1, 2, 3 ] -> transform {"value":$};
-# [ 1, 2, 3 ] | as $ -> transform: '{"value":%s}' , $ => <result>
-
-
-include json;
-
-x := json.shred("[ 1, 2, 3 ]");
-x1 := json.bind_kind(x);
-x2 := json.bind_array(x);
-ta := algebra.selectH(x1, 0@0);
-o0 := algebra.semijoin(x2, ta);
-o2 := bat.reverse(o0);
-o3 := bat.mirror(o2);
-o1 := algebra.fetchjoin(o3, x1);
-# semantic: plain usage of array value ($)
-x3 := json.bind_int(x);
-o4 := algebra.semijoin(x3, o1);
-# o4 holds the values for $ to be used in tuple reconstruction
-
-# construct result by creating a new array
-# let's assume for the moment we would parse the json_fragment and get a
-# tree representation which also supports arithmetic and functions
-# it means we have knowledge on how to construct the parts
-#y := json.new();  # all but an empty array
-#y := json.append("{ value: x }"); # add to end of outermost array
-
-# observation:
-# adding an entry to the outermost array (or any array/object) is as
-# simple as adding to the array table with the right parent oid
-# (outermost array should be 0@0)
-
-x11 := bat.new(:oid,:chr); # kind
-x12 := bat.new(:oid,:oid); # array
-x13 := bat.new(:oid,:oid); # object
-x14 := bat.new(:oid,:lng); # int
-x15 := bat.new(:oid,:str); # name
-
-n0 := 0@0;
-bat.insert(x11, n0, 'a');
-r0 := bat.reverse(x11);
-
-# insert the values
-n := aggr.max(r0);
-n1 := n + 1:oid;
-o5 := algebra.markH(o1, n1);
-x11 := bat.insert(x11, o5);
-o6 := algebra.markH(o4, n1);
-x14 := bat.insert(x14, o6);
-
-# for each value, an object is constructed (semantic)
-n := aggr.max(r0);
-n2 := n + 1:oid;
-o7 := algebra.markH(o1, n2);
-o8 := algebra.project(o7, 'o');
-x11 := bat.insert(x11, o8);
-x17 := bat.reverse(o8);
-x18 := algebra.project(n0, x17);
-x12 := bat.insert(x12, x18);
-o9 := bat.mirror(o5);
-o10 := algebra.markH(o9);
-o12 := algebra.markT(o8);
-o13 := algebra.join(o12, o10);
-x13 := bat.insert(x13, o13);
-o14 := algebra.project(o5, 0@0);
-o15 := bat.new(:oid,:str);
-o15 := bat.insert(o15, 0@0, "value"); # argument
-o16 := algebra.join(o14, o15);
-x15 := bat.insert(x15, o16);
-
-# construct result by putting everything together
-x10 := json.construct(x11, nil:bat, x14, nil:bat, x12, x13, x15);
-
-out := io.stdout();
-json.print(out, x);
-json.print(out, x10);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to