How to limit subsetting/redefintion

Hello, I have a problem. I want to build a library where I sometimes need elements that should only be included once. The following example illustrates this: I want the user to be able to attach to “mqttcred” only, not to two. Is this possible, or am I misunderstanding something? Secondly, I have a question about the “broker” attribute. How can I ensure that the user redefines it and does not subset it? Because they could easily subset ‘broker’, and then I would have multiple ‘broker’ instances in ‘mqtt cred’, which makes no sense. Maybe it works with assert constraints but jupyter doesn’t evaluate those.

library package example{

    private import ScalarValues::*;
    private import Metaobjects::SemanticMetadata;
    part def MQTT_CREDS{

        attribute broker:ScalarValues::String;
        attribute url:ScalarValues::String; 
    }


    part def Communication{
        part mqtt_creds:MQTT_CREDS;
    }

    
    
    
    metadata def <mqqtcred> MData :> SemanticMetadata {
        :>> baseType default Communication::mqtt_creds meta SysML::PartUsage;
        :>> annotatedElement:SysML::PartUsage;
    }


    metadata def <comm> CommData :> SemanticMetadata {
        :>> baseType default Communication meta SysML::PartDefinition;
        :>> annotatedElement:SysML::PartDefinition;
    }


   
    #comm part def {
        #mqqtcred part example{
            :>>broker = "testbroker";
            :>>url = "testurl";
        } 
    }

    // but the user still can place multiple mqqtcreds
    #comm part def {
        #mqqtcred part example{
            :>>broker = "testbroker";
            :>>url = "testurl";
        } 
        #mqqtcred part example2{
            :>>broker = "testbroker";
            :>>url = "testurl";
        } 
    }

    
}