addRelation method
Add a new relation to the graph
Implementation
@override
void addRelation(Relation relation, {bool replaceIfExists = true}) {
final row = _relationToRow(relation);
if (replaceIfExists) {
_db.execute('DELETE FROM relations WHERE id = ?', [relation.id]);
_db.execute(
'DELETE FROM relation_properties WHERE relationId = ?',
[relation.id],
);
}
_db.execute(
'INSERT INTO relations '
'(id, type, fromNodeId, toNodeId, labelProperty) '
'VALUES (?, ?, ?, ?, ?)',
row,
);
_saveRelationProperties(relation.id, relation.properties);
}