Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
Neo4J constraint to prevent circular reference

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.

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

graph

... but this should not

enter image description here

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).

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda