Services
Ontology Service
The OntologyService handles ontology-related operations.
import asyncio
from t2g_sdk import T2GClient
async def main():
async with T2GClient() as client:
# Now you can access the OntologyService via client.ontology
# Example:
ontologies = await client.ontology.find_ontologies(ids=["some-ontology-id"])
pass
if __name__ == "__main__":
asyncio.run(main())The OntologyService handles ontology-related operations and is accessed via the ontology property of an active T2GClient instance.
upload_ontology
Uploads an ontology file to the T2G API.
async def upload_ontology(ontology_path: str) -> Ontologyontology_path: The path to the ontology file to upload.
create_ontology
Creates an ontology record and returns a presigned URL for uploading.
async def create_ontology(name: str, source_hash: str) -> Dictname: The name of the ontology.source_hash: The SHA256 hash of the ontology file's content.
find_ontologies
Finds ontologies by their IDs or source hashes.
async def find_ontologies(ids: List[str] = None, source_hashes: List[str] = None) -> List[Ontology]ids(optional): A list of ontology IDs to find.source_hashes(optional): A list of source hashes to find.