provdbconnector.db_adapters.neo4j package

Submodules

provdbconnector.db_adapters.neo4j.cypher_commands module

provdbconnector.db_adapters.neo4j.neo4jadapter module

class provdbconnector.db_adapters.neo4j.neo4jadapter.Neo4jAdapter(*args)[source]

Bases: provdbconnector.db_adapters.baseadapter.BaseAdapter

This is the neo4j adapter to store prov. data in a neo4j database

connect(authentication_options)[source]

The connect method to create a new instance of the db_driver

Parameters:authentication_options – Username, password, host and encrypted option
Returns:None
Return type:None
Raises:InvalidOptionsException
save_element(attributes, metadata)[source]

Saves a single record

Parameters:
  • attributes (dict) – The attributes dict
  • metadata (dict) – The metadata dict
Returns:

The id of the record

Return type:

str

save_relation(from_node, to_node, attributes, metadata)[source]

Save a single relation

Parameters:
  • from_node (QualifiedName) – The from node as QualifiedName
  • to_node (QualifiedName) – The to node as QualifiedName
  • attributes (dict) – The attributes dict
  • metadata (dict) – The metadata dict
Returns:

Id of the relation

Return type:

str

get_records_by_filter(attributes_dict=None, metadata_dict=None)[source]

Return the records by a certain filter

Parameters:
  • attributes_dict (dict) – Filter dict
  • metadata_dict (dict) – Filter dict for metadata
Returns:

list of all nodes and relations that fit the conditions

Return type:

list(DbRecord and DbRelation)

get_records_tail(attributes_dict=None, metadata_dict=None, depth=None)[source]

Return all connected nodes form the origin.

Parameters:
  • attributes_dict (dict) – Filter dict
  • metadata_dict (dict) – Filter dict for metadata
  • depth – Max steps
Returns:

list of all nodes and relations that fit the conditions

Return type:

list(DbRecord and DbRelation)

get_bundle_records(bundle_identifier)[source]

Return all records and relations for the bundle

Parameters:bundle_identifier
Returns:
get_record(record_id)[source]

Try to find the record in the database

Parameters:record_id
Returns:DbRecord
Return type:DbRecord
get_relation(relation_id)[source]

Get a relation

Parameters:relation_id
Returns:The relation
Return type:DbRelation
delete_records_by_filter(attributes_dict=None, metadata_dict=None)[source]

Delete records and relations by a filter

Parameters:
  • attributes_dict
  • metadata_dict
Returns:

delete_record(record_id)[source]

Delete a single record

Parameters:record_id
Returns:
delete_relation(relation_id)[source]

Delete a single relation

Parameters:relation_id
Returns:

Module contents