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

The exact_cardinality metamodel slot doesn't seem to have any effect when used in a SlotDefinition #2104

Open
candleindark opened this issue May 11, 2024 · 1 comment
Labels
bug Something that should work but isn't, with an example and a test case. community-generated metamodel

Comments

@candleindark
Copy link

Describe the bug
The exact_cardinality metamodel slot doesn't seem to have any effect when used in a SlotDefinition

To reproduce
Steps to reproduce the behavior:

  1. Given the following files
    personinfo.yaml
id: https://w3id.org/linkml/examples/personinfo
name: personinfo
prefixes:
  linkml: https://w3id.org/linkml/
  personinfo: https://w3id.org/linkml/examples/personinfo
imports:
  - linkml:types
default_range: string
default_prefix: personinfo

classes:
  Person:
    attributes:
      id:
      full_name:
      aliases:
        multivalued: true
        exact_cardinality: 3
      phone:
      age:
      occupation:
      employed_by:

and data.yaml

id: ORCID:1234
full_name: Clark Kent
age: "32"
occupation: reporter
employed_by: Daily Planet
phone: 555-555-5555
aliases:
  - Superman
  - Kal-El
  1. Run linkml-validate -s personinfo.yaml data.yaml
  2. The output of the above command is No issues found.

Expected behavior
The validation command should have failed with an error message.

About your computer (if applicable, please complete the following information):

  • OS: MacOS 14.4.1 on M1
  • Python version 3.11.7
  • LinkML version 1.7.9
@candleindark candleindark added the bug Something that should work but isn't, with an example and a test case. label May 11, 2024
@candleindark
Copy link
Author

I have changed personinfo.yaml have the slots defined in the metadata model slots in the "global" level (as illustrated below), and the result is the same.

id: https://w3id.org/linkml/examples/personinfo
name: personinfo
prefixes:
  linkml: https://w3id.org/linkml/
  personinfo: https://w3id.org/linkml/examples/personinfo
imports:
  - linkml:types
default_range: string
default_prefix: personinfo

classes:
  Person:
    slots:
      - id
      - full_name
      - aliases
      - phone
      - age
      - occupation
      - employed_by


slots:
  id:
  full_name:
  aliases:
    multivalued: true
    exact_cardinality: 3
  phone:
  age:
  occupation:
  employed_by:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that should work but isn't, with an example and a test case. community-generated metamodel
Projects
None yet
Development

No branches or pull requests

2 participants