I have not developed with salesforce and this is the first time that I am reading about their database. But it looks to me that you can implement what they are doing with orient db. It has fluid schema, "objects" and an sql like query syntax.
https://github.com/orientechnologies/orientdb
All of the good stuff is in the wiki :)