separate objects and belongs

refine sql file
remove library_id from entities
store entities in proper format
update queries for global entities
add items api