ontology
py-ontology-server-starter
Ontologie-Wissensserver-Starter — FastAPI-Semantikschicht + Apache-Jena-Fuseki-Triplestore, für Konsumenten sowohl REST als auch MCP.
Eine Palantir-artige objektzentrierte Ontologie (Object Type / Property / Link Type) wird im Code deklariert, Speicherung und Abfrage erfolgen nach W3C-Standards (RDF / SPARQL 1.1). Da der Anwendungscode ausschließlich den SPARQL-Standard verwendet, bleibt die App unverändert, auch wenn der Datenspeicher z. B. durch GraphDB ersetzt wird.
┌─ 소비자 ──────────────────────────────┐
│ AI 에이전트(MCP) 앱·사람(REST) │
└──────────┬───────────────┬───────────┘
│ │
mcp_server.py api/rest.py ← 이중 어댑터
└───────┬───────┘
ontology/ + store/ ← 코어: 온톨로지 정의 + SPARQL 클라이언트
│
Apache Jena Fuseki (docker) ← 저장·SPARQL·추론
▲
ingest/ 파이프라인 ← 지식원 → RDF 변환·적재Schnellstart
# 1. 트리플스토어 기동
docker compose up -d fuseki # http://localhost:3030 (admin / admin)
# 2. 앱 설치
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
# 3. 샘플 데이터 적재 (CSV → RDF → Fuseki)
python -m ontology_server.ingest.example_csv data/sample/organizations.csv \
--object-type organization --push
# 4. REST 서버 기동
uvicorn ontology_server.main:app --reload
# → http://localhost:8000/docs
curl localhost:8000/objects/organizationRelated MCP server: mcp-ubergraph-query
MCP-Adapter (für KI-Agenten)
Läuft über den stdio-Transport. In der .mcp.json des Claude-Code-Projekts:
{
"mcpServers": {
"ontology": {
"command": "/절대경로/.venv/bin/python",
"args": ["-m", "ontology_server.mcp_server"]
}
}
}Bereitgestellte Werkzeuge: list_object_types(Schema ermitteln) · search_objects(Instanzen nach Typ abfragen) · sparql_query(schreibgeschützte Direktabfrage).
An die eigene Domäne anpassen
Ersetze
src/ontology_server/ontology/sample.pydurch die Domänen-Ontologie — wenn du nur die Deklarationen von Object Type und Link Type änderst, passen sich REST-, MCP- und Abfrage-Builder automatisch an.Füge in
src/ontology_server/ingest/pro Wissensquelle ein Erfassungsmodul hinzu (sieheexample_csv.py).Wenn externe Anbindung und Standardkonformität erforderlich sind, lege die Namespaces als reales URI-Schema fest und pflege die OWL-Schema-Dokumente ebenfalls.
Tests
pytest # 단위 테스트 (Fuseki 불필요)
RUN_INTEGRATION=1 pytest # Fuseki 기동 상태에서 통합 테스트 포함Aufbau
Pfad | Rolle |
| Framework zur Definition von Object/Link Type (Palantir-artig) |
| Beispiel-Ontologie — die Datei, die im Projekt ersetzt wird |
| SPARQL-1.1-Client (Stelle, an der der Datenspeicher ersetzt werden kann) |
| REST-Adapter |
| MCP-Adapter |
| Erfassungspipeline von Wissensquellen → RDF |
| Fuseki-Start |
Lizenz
MIT
Available Tools
3 toolslist_object_typesA
온톨로지에 정의된 Object Type·Link Type 전체를 반환한다. 질의 전에 먼저 호출해 스키마를 파악할 것.
Inputs: no named parameters. Returns: result
search_objectsB
지정한 Object Type의 인스턴스를 조회한다. object_type은 list_object_types의 api_name.
Inputs: object_type (required), limit. Returns: result
sparql_queryA
읽기 전용 SPARQL(SELECT/ASK/CONSTRUCT/DESCRIBE)을 직접 실행한다. 복잡한 관계 질의용.
Inputs: query (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a distinct purpose: schema discovery, instance search, and raw SPARQL querying. There is no overlap between them.
Tool names follow a consistent verb_noun pattern (list_object_types, search_objects, sparql_query). sparql_query is slightly less parallel because it uses a noun rather than a verb, but it is still clear and predictable.
Three tools is a minimal but reasonable set for an ontology server: schema listing, instance search, and flexible SPARQL access. It is on the thin side but not inadequate.
The surface covers schema discovery, instance lookup, and arbitrary read-only queries, which covers most ontology use cases. Missing write operations are likely intentional for a read-only server, so the gap is minor.
Related MCP Connectors
Query your own knowledge graph from any MCP client. The graph lives in a database you own.
Knowledge graph for AI agents. Query concepts, walk edges, get advisories.
Read-only search of your Sortio knowledge graph (files and entities) for Claude and ChatGPT.
Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides read-only access to Ontotext GraphDB, enabling LLMs to explore RDF graphs and execute SPARQL queries.29 npm17GPL 3.0
- AlicenseAqualityDmaintenanceEnables AI assistants to query the Ubergraph biomedical ontology SPARQL endpoint with tools for custom SPARQL queries, term lookup, search, and hierarchy traversal.4MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with ontologies through the Ontology Access Kit, providing ontology querying and management capabilities.5MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to query, modify, and reason over OWL/TTL/RDF ontology files using natural language, without needing SPARQL or OWL syntax.146MIT