Monday, April 23, 2012

A json join

Result = Left join Right

When Result, Left and Right are parseded Json expression trees, then that code is 20 lines. The entire left join module including the Ugliy handlers is less than 300 lines of code. That is all the code needed to execute complex queries over the web.

The complexity is in the underlying machines that get and put Json elements. I embody that complexity in the Mach type (changing the name from Graph). A Mach performs operations on nested stored like, Append etc; using:
mach->exec(Mach * mach,int MethodId,Element * data);

So, that method call leads to the complexity, not the engine itself. I have the adapter for sqlite3 working great.

I also have this working:
int main() {
Mach mem;
Element nodes[100];
mem.db = nodes;
MemInit(&mem);
}
Now the Json engine will treat by array of elements like any other Json expression tree. (Using the @ alternative)

The left join starts with:

*@*,*  // join the wild cards and write the result to wild card (loop forever)

Then goes to:

parse@,console,*

The left join chainging point on the world virtual json nested stores.  The parse machine inherits the machine underneath is, using the inherited methods to emit parsed Json.


The Json left join, great model, the industry will adapt it.

No comments: