bento_meta.object_map

This module contains ObjectMap, a class which provides the machinery for mapping bento_meta objects to a Bento Metamodel Database in Neo4j. Mostly not for human consumption. The ObjectMap:

  • interprets the attribute specification (attspec) and map specification (mapspec) associated with Entity subclasses

  • provides the get() and put() methods to subclasses, that enable them to get and put themselves to the database

  • generates appropriate Cypher queries to do gets and puts

One ObjectMap instance should be generated for each Entity subclass (see, e.g., bento_meta.model.Model)

Module Contents

Classes

ObjectMap

This module contains ObjectMap, a class which provides the

class bento_meta.object_map.ObjectMap(*, cls=None, drv=None)[source]

Bases: object

This module contains ObjectMap, a class which provides the machinery for mapping bento_meta objects to a Bento Metamodel Database in Neo4j. Mostly not for human consumption.

cache
classmethod clear_cache()[source]
classmethod cls_by_label(lbl)[source]
classmethod keys_by_cls_and_reln(qcls, reln)[source]
classmethod _quote_val(value, single=None)[source]
get_by_id(obj, id, refresh=False)[source]

Get an entity given an id attribute value (not the Neo4j id)

get_by_node_nanoid(obj, nanoid, refresh=False)[source]

PROTOTYPE Get an entity given an id attribute value (not the Neo4j id)

get(obj, refresh=False)[source]

Get the data for an object instance from the db and load the instance with it

put(obj)[source]

Put the object instance’s attributes to the mapped data node in the database

rm(obj, force=False)[source]

‘Delete’ the object’s mapped node from the database

add(obj, att, tgt)[source]

Create a link between an object instance and a target object in the database. This represents adding an object-valued attribute to the object.

drop(obj, att, tgt, tx=None)[source]

Remove an existing link between an object instance and a target object in the database. This represents dropping an object-valued attribute from the object.

get_owners(obj)[source]

Get the nodes which are linked to the object instance (the owners of the object)

get_q(obj)[source]
get_by_id_q()[source]
get_by_node_nanoid_q()[source]

PROTOTYPE

get_attr_q(obj, att)[source]
get_owners_q(obj)[source]
put_q(obj)[source]
put_attr_q(obj, att, values)[source]
rm_q(obj, detach=False)[source]
rm_attr_q(obj, att, values=None)[source]
_check_values_list(att, values)[source]