概要
Semantica はセルフホスト型の Python フレームワークで、エンタープライズデータをクエリ可能なコンテキスト/ナレッジグラフとして取り込み、決定論的推論、意思決定インテリジェンス、W3C PROV-O によるプロベナンスを提供します。RDF とプロパティグラフをサポートし、Databricks/Snowflake コネクタを内蔵し、可視化、REST API、CLI、MCP サービスを提供することで、監査可能な AI システムを構築します。
README プレビュー
\n\n\n\n### Graph-Native Infrastructure for Context and Accountable AI Systems\n\n#### *The Open Source Palantir for AI Agents*\n\n> Ingest your enterprise data, extract what matters, build a Context Graph and knowledge graph (KG), and run graph analytics and causal reasoning over all of it, with full decision provenance baked in. Explainable, traceable, and trustworthy by design.\n\n**Decision Intelligence · Context Management · Deterministic Reasoning · Ontology Management · Knowledge Modeling · End-to-End Traceability**\n\n**Open Source · Self-Hostable · Auditable · Governed · Zero Vendor Lock-In**\n\n**Polyglot Graph Storage · RDF & LPG Support · W3C Standards · Interoperable**\n\n#### Built for High-Stakes, Regulated Domains\n\n[](https://github.com/semantica-agi/semantica) [](https://github.com/semantica-agi/semantica/network/members) [](https://github.com/semantica-agi/semantica/graphs/contributors) [](https://pypi.org/project/semantica/) [](https://pepy.tech/project/semantica) [](https://www.python.org/) [](https://opensource.org/licenses/MIT) [](https://github.com/semantica-agi/semantica/actions) [](https://deepwiki.com/semantica-agi/semantica)\n\n[](https://getsemantica.ai/) [](https://docs.getsemantica.ai/) [](https://discord.gg/sV34vps5hH) [](https://x.com/BuildSemantica) [](https://www.youtube.com/watch?v=QfnNZg4-dZA) [](CHANGELOG.md)\n\n```bash\npip install semantica\n```\n\n\n\n---\n\n\n\n\n\n\n\n*Knowledge Explorer · Context Graphs · Reasoning Engine · Decision Intelligence · Ontology Hub*\n\n**[▶ Watch the full platform walkthrough](https://www.youtube.com/watch?v=QfnNZg4-dZA)**\n\n\n\n---\n\nMost AI agents act without a trail. They store embeddings, not meaning: context that can't be explained, decisions that can't be audited. In lending, that gap is a compliance exposure, not an inconvenience: an underwrit
FAQ (5)
トラブル対応カスタムポートで semantica-explorer を実行する際に発生する Explorer WebSocket 403 "connection rejected" エラーを修正するにはどうすればよいですか?
Explorer を起動する前に、ALLOWED_ORIGINS(または EXPLORER_CORS_ORIGINS)にブラウザの正確なオリジンを含めて設定してください。デフォルトでは http://localhost:5173 と http://127.0.0.1:5173 のみが許可されており、同じ許可リストが /ws/graph-updates の WebSocket ハンドシェイクを制御します。
ポート 8020 の場合、以下を実行します:
ALLOWED_ORIGINS="http://127.0.0.1:8020,http://localhost:8020" \
semantica-explorer --graph any_graph.json --port 8020
その後、http://127.0.0.1:8020 を開き、変数を変更した後はサーバーを再起動してください。この問題は Semantica 0.6.7 で確認されました。
トラブル対応graph-embeddings extra なしで Semantica のテストを実行した際に発生する "ImportError: gensim is required for Node2Vec" エラーを修正するにはどうすればよいですか?
オプションの依存関係をインストールするか、slim-core 環境では Node2Vec テストをスキップしてください。
完全なテスト環境の場合:
pip install -e ".[dev,graph-embeddings]"これにより
gensim>=4.4.0 がインストールされます。これがインストールされていれば、影響を受けるすべての Node2Vec テストがパスするはずです。
gensim が意図的に存在しない場合は、影響を受ける各テストモジュールの先頭に次のガードを追加してください:
pytest.importorskip("gensim") # Node2Vec requires semantica[graph-embeddings]以下のファイルにある 8 つのテストに適用してください:
-
tests/context/test_banking_context_graphs_e2e.py-
tests/context/test_context_explainability_regression.py-
tests/kg/test_enhanced_algorithms_e2e.py-
tests/kg/test_provenance_integration.py-
tests/test_030_realworld_comprehensive.py-
tests/vector_store/test_decision_embedding_pipeline.py
gensim チェックを NodeEmbedder.__init__ から _train_word2vec() に移動しないでください: slim-core の契約は、呼び出し元が Node2Vec を適切に無効化できるよう、コンストラクタが例外を送出することに意図的に依存しています。この動作を必要とするテストは、test_node_embedder_gensim_missing_hint、test_agent_context_with_graph_builds_without_gensim、および test_graph_components_without_gensim_keep_everything_but_node2vec です。
トラブル対応クリーンな dev インストールで tests/kg/test_node_embeddings.py の pytest ImportError "gensim is required for Node2Vec" を修正するにはどうすればよいですか?
virtualenv にオプションの依存関係をインストールします:
pip install -e ".[graph-embeddings]"
または、リリース済みパッケージの場合:
pip install "semantica[graph-embeddings]"
その後、再実行します:
python -m pytest tests/kg/test_node_embeddings.py -q
リポジトリのテスト修正については、test_init_gensim_unavailable と test_init_invalid_method は gensim なしで実行する必要があるため、モジュールレベルの pytest.importorskip("gensim") は追加しないでください。代わりに次のようにします:
1. pyproject.toml にマーカーを登録します:
[tool.pytest.ini_options]
markers = [
"no_gensim: test runs without the optional gensim dependency"
]
2. テストが no_gensim でマークされていない限り、gensim に依存するテストをスキップする autouse フィクスチャを追加します:
import pytest
from semantica.kg.node_embeddings import GENSIM_AVAILABLE
@pytest.fixture(autouse=True)
def require_gensim(request):
if not GENSIM_AVAILABLE and "no_gensim" not in request.keywords:
pytest.skip("Install semantica[graph-embeddings] to run Node2Vec tests")
3. test_init_gensim_unavailable と test_init_invalid_method に @pytest.mark.no_gensim を付けます。
gensim なしの場合の期待される結果: 2 passed, 31 skipped。gensim がインストールされている場合: 33 件のテストがすべて成功します。
トラブル対応なぜ Semantica の CSVExporter export_relationships は Neo4j/FalkorDB/Neptune/AGE のエッジに対して空の source_id および target_id カラムを出力するのですか?
CSVExporter.export_relationships() は、エンドポイントのフィールド名として source/source_id と target/target_id のみを認識します。バックエンド形式のレコードでは start_node_id/end_node_id(Neo4j、FalkorDB、Neptune、およびリネームされた AGE エッジ)または start_id/end_id(生の AGE)が使用されるため、正規化パスはエラーや警告なしに空のエンドポイント列を暗黙的に書き込みます。修正方法/回避策:
1. **修正(パッチ)**: semantica/export/csv_exporter.py(export_relationships)で、メソッドの先頭でレコードを semantica/export/endpoint_names.py の canonical_endpoints(SOURCE_ENDPOINT_NAMES/TARGET_ENDPOINT_NAMES を定義)に通します。これは Parquet および Arrow エクスポーターがすでに採用しているのと同じアプローチです。これにより、source/target および source_id/target_id を従来どおり動作させたまま、すべてのバックエンドの表記を source_id/target_id にマッピングします。
2. **回避策(コード変更なし)**: エクスポート前にフィールド名を変更します:
record = {"id": "r1", "start_node_id": "alice", "end_node_id": "acme", "type": "WORKS_AT"}
record["source_id"], record["target_id"] = record.pop("start_node_id"), record.pop("end_node_id")
CSVExporter().export_relationships([record], "rel.csv")
3. **代替パス**: export({"edges": [record]}) は値を保持しますが、正規化を行わず元の列名(start_node_id/end_node_id)で書き込みます。Parquet および Arrow エクスポーターは影響を受けません。
トラブル対応FileIngestorからのFileObjectsを使用すると、GraphBuilder.build()が空のグラフを返すのはなぜですか?
FileObject インスタンスは、GraphBuilder._process_item() がそれらを認識しないため、暗黙的にスキップされます。GraphBuilder._process_item() はテキスト文字列または {"text": ...} のような辞書を想定しています。回避策として、グラフを構築する前に、取り込まれた各 FileObject を変換してください:
docs = FileIngestor().ingest_directory("./docs/", recursive=True)
kg = GraphBuilder(merge_entities=True, enable_temporal=True).build(
[{"text": d.text} for d in docs]
)
PR #1951 における恒久的な修正により、build() が FileObject.text から直接テキストを抽出するようになり、サポートされていないソースタイプを暗黙的にスキップする代わりに、それらの名前を示す警告をログに記録するようになりました。PR #1951 を含むリリースに更新するか、main から実行している場合はその変更を適用してください。