Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Source Cardinality #82

Open
Matt-81 opened this issue Sep 28, 2021 · 2 comments
Open

Get Source Cardinality #82

Matt-81 opened this issue Sep 28, 2021 · 2 comments

Comments

@Matt-81
Copy link
Collaborator

Matt-81 commented Sep 28, 2021

Just to keep track of an issue we already discussed.
At the current state, to get relation cardinalities information we have to get the relation properties and then get information about cardinalities.
It would be nice in the future to get information directly from a relation type.

@claudenirmf
Copy link
Member

I like the idea, but we must agree about how. The Cardinality class has multiple methods for retrieving lower and upper bounds in different ways. Replicating these methods on the Relation class API will add a dozen methods approximately.

P.s.: you may be interested in the method isMandatory(): boolean.

const isTheSouceLowerBoundGreaterThanZero : boolean = relation.getSourceEnd().isMandatory();

@Matt-81
Copy link
Collaborator Author

Matt-81 commented Sep 28, 2021

Great, thanks, Claudenir.
Meanwhile, I accessed the needed data by extracting all the relation properties:

const relationProperties = relations.map(relation => relation.getSourceEnd());
const sourceCardinalities = relationProperties.map(sourceCardinality => sourceCardinality.cardinality);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants