Пример #1
0
 def __init__(self,
              topic_ref: str = "",
              role_spec: str = "related",
              identifier: str = "") -> None:
     if role_spec == "":
         raise TopicDbError("Empty 'role spec' parameter")
     self.__role_spec = slugify(str(role_spec))
     self.__topic_refs = [] if topic_ref == "" else [
         slugify(str(topic_ref))
     ]
     self.__identifier = (str(uuid.uuid4())
                          if identifier == "" else slugify(str(identifier)))
Пример #2
0
    def __init__(self,
                 identifier: str = "",
                 instance_of: str = "entity") -> None:
        if instance_of == "":
            raise TopicDbError("Empty 'instance of' parameter")

        if identifier == "":
            self.__identifier = str(uuid.uuid4())
        elif identifier == UNIVERSAL_SCOPE:
            self.__identifier = UNIVERSAL_SCOPE
        else:
            self.__identifier = slugify(str(identifier))

        self.__instance_of = slugify(str(instance_of))
        self.__attributes: List[Attribute] = []
Пример #3
0
 def scope(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'value' parameter")
     self.__scope = value if value == UNIVERSAL_SCOPE else slugify(
         str(value))
Пример #4
0
 def instance_of(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'value' parameter")
     self.__instance_of = slugify(str(value))
Пример #5
0
 def scope(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'scope' parameter")
     self.__scope = value if value == "*" else slugify(str(value))
Пример #6
0
 def topic_identifier(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'value' parameter")
     self.__topic_identifier = value if value == UNIVERSAL_SCOPE else slugify(str(value))
Пример #7
0
 def add_topic_ref(self, topic_ref: str) -> None:
     if topic_ref == "":
         raise TopicDbError("Empty 'topic ref' parameter")
     self.__topic_refs.append(slugify(str(topic_ref)))
Пример #8
0
 def role_spec(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'value' parameter")
     self.__role_spec = slugify(str(value))
Пример #9
0
 def entity_identifier(self, value: str) -> None:
     if value == "":
         raise TopicDbError("Empty 'value' parameter")
     self.__entity_identifier = value if value == "*" else slugify(
         str(value))