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)))
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] = []
def scope(self, value: str) -> None: if value == "": raise TopicDbError("Empty 'value' parameter") self.__scope = value if value == UNIVERSAL_SCOPE else slugify( str(value))
def instance_of(self, value: str) -> None: if value == "": raise TopicDbError("Empty 'value' parameter") self.__instance_of = slugify(str(value))
def scope(self, value: str) -> None: if value == "": raise TopicDbError("Empty 'scope' parameter") self.__scope = value if value == "*" else slugify(str(value))
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))
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)))
def role_spec(self, value: str) -> None: if value == "": raise TopicDbError("Empty 'value' parameter") self.__role_spec = slugify(str(value))
def entity_identifier(self, value: str) -> None: if value == "": raise TopicDbError("Empty 'value' parameter") self.__entity_identifier = value if value == "*" else slugify( str(value))