Well, it is still a product but if two views have the same property name and you can't have two columns with the same name then one will be dropped. What MKSql does is renames any column that is in both tables. MKSql keeps track of the original view names, but you could just append "A" for the first table and "B" for the second table.I am trying to optimize some of my search strategies and one way to do this involves creating a product of two or more views that have the same description. In this case, view.product() just creates the union. Not surprising. It's not actually a product, but what's it supposed to do? :-)
Here is an example: viewa = db.getas(...) viewb = db.getas(...)
for prop in viewa.properties():
if prop in viewb.properties():
viewa = viewa.rename(prop, "A.%s"%prop)
viewb = viewb.rename(prop, "B.%s"%prop)prod = viewa.product(viewb)
of course, your queries will have to deconvolute the answers...
Have you thought about actually using MKSql as the query language? Try downloading KitViewer and trying some sql statements. It is all run by MKSql so you can get a taste. One of the nice things about MKSql is that it runs on arbitrary metakit databases. It won't work with data stored in metakit subviews though i.e.
v = db.getas("test[a:S,number:I,subview[name:S,last:S]]")
You won't be able to query subview here. Download kitviewer here: http://jura.wi.mit.edu/people/kelley/
In anycase, browsing the source of mksql can be eye opening.
Brian Kelley
The obvious way around this is to apply "isomorphic" but non-identical descriptions to the views and then apply view.product() to the results. Is there a quick way of creating a derived view that differs only in the property names?
Currently I have a loop that just calls view.rename() for each property (apparently creating a new view each time), and this seems rather inefficient. Or is it not inefficient?
Or is there a better way to do this?
-------------------------------------- Gary H. Merrill Director and Principal Scientist, New Applications Data Exploration Sciences GlaxoSmithKline Inc. (919) 483-8456
_____________________________________________
Metakit mailing list - [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit
_____________________________________________ Metakit mailing list - [EMAIL PROTECTED] http://www.equi4.com/mailman/listinfo/metakit
