Really store RDF types in Database.  Next, use them to make a query.