class Ontology(DbObject): """An ontology specifies which tools and classifications are available to a project. This is read only for now. Attributes: name (str) description (str) updated_at (datetime) created_at (datetime) normalized (json) object_schema_count (int) classification_schema_count (int) projects (Relationship): `ToMany` relationship to Project created_by (Relationship): `ToOne` relationship to User """ name = Field.String("name") description = Field.String("description") updated_at = Field.DateTime("updated_at") created_at = Field.DateTime("created_at") normalized = Field.Json("normalized") object_schema_count = Field.Int("object_schema_count") classification_schema_count = Field.Int("classification_schema_count") projects = Relationship.ToMany("Project", True) created_by = Relationship.ToOne("User", False, "created_by") def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self._tools: Optional[List[Tool]] = None self._classifications: Optional[List[Classification]] = None def tools(self) -> List[Tool]: """Get list of tools (AKA objects) in an Ontology.""" if self._tools is None: self._tools = [ Tool.from_dict(tool) for tool in self.normalized['tools'] ] return self._tools def classifications(self) -> List[Classification]: """Get list of classifications in an Ontology.""" if self._classifications is None: self._classifications = [ Classification.from_dict(classification) for classification in self.normalized['classifications'] ] return self._classifications
class Ontology(DbObject): """ A ontology specifies which tools and classifications are available to a project. NOTE: This is read only for now. >>> project = client.get_project(name="<project_name>") >>> ontology = project.ontology() >>> ontology.normalized """ name = Field.String("name") description = Field.String("description") updated_at = Field.DateTime("updated_at") created_at = Field.DateTime("created_at") normalized = Field.Json("normalized") object_schema_count = Field.Int("object_schema_count") classification_schema_count = Field.Int("classification_schema_count") projects = Relationship.ToMany("Project", True) created_by = Relationship.ToOne("User", False, "created_by") def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self._tools: Optional[List[Tool]] = None self._classifications: Optional[List[Classification]] = None def tools(self) -> List[Tool]: if self._tools is None: self._tools = [ Tool.from_json(tool) for tool in self.normalized['tools'] ] return self._tools # type: ignore def classifications(self) -> List[Classification]: if self._classifications is None: self._classifications = [ Classification.from_json(classification) for classification in self.normalized['classifications'] ] return self._classifications # type: ignore