Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SINTEF-9012_SINDIT20 /src /sindit /api /metamodel_endpoints.py
| from fastapi import HTTPException | |
| from sindit.initialize_kg_connectors import sindit_kg_connector | |
| from sindit.util.log import logger | |
| from sindit.api.api import app | |
| async def search_unit(search_term: str): | |
| """ | |
| Search for a unit in the meta-model based on a string. | |
| """ | |
| try: | |
| return sindit_kg_connector.search_unit(search_term) | |
| except Exception as e: | |
| logger.error(f"Error searching for unit: {e}") | |
| raise HTTPException(status_code=404, detail=str(e)) | |
| async def get_unit_by_uri(uri: str): | |
| """ | |
| Get a unit in the meta-model based on its URI. | |
| """ | |
| try: | |
| return sindit_kg_connector.get_unit_by_uri(uri) | |
| except Exception as e: | |
| logger.error(f"Error getting unit by URI: {e}") | |
| raise HTTPException(status_code=404, detail=str(e)) | |
| async def get_all_units(): | |
| """ | |
| Get all units in the meta-model. | |
| Warning: This can be a large response. | |
| """ | |
| try: | |
| return sindit_kg_connector.get_all_units() | |
| except Exception as e: | |
| logger.error(f"Error getting all units: {e}") | |
| raise HTTPException(status_code=404, detail=str(e)) | |
| async def get_all_data_type(): | |
| """ | |
| Get all data types in the meta-model. | |
| """ | |
| try: | |
| return sindit_kg_connector.get_all_data_types() | |
| except Exception as e: | |
| logger.error(f"Error getting all data types: {e}") | |
| raise HTTPException(status_code=404, detail=str(e)) | |
Xet Storage Details
- Size:
- 1.7 kB
- Xet hash:
- 1d554bd9409af05b2d05a3d65a131ffcca64384228f251f8f841da8fd090a618
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.