The Session will manage the rest of the components in SuRF, it also acts as the type factory for surf, the resources will walk the graph in a lazy manner based on the session that they are bound to (the last created session).
Create a new session object that handles the creation of types and instances, also the session binds itself to the Resource objects to allow the Resources to access the data store and perform lazy loading of results.
The session object behaves like a dict when it comes to managing the registered stores.
Toggle auto_load (no need to explicitly call load, resources are loaded from the store automatically on creation) on or off. Accepts boolean values.
Toggle auto_persistence (no need to explicitly call commit, resources are persisted to the store each time a modification occurs) on or off. Accepts boolean values.
Close the session.
It is good practice to close the session when it’s no longer needed. Remember: upon closing session all resources will lose the ability to reference the session thus the store and the mapping.
Commit all the changes, update all the dirty resources.
The default store of the session.
See default_store_key to see how the default store is selected.
The default store key of the session.
If it is set explicitly on session creation it is returned, else the first store key is returned. If no stores are in the session None is returned.
Toggle logging on or off. Accepts boolean values.
See surf.session.Session.map_type(). The uri parameter can be any of the following:
- a string of the form
- a URI
- a Resource class name eg: SiocPost
- a namespace_symbol type string eg: sioc_post
Same as map_type but set the resource from the graph.
The keys that are assigned to the managed stores.
Create a instance of the class specified by uri.
Also set the internal properties according to the ones by the specified source.
Create a instance of the class specified by uri and classes to be inherited, see map_type for more information.
Create and return a class based on the uri given.
Also will add the classes to the inheritance list.