I am new to Neo4J and the @neo4j/graphql library, hoping to use this stack to create an api for a simple app. I have a bunch of questions but I will start with this one.
I have the following schema.
type Process {
id: ID! @id
name: String! @unique
assets: [Asset!]! @relationship(type: "PROCESS_ASSET", direction: OUT)
}
type Asset {
id: ID! @id
name: String! @unique
childAssets: [Asset!]! @relationship(type: "CHILD_ASSET", direction: OUT)
}
Which is intended to generate the following graph.
Is it possible to add a constraint that would disallow adding an asset as a child to another asset which would create a circular reference.
i.e. this should be possible
... but this should not
The reason for this is that I want to be able to calculate a score for an asset which sums properties from all child assets.
If this is not possible with neo4j constraints, a recomendation for how to handle this in the application layer (resolver of @neo4j/graphql would be great).