move DB connection code into ontology bit to speed up calls when no DB required