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

infixowl cardinality - 0 #1453

Closed
MattyCrowther opened this issue Oct 22, 2021 · 1 comment · Fixed by #1530
Closed

infixowl cardinality - 0 #1453

MattyCrowther opened this issue Oct 22, 2021 · 1 comment · Fixed by #1530

Comments

@MattyCrowther
Copy link

MattyCrowther commented Oct 22, 2021

owl.Restriction(property,graph=graph,cardinality=Literal(0)) Raises an error.
assert len(validRestrProps)
When cardinality value is given as 0.

This comes from:

  validRestrProps = [(i, oTerm) for (i, oTerm) in restrTypes if i]
  assert len(validRestrProps)

I believe this is an oversight as if i == 0 returns False.
However, I believe cardinality: 0 is valid.

@ghost
Copy link

ghost commented Dec 25, 2021

owl.Restriction(property,graph=graph,cardinality=Literal(0)) Raises an error. assert len(validRestrProps) When cardinality value is given as 0.

I believe this is an oversight as if i == 0 returns False. However, I believe cardinality: 0 is valid.

You are spot on, it's a classic example of "falsiness", offending LoC is:

validRestrProps = [(i, oTerm) for (i, oTerm) in restrTypes if i]

and the obvious change to if i is not None fixes the issue, thanks for spotting it and nailing the cause.

PR #1530 raised.

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

Successfully merging a pull request may close this issue.

1 participant