Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

155
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda