示例#1
0
    def __init__(
        self,
        identifier: str = "",
        instance_of: str = "association",
        name: str = "Undefined",
        language: Language = Language.ENG,
        scope: str = "*",
        src_topic_ref: str = "",
        dest_topic_ref: str = "",
        src_role_spec: str = "related",
        dest_role_spec: str = "related",
    ) -> None:
        super().__init__(identifier, instance_of, name, scope,
                         language)  # Base name 'scope' parameter

        self.__scope = scope if scope == "*" else slugify(
            str(scope))  # Association 'scope' parameter
        self.__members: List[Member] = []

        if (src_topic_ref != "" and src_role_spec != ""
                and dest_topic_ref != "" and dest_role_spec != ""):
            src_member = Member(src_topic_ref, src_role_spec)
            dest_member = Member(dest_topic_ref, dest_role_spec)
            self.__members.append(src_member)
            self.__members.append(dest_member)
示例#2
0
 def create_members(self,
                    src_topic_ref,
                    dest_topic_ref,
                    src_role_spec='related',
                    dest_role_spec='related'):
     members = [
         Member(src_topic_ref, src_role_spec),
         Member(dest_topic_ref, dest_role_spec)
     ]
     self.add_members(members)
示例#3
0
 def create_members(
     self,
     src_topic_ref: str,
     dest_topic_ref: str,
     src_role_spec: str = "related",
     dest_role_spec: str = "related",
 ) -> None:
     members = [
         Member(src_topic_ref, src_role_spec),
         Member(dest_topic_ref, dest_role_spec),
     ]
     self.add_members(members)
示例#4
0
    def __init__(self,
                 identifier='',
                 instance_of='association',
                 base_name='Undefined',
                 language=Language.ENG,
                 scope='*',
                 src_topic_ref='',
                 dest_topic_ref='',
                 src_role_spec='related',
                 dest_role_spec='related'):
        super().__init__(identifier, instance_of, base_name, language)

        self.__scope = scope if scope == '*' else slugify(str(scope))
        self.__members = []

        if src_topic_ref != '' and src_role_spec != '' and dest_topic_ref != '' and dest_role_spec != '':
            src_member = Member(src_topic_ref, src_role_spec)
            dest_member = Member(dest_topic_ref, dest_role_spec)
            self.__members.append(src_member)
            self.__members.append(dest_member)
示例#5
0
 def create_member(self,
                   topic_ref: str,
                   role_spec: str = "related") -> None:
     member = Member(topic_ref, role_spec)
     self.add_member(member)
示例#6
0
 def create_member(self, topic_ref, role_spec='related'):
     member = Member(topic_ref, role_spec)
     self.add_member(member)