> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ko/sdks/ontology-resources.md).

# 온톨로지 리소스

Python SDK로 워크스페이스 온톨로지를 조회, 생성, 수정하는 방법과 목록 필터, 필드, 필요한 API 키 권한을 설명합니다. 프로젝트별 온톨로지 사본 동작도 다룹니다.

워크스페이스 온톨로지는 재사용할 수 있습니다. 온톨로지를 지정해 프로젝트를 만들면 프로젝트는 자체 사본을 받으므로, 이후 워크스페이스 온톨로지를 수정해도 기존 프로젝트는 바뀌지 않습니다.

```python
ontology = client.ontologies.create(
    "Robot cell QA",
    description="Grippers and parts on the inspection line",
    structure=structure,
)

for item in client.ontologies.list(title_like="Robot"):
    print(item.id, item.title, item.last_edited_at)

ontology = client.ontologies.get("ONTOLOGY_ID")
ontology.description = "Adds the Fixture class"
ontology.structure.add_object("Fixture", Shape.BOUNDING_BOX)
ontology.save()
```

`create()`는 온톨로지를 즉시 사용 가능하게 만들며 별도의 게시 단계가 없습니다. `save()`는 `title`, `description`, `structure`를 저장하고 새 리비전을 기록합니다.

## 목록 필터 <a href="#list-filters" id="list-filters"></a>

| 필터                                | 일치 조건                |
| --------------------------------- | -------------------- |
| `title_eq`, `title_like`          | 제목 전체 또는 일부 일치       |
| `desc_eq`, `desc_like`            | 설명 전체 또는 일부 일치       |
| `created_before`, `created_after` | ISO 8601 날짜 또는 타임스탬프 |
| `edited_before`, `edited_after`   | ISO 8601 날짜 또는 타임스탬프 |

보관된 온톨로지는 목록에 표시되지 않습니다.

## 필드 <a href="#fields" id="fields"></a>

| 필드                                  | 의미                                                   |
| ----------------------------------- | ---------------------------------------------------- |
| `id`                                | 온톨로지 ID. `projects.create()`에 `ontology_hash`로 전달합니다 |
| `title`, `description`, `structure` | 내용                                                   |
| `data_type`                         | 호환성 계열. 기본값은 `image`                                 |
| `created_at`, `last_edited_at`      | 시각                                                   |
| `project_id`                        | 온톨로지가 프로젝트에 속한 경우 설정됩니다                              |

키에는 읽기용으로 **View ontology** 권한이, 생성·저장용으로 **Manage ontologies** 권한이 필요합니다.

## 관련 문서 <a href="#related" id="related"></a>

[Python으로 온톨로지 구성](https://docs.unitlab.ai/api-sdk-cli/ko/sdks/build-ontologies-in-python.md) · [CLI: 온톨로지와 클라우드 스토리지](https://docs.unitlab.ai/api-sdk-cli/ko/clis/cli-ontologies-and-cloud-storage.md)
