Skip to main content

ConnectionDataCSV

ConnectionDataCSV Objects

class ConnectionDataCSV(CSVParser)

ApertureDB Connection Data.

This class loads the Connection Data which is present in a CSV file, and converts it into a series of aperturedb queries.

Is backed by a CSV file with the following columns:

ConnectionClass, Class1@PROP_NAME, Class2@PROP_NAME ... PROP_NAME_N, constraint_PROP1

Example CSV file::

ConnectionClass,_Image@id,_Descriptor@UUID,confidence,id,constraint_id
has_image,321423532,AID-0X3E,0.4354,5432543254,5432543254
has_image,42342522,BXY-AB1Z,0.6432,98476542,98476542
...

ConnectionClass: Arbitrary class name for the entity this would be saved as.

ClassName@PropertyName: This is a special combination of Class Name and Property Name that can uniquely identify an entity. ‘@’ is a delimiter, so should not be used in a property name.

PROP_NAME_1 .. PROP_NAME_N: Arbitrary property names.

constraint_PROP_NAME_1: A equality check against a unique property to ensure duplicates are not inserted.

Example usage:


data = ConnectionDataCSV("/path/to/ConnectionData.csv")
loader = ParallelLoader(db)
loader.ingest(data)
info

This example CSV's first row creates connection between an Image(id=321423532) and a descriptor(UUID=AID-0X3E) It also connects the images and descriptors in the subsequent rows.

In the above example, the constraint_id ensures that a connection with the specified id would be only inserted if it does not already exist in the database.