Skip to content

Add internal instance-of relations for resources

Marcel Konrad requested to merge internal-instance-of-relations into master

As discussed, this MR implements internal INSTANCE_OF relations for resources. A INSTANCE_OF relation, is created for each label of a resource node, to the corresponding class node. This simplifies resource fetching based on any given parent- or child-class:

MATCH (r:Resource)-[:INSTANCE_OF]->(:Class)-[:SUBCLASS_OF*0..]->(:Class {id: "C58044"})
RETURN r

The query of the resource repository is based on the auto-generated query by neo4j. It supports optimistic locking and does not throw an error when a provided class is not actually in the database. This is required, as we do not create any class nodes in the repository contract tests.

The deletion did not require any further updates, as it already uses a DETACH DELETE by default.

There are no INSTANCE_OF relations for Resource and Thing.

Edited by Marcel Konrad

Merge request reports