3

I am bit confused between 'o' and '-->' used in Model file, For example :

asset Field identified by assetId {
    o String assetId
    o Customer owner
    --> Customer custId
}

participant Customer identified by customerId {
    o String customerId
} 

what is difference between "o Customer owner" and "--> Customer custId"?

1 Answer 1

9

The o indicates that this is an owned property of a class. Aka a "field". That means that when the instance of the class is removed, so are all its properties.

The --> indicates that this is a relationship to another addressable resource. Aka a pointer or primary/foreign key entity relationship.

In your example, your asset Field has a property or type Customer called owner. When instances of Field are deleted the instances of Customer that they are storing in the owner property are also deleted.

The Field asset also has a relationship to a Customer instance stored in a property called custId. Deleting an instance of Field will not delete the instance of Customer that is being pointed to by the relationship.

Composer relationships are essentially typed-pointers. They are a fully-qualified type name of the resource that is being pointed to, as well as the identified of the instance that is being pointed to.

In Composer relationships do not cascade-delete, and there is no referential integrity checking for relationships. It is up to the application to check whether the resource that is at the end of a relationship exists or not, and to respond appropriately.

Note that in the future we may prevent using o with assets and participants. It really doesn't make much sense and is confusing for people that expect to find them in their respective registries. For assets and participants people should use -->.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.