Neo4j Store

This class is an implementation of the rdflib Store class that uses Neo4j as a backend. In this way it is possible to persist you RDF data directly in Neo4j, with the power of rdflib to process your data.

Constructor

Name

Type

Required

Default

Description

config

Neo4jStoreConfig

True

Neo4jStoreConfig object that contains all the useful information to initialize the store.

driver

Neo4jStoreConfig

False

None

A pre-built Neo4j driver object to use to connect to the database. You cannot specify both a driver and credentials in the Neo4jStoreConfig.

Functions

open

Opens a connection to the Neo4j database.

Arguments

Name

Type

Description

configuration

The configuration for the Neo4j database. (Not used, just kept for the method declaration in the Store class)

create

bool

Flag indicating whether to create the uniqueness constraint if not found.

is_open

Checks if the store is open.

Arguments

No arguments.

Output

Type

Description

bool

True if the store is open, False otherwise.

add

Adds a triple to the Neo4j store. It requires an opened store to work.

Arguments

Name

Type

Default

Description

triple

Tuple

N/A

The triple to add.

context

N/A

The context of the triple (default: None). Kept to respect the signature but currently not used.

quoted

bool

N/A

Flag indicating whether the triple is quoted (default: False). Kept to respect the signature but currently not used.

commit

Commits the currently stored nodes/relationships to the Neo4j database.

Arguments

Name

Type

Default

Description

commit_nodes

bool

False

Flag indicating whether to commit the nodes in the buffer.

commit_rels

bool

False

Flag indicating whether to commit the relationships in the buffer.

close

Closes the store. If the field batching is set to True in the Neo4jStoreConfig, remember to close the store to prevent the loss of any uncommitted records.

Arguments

Name

Type

Default

Description

commit_pending_transaction

bool

True

Flag indicating whether to commit any pending transaction before closing.