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

Slots reused in different parts of the LinkML schema #21

Open
mahdanoura opened this issue Jul 9, 2024 · 1 comment
Open

Slots reused in different parts of the LinkML schema #21

mahdanoura opened this issue Jul 9, 2024 · 1 comment

Comments

@mahdanoura
Copy link
Contributor

mahdanoura commented Jul 9, 2024

The aim of slotdefinitions in LinkML is to reuse those entities across the schema. However, some of the slots need to be used in different ways with different properties, for instance the slot title is not mandatory on all TD levels and only on the top level it is required. This is the case for many of the slots defined and causes problems in the generators.

@danielpeintner
Copy link

As mentioned in yesterdays TD call I understand the desire to use slot for modelling the same concept once and reusing it.

Anyhow, once the cardinality differs it is not the same concept anymore, if I understand the concept of slot correctly.

I would guess (but I don't know LinkML) there are other ways as well (separating the type and the actual element with occurrences). Let me use XML schema as an example:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <!-- Type to be reused -->
    <xs:complexType name="MyType">
        <xs:sequence>
            <xs:element name="foo" type="xs:string" />
            <xs:element name="bla" type="xs:int" />
        </xs:sequence>
    </xs:complexType>
    
    <!-- example where type is used  -->
    <xs:element name="root">
        <xs:complexType>
            <xs:sequence>
                <!-- instance with 0 to 10 -->
                <xs:element name="useOfTypeA" type="MyType" minOccurs="0" maxOccurs="10" />
                <!-- instance with exactly 1 -->
                <xs:element name="useOfTypeB" type="MyType" minOccurs="1" maxOccurs="1" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

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