Skip to content

Constraint between relationships (OR operator) #871

@fmione

Description

@fmione

Feature description

It woulde be nice to add a constraint definition for cases where a node could have one or the other relationship (similar to the OR operator), but not both.

For example, consider the following (dummy) case: a Person can only have one type of pet, either a Dog or a Cat.

class Dog(StructuredNode):
    name= StringProperty(required=True)

class Cat(StructuredNode):
    name= StringProperty(required=True)

class Person(StructuredNode):
    name= StringProperty(required=True)

    cat= RelationshipTo('Cat', 'HAS_PET', cardinality=ZeroOrMore)
    dog= RelationshipTo('Dog', 'HAS_PET', cardinality=ZeroOrMore)

This is, of course, a simplified example to illustrate the required constraint, without the need for creating an Animal superclass.

Metadata

Metadata

Labels

featureDescribes a new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions