add orient sql queries

I have added a query method for creating more complex sql based queries.