textgraph-kg 3.2.0__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/CHANGELOG.md +40 -0
- textgraph_kg-3.3.0/LICENSE +21 -0
- textgraph_kg-3.2.0/README.md → textgraph_kg-3.3.0/PKG-INFO +143 -9
- textgraph_kg-3.2.0/PKG-INFO → textgraph_kg-3.3.0/README.md +51 -80
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/COMPARISON_SEMANTICA.md +3 -2
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/RUNNING.md +10 -4
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/pyproject.toml +27 -1
- textgraph_kg-3.3.0/tests/unit/test_export_rdf.py +95 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/__init__.py +1 -1
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/cli.py +20 -4
- textgraph_kg-3.3.0/textgraph/l9_artifacts/ontology.py +125 -0
- textgraph_kg-3.3.0/textgraph/l9_artifacts/rdf.py +125 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/uv.lock +4 -4
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.gitattributes +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/benchmark.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/determinism.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/lint-and-typecheck.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/pages.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/pre-commit.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/publish-pypi.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/release.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.github/workflows/test.yml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.gitignore +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/.pre-commit-config.yaml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/ARCHITECTURE.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/BENCHMARKS.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/PLAN.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/SECURITY.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/TextGraph Architecture Gap Analysis.docx +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/TextGraph_Engineering_Blueprint.pdf +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/quality.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/reasoning.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/retrieval.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/run.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/benchmarks/security.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/SKILL.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/how-it-works.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/plans/chat-console.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/plans/neo4j-backend.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/retrieval-routing.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/docs/site/index.html +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/requirements-dev.txt +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/requirements-full.txt +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/requirements.txt +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/schema/graph.schema.json +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/schema/manifest.schema.json +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/schema/schema.yaml +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/schema/validate.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/determinism/test_byte_identical.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/README.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/adr/adr-0007-case-linking.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/adr/adr-0008-retention.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/chat/case-4471.chat +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/conflict/filing-a.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/conflict/filing-b.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/contradiction/filing.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/decision_chain/adr-0001-retention.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/decision_chain/adr-0002-citations.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/decision_chain/adr-0003-tooling.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/docs/aml-overview.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/docs/shell-company.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/docs/wire-transfers.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/secure/public.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/secure/secret.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpora/temporal/correction.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpus_docs/adr-0001.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpus_docs/mixed-encoding.log +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/corpus_docs/notes.txt +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/fixtures/er/aliases.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_agent_session.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_artifacts.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_duckdb_store.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_edge_provenance.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_er_pipeline.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_ie_pipeline.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_incremental.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_incremental_stress.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_provenance_integrity.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_quality_benchmark.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_report_corpora.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/integration/test_security_redteam.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_canonical_doc.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_canonical_json.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_chat.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_chat_decisions.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_cli.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_config.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_conflicts.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_console.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_content_address.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_decision_chain.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_decisions.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_dense.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_doctor.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_gliner_backend.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_got.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_gql.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_ingest.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_integrations.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l0_ingest.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l1_structure.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l2_linguistic.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l3_encoder_ie.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l4_llm.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l5_resolution.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l6_claims.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l7_analytics.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l7_layout.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_l8_retrieval.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_llm_augment.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_mcp_tools.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_offsets.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_richdocs.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_routing.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_security.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/tests/unit/test_vision.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/api.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/chat.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/ingest.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/page.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/renderer.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/console/server.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/canonical_doc.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/canonical_json.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/config.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/content_address.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/incremental.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/layout.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/core/offsets.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/doctor.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/got/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/got/reason.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/got/thought.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/ast.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/engine.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/errors.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/parser.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/gql/tokenizer.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/integrations/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/integrations/adapters.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/base.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/dispatch.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/logs.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/markdown.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/plaintext.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/richdocs.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/structured.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l0_ingest/transcript.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l1_structure/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l1_structure/decisions.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l1_structure/emit.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l1_structure/structure.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l2_linguistic/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l2_linguistic/negation.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l2_linguistic/sentences.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/canonicalize.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/emit_ie.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/extract.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/gliner_backend.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/model.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l3_encoder_ie/rules.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l4_llm_optional/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l4_llm_optional/cache.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l4_llm_optional/client.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l4_llm_optional/extract.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l4_llm_optional/synthesize.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/audit.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/blocking.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/clustering.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/emit_er.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/metrics.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/model.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/resolve.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/scoring.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/similarity.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l5_entity_resolution/splink_backend.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l6_graph_model/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l6_graph_model/claims.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l6_graph_model/conflicts.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l6_graph_model/temporal.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/algorithms.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/analyze.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/communities.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/enrich.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l7_analytics/layout.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/bm25.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/dense.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/emit_chunks.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/engine.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/grounding.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/model.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/narrate.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/rerank.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/routing.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/vision/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/vision/embed.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/vision/maxsim.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l8_retrieval/vision/retriever.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/analytics_lite.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/artifacts.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/graph_html.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/graph_json.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/prov.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/l9_artifacts/report.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/mcp/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/mcp/server.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/mcp/tools.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/pipeline.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/security/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/security/abac.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/security/context.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/security/policy.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/security/rebac.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/store/__init__.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/store/base.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/store/duckdb_store.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/store/memory.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph/watch.py +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/textgraph-engineering-research.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/ui/graph_html/README.md +0 -0
- {textgraph_kg-3.2.0 → textgraph_kg-3.3.0}/ui/pipeline_console/README.md +0 -0
|
@@ -6,6 +6,46 @@ to Semantic Versioning.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [3.3.0] - 2026-08-08
|
|
10
|
+
|
|
11
|
+
**Semantic-web interop — closing the RDF / ontology gap with polyglot peers.** New
|
|
12
|
+
deterministic, dependency-free exports so the graph loads into any triple store and
|
|
13
|
+
validates in any semantic-web toolchain.
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **RDF/Turtle export** — `textgraph export --format rdf` emits the whole graph as Turtle
|
|
17
|
+
(loads into Oxigraph / Apache Jena / RDF4J / any SPARQL store): nodes typed by their
|
|
18
|
+
labels, relations as `tgr:` predicates, and **every cited edge reified as an
|
|
19
|
+
`rdf:Statement`** carrying the `ConfidenceTag` + the re-verifiable byte span
|
|
20
|
+
(`prov:wasDerivedFrom`, `tgo:sourceStart/End/Hash`) — provenance survives the round-trip
|
|
21
|
+
(G3). Validated with rdflib; pure-string, no RDF dependency.
|
|
22
|
+
- **OWL vocabulary export** — `--format owl` emits `owl:Class` per node label,
|
|
23
|
+
`owl:ObjectProperty` per relation predicate (with induced `rdfs:domain`/`range`), and
|
|
24
|
+
`owl:DatatypeProperty` per scalar key.
|
|
25
|
+
- **SHACL shapes export** — `--format shacl` emits a `sh:NodeShape` per class with
|
|
26
|
+
constraints (label cardinality, per-predicate `sh:class`) **induced from the actual data**
|
|
27
|
+
— validate the graph in pySHACL / TopBraid / Jena.
|
|
28
|
+
|
|
29
|
+
All four export formats (`rdf`, `owl`, `shacl`, `prov-o`) are byte-deterministic (G1).
|
|
30
|
+
|
|
31
|
+
## [3.2.1] - 2026-08-08
|
|
32
|
+
|
|
33
|
+
**Packaging & presentation polish** (no code/API changes). Makes the PyPI page and repo
|
|
34
|
+
look the part next to [Semantica](docs/COMPARISON_SEMANTICA.md).
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **`LICENSE`** file (MIT) — so the license is detectable on GitHub and shipped in the sdist.
|
|
38
|
+
- **PyPI project metadata** — `[project.urls]` (Homepage / Repository / Documentation /
|
|
39
|
+
Changelog / Live demo / Bug Tracker → the PyPI sidebar) and trove `classifiers` (Python
|
|
40
|
+
versions, MIT, audiences, topics), plus `license-files`.
|
|
41
|
+
- **README** — a compact **TextGraph vs. Semantica** section (where TextGraph leads: byte-
|
|
42
|
+
identical builds, re-hashable citations, zero-LLM core; and the honest roadmap: RDF store,
|
|
43
|
+
OWL/SHACL, more providers/vector stores). A **Python-API** quick start alongside the CLI.
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- **Broken README badges** — the CI badge pointed at a non-existent `ci.yml`; replaced with
|
|
47
|
+
working **tests** + **determinism** workflow badges and an MIT license badge.
|
|
48
|
+
|
|
9
49
|
## [3.2.0] - 2026-08-08
|
|
10
50
|
|
|
11
51
|
**TextGraph 3.2 — LLM-augmented intelligence, without losing the moat.** Adds semantic
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 krishddd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,14 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: textgraph-kg
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: Turn any textual corpus into a queryable knowledge graph with byte-level provenance on every claim. Local-first, deterministic, zero-LLM-by-default.
|
|
5
|
+
Project-URL: Homepage, https://krishddd.github.io/Wiki_textgraph/
|
|
6
|
+
Project-URL: Repository, https://github.com/krishddd/Wiki_textgraph
|
|
7
|
+
Project-URL: Documentation, https://github.com/krishddd/Wiki_textgraph/blob/main/docs/RUNNING.md
|
|
8
|
+
Project-URL: Changelog, https://github.com/krishddd/Wiki_textgraph/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Live demo, https://krishddd.github.io/Wiki_textgraph/
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/krishddd/Wiki_textgraph/issues
|
|
11
|
+
Author: krishddd
|
|
12
|
+
License: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: deterministic,information-extraction,knowledge-graph,mcp,provenance,rag
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
18
|
+
Classifier: Intended Audience :: Legal Industry
|
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
26
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
28
|
+
Classifier: Typing :: Typed
|
|
29
|
+
Requires-Python: >=3.11
|
|
30
|
+
Requires-Dist: blake3>=0.4.1
|
|
31
|
+
Requires-Dist: markdown-it-py>=3.0.0
|
|
32
|
+
Requires-Dist: pypdf>=4.0.0
|
|
33
|
+
Requires-Dist: pyyaml>=6.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: jsonschema>=4.20.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pre-commit>=3.8.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
|
|
42
|
+
Provides-Extra: embed
|
|
43
|
+
Requires-Dist: sentence-transformers>=3.0.0; extra == 'embed'
|
|
44
|
+
Provides-Extra: er
|
|
45
|
+
Requires-Dist: duckdb>=1.0.0; extra == 'er'
|
|
46
|
+
Requires-Dist: splink>=4.0.0; extra == 'er'
|
|
47
|
+
Provides-Extra: full
|
|
48
|
+
Requires-Dist: docling>=2.0.0; extra == 'full'
|
|
49
|
+
Requires-Dist: drain3>=0.9.11; extra == 'full'
|
|
50
|
+
Requires-Dist: duckdb>=1.0.0; extra == 'full'
|
|
51
|
+
Requires-Dist: fastcoref>=2.1.6; extra == 'full'
|
|
52
|
+
Requires-Dist: gliner>=0.2.0; extra == 'full'
|
|
53
|
+
Requires-Dist: leidenalg>=0.10.0; extra == 'full'
|
|
54
|
+
Requires-Dist: mcp>=1.0.0; extra == 'full'
|
|
55
|
+
Requires-Dist: networkx>=3.2; extra == 'full'
|
|
56
|
+
Requires-Dist: pyarrow>=15.0.0; extra == 'full'
|
|
57
|
+
Requires-Dist: python-igraph>=0.11.0; extra == 'full'
|
|
58
|
+
Requires-Dist: spacy>=3.7.0; extra == 'full'
|
|
59
|
+
Requires-Dist: splink>=4.0.0; extra == 'full'
|
|
60
|
+
Requires-Dist: tree-sitter>=0.21.0; extra == 'full'
|
|
61
|
+
Provides-Extra: graph
|
|
62
|
+
Requires-Dist: duckdb>=1.0.0; extra == 'graph'
|
|
63
|
+
Requires-Dist: leidenalg>=0.10.0; extra == 'graph'
|
|
64
|
+
Requires-Dist: networkx>=3.2; extra == 'graph'
|
|
65
|
+
Requires-Dist: pyarrow>=15.0.0; extra == 'graph'
|
|
66
|
+
Requires-Dist: python-igraph>=0.11.0; extra == 'graph'
|
|
67
|
+
Provides-Extra: ie
|
|
68
|
+
Requires-Dist: fastcoref>=2.1.6; extra == 'ie'
|
|
69
|
+
Requires-Dist: gliner>=0.2.0; extra == 'ie'
|
|
70
|
+
Requires-Dist: spacy>=3.7.0; extra == 'ie'
|
|
71
|
+
Provides-Extra: ingest
|
|
72
|
+
Requires-Dist: docling>=2.0.0; extra == 'ingest'
|
|
73
|
+
Requires-Dist: drain3>=0.9.11; extra == 'ingest'
|
|
74
|
+
Requires-Dist: tree-sitter>=0.21.0; extra == 'ingest'
|
|
75
|
+
Provides-Extra: langchain
|
|
76
|
+
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
|
|
77
|
+
Provides-Extra: llamaindex
|
|
78
|
+
Requires-Dist: llama-index-core>=0.11.0; extra == 'llamaindex'
|
|
79
|
+
Provides-Extra: mcp
|
|
80
|
+
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
81
|
+
Provides-Extra: neo4j
|
|
82
|
+
Requires-Dist: neo4j>=5.0.0; extra == 'neo4j'
|
|
83
|
+
Provides-Extra: ocr
|
|
84
|
+
Requires-Dist: rapidocr-onnxruntime>=1.3.0; extra == 'ocr'
|
|
85
|
+
Provides-Extra: rerank
|
|
86
|
+
Requires-Dist: sentence-transformers>=3.0.0; extra == 'rerank'
|
|
87
|
+
Provides-Extra: security
|
|
88
|
+
Requires-Dist: openfga-sdk>=0.5.0; extra == 'security'
|
|
89
|
+
Provides-Extra: vision
|
|
90
|
+
Requires-Dist: colpali-engine>=0.3.0; extra == 'vision'
|
|
91
|
+
Description-Content-Type: text/markdown
|
|
92
|
+
|
|
1
93
|
# TextGraph
|
|
2
94
|
|
|
3
|
-
[](https://pypi.org/project/textgraph-kg/)
|
|
95
|
+
[](https://pypi.org/project/textgraph-kg/)
|
|
4
96
|
[](https://pypi.org/project/textgraph-kg/)
|
|
5
|
-
[](https://github.com/krishddd/Wiki_textgraph/actions/workflows/test.yml)
|
|
98
|
+
[](https://github.com/krishddd/Wiki_textgraph/actions/workflows/determinism.yml)
|
|
99
|
+
[](https://krishddd.github.io/Wiki_textgraph/)
|
|
100
|
+
[](LICENSE)
|
|
8
101
|
|
|
9
102
|
> Turn a pile of case documents into a **queryable knowledge graph with byte-level provenance on every claim** — local-first, deterministic, and agent-legible.
|
|
10
103
|
>
|
|
11
|
-
>
|
|
104
|
+
> **`pip install textgraph-kg`** · **[Live demo →](https://krishddd.github.io/Wiki_textgraph/)** · **[vs. Semantica →](docs/COMPARISON_SEMANTICA.md)**
|
|
12
105
|
|
|
13
106
|
TextGraph is built to help investigators make sense of **financial-crime and technical-crime** evidence: filings, contracts, wire-transfer logs, SARs, memos, chat/email exports, and reports. It ingests that corpus and emits a structured, versioned graph that shows **who is connected to whom, through what, and — crucially — *why*** — with every edge carrying the exact source span that supports it, so a finding can be re-verified and stands up to audit.
|
|
14
107
|
|
|
@@ -26,6 +119,26 @@ Most GraphRAG tools build the graph *with an LLM*: extraction is non-determinist
|
|
|
26
119
|
|
|
27
120
|
Local-first / DuckDB stays the default; a graph DB (Neo4j) is an *optional* scale-out backend, never required. The trade is deliberate: the deterministic default caps peak recall vs an LLM extractor, which is exactly why the higher-recall `[ie]` and opt-in LLM paths exist — but the reproducibility and re-verifiable citations are the moat.
|
|
28
121
|
|
|
122
|
+
## TextGraph vs. Semantica
|
|
123
|
+
|
|
124
|
+
[Semantica](https://github.com/semantica-agi/semantica) is the closest peer — same regulated-domain focus, PROV-O provenance, decision intelligence (`record_decision` / `trace_decision_chain` / `find_similar_decisions`), conflict detection, and bi-temporal facts. Independent convergence on the same shape is a good sign. Here's the honest split ([full comparison →](docs/COMPARISON_SEMANTICA.md)):
|
|
125
|
+
|
|
126
|
+
**✅ Where TextGraph leads**
|
|
127
|
+
|
|
128
|
+
- **Byte-identical builds, gated in CI** — diff two runs, reproduce any finding. (Semantica guarantees deterministic *reasoning*, not a byte-identical *build*.)
|
|
129
|
+
- **Re-hashable byte-span citations** — every non-generated edge re-verifies against source bytes; 100% re-verify is gated. (Stronger than document/field-level provenance.)
|
|
130
|
+
- **Zero-LLM, dependency-free core** — the whole default pipeline runs CPU-only, no API key, no vector DB. LLM/embeddings are opt-in and `GENERATED`-quarantined.
|
|
131
|
+
- **Interop with provenance intact** — `textgraph export` emits **RDF/Turtle** (loads into Oxigraph/Jena/any SPARQL store, with cited spans as reified `rdf:Statement`s), an **OWL** vocabulary, a **SHACL** shapes graph, and a **PROV-O** decision trail — all deterministic.
|
|
132
|
+
|
|
133
|
+
**🧭 Where to improve (roadmap)**
|
|
134
|
+
|
|
135
|
+
- **LPG storage backends** — Semantica is polyglot (RDF *and* labeled-property graphs: Neo4j/Neptune/AGE). TextGraph now exports RDF and has a Neo4j design; a live LPG driver is next.
|
|
136
|
+
- **Rule reasoning** — Semantica has Datalog/Rete/SPARQL. TextGraph has typed labels, Graph-of-Thoughts, GQL, and now OWL/SHACL export for external validators; an embedded forward-chaining rule engine is on the roadmap.
|
|
137
|
+
- **Provider & vector-store breadth** — Semantica spans LiteLLM providers and FAISS/Qdrant/Weaviate/Milvus. TextGraph ships one OpenAI-compatible client (chat + embeddings) + a cosine index; more backends welcome.
|
|
138
|
+
- **Ecosystem polish** — Semantica has a hosted docs site and published benchmarks. TextGraph has an **MCP server**, a **REST API** (the console's `/api/*`), a **live demo**, and honest fixture benchmarks ([BENCHMARKS.md](BENCHMARKS.md)) — and is growing the rest.
|
|
139
|
+
|
|
140
|
+
The design rule that keeps the moat while closing the gap: **the LLM augments, it never becomes ground truth** — anything model-authored is `GENERATED`-tagged next to its re-verifiable citations.
|
|
141
|
+
|
|
29
142
|
## Who it's for
|
|
30
143
|
|
|
31
144
|
- **Financial-crime analysts** — trace structuring/layering, link cases through a shared beneficial owner, follow the money across accounts, and answer *why* two cases are related with a cited path.
|
|
@@ -56,11 +169,32 @@ Unknown extensions fall back to plain text; a format needing a missing extra is
|
|
|
56
169
|
> how to open the interactive UI.
|
|
57
170
|
|
|
58
171
|
```bash
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
pip install -r requirements.txt && pip install -e .
|
|
62
|
-
# (or, with uv: uv sync — then prefix commands with `uv run`)
|
|
172
|
+
pip install textgraph-kg # the import package + CLI are named `textgraph`
|
|
173
|
+
```
|
|
63
174
|
|
|
175
|
+
**Python API** — build once, then call the eight typed, cited tools:
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from textgraph.pipeline import build
|
|
179
|
+
from textgraph.l8_retrieval import QueryEngine
|
|
180
|
+
|
|
181
|
+
result = build("./case-files") # deterministic; byte-identical graph.json
|
|
182
|
+
engine = QueryEngine(result.nodes, result.edges)
|
|
183
|
+
|
|
184
|
+
hits = engine.search("who transferred funds to whom", k=5)
|
|
185
|
+
for h in hits.hits:
|
|
186
|
+
print(h.name, "→", [c.ref() for c in h.citations]) # every hit re-verifiable
|
|
187
|
+
|
|
188
|
+
engine.path("Acme Corp", "Gamma Holdings") # max-likelihood cited path
|
|
189
|
+
engine.why("Acme Corp") # cited claims + validity windows
|
|
190
|
+
engine.conflicts() # single-truth conflicts, surfaced not merged
|
|
191
|
+
engine.trace_decision_chain("beneficial owner policy") # decision lineage
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**CLI** — the same tools from the shell:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# ...or from source (dev): pip install -r requirements.txt && pip install -e .
|
|
64
198
|
textgraph build ./case-files -o textgraph-out
|
|
65
199
|
# → textgraph-out/graph.json, GRAPH_REPORT.md, graph.html, schema.yaml, manifest.json
|
|
66
200
|
|
|
@@ -1,85 +1,15 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: textgraph-kg
|
|
3
|
-
Version: 3.2.0
|
|
4
|
-
Summary: Turn any textual corpus into a queryable knowledge graph with byte-level provenance on every claim. Local-first, deterministic, zero-LLM-by-default.
|
|
5
|
-
Author: krishddd
|
|
6
|
-
License: MIT
|
|
7
|
-
Keywords: deterministic,information-extraction,knowledge-graph,mcp,provenance,rag
|
|
8
|
-
Requires-Python: >=3.11
|
|
9
|
-
Requires-Dist: blake3>=0.4.1
|
|
10
|
-
Requires-Dist: markdown-it-py>=3.0.0
|
|
11
|
-
Requires-Dist: pypdf>=4.0.0
|
|
12
|
-
Requires-Dist: pyyaml>=6.0
|
|
13
|
-
Provides-Extra: dev
|
|
14
|
-
Requires-Dist: jsonschema>=4.20.0; extra == 'dev'
|
|
15
|
-
Requires-Dist: mypy>=1.11.0; extra == 'dev'
|
|
16
|
-
Requires-Dist: pre-commit>=3.8.0; extra == 'dev'
|
|
17
|
-
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
18
|
-
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
19
|
-
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
20
|
-
Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
|
|
21
|
-
Provides-Extra: embed
|
|
22
|
-
Requires-Dist: sentence-transformers>=3.0.0; extra == 'embed'
|
|
23
|
-
Provides-Extra: er
|
|
24
|
-
Requires-Dist: duckdb>=1.0.0; extra == 'er'
|
|
25
|
-
Requires-Dist: splink>=4.0.0; extra == 'er'
|
|
26
|
-
Provides-Extra: full
|
|
27
|
-
Requires-Dist: docling>=2.0.0; extra == 'full'
|
|
28
|
-
Requires-Dist: drain3>=0.9.11; extra == 'full'
|
|
29
|
-
Requires-Dist: duckdb>=1.0.0; extra == 'full'
|
|
30
|
-
Requires-Dist: fastcoref>=2.1.6; extra == 'full'
|
|
31
|
-
Requires-Dist: gliner>=0.2.0; extra == 'full'
|
|
32
|
-
Requires-Dist: leidenalg>=0.10.0; extra == 'full'
|
|
33
|
-
Requires-Dist: mcp>=1.0.0; extra == 'full'
|
|
34
|
-
Requires-Dist: networkx>=3.2; extra == 'full'
|
|
35
|
-
Requires-Dist: pyarrow>=15.0.0; extra == 'full'
|
|
36
|
-
Requires-Dist: python-igraph>=0.11.0; extra == 'full'
|
|
37
|
-
Requires-Dist: spacy>=3.7.0; extra == 'full'
|
|
38
|
-
Requires-Dist: splink>=4.0.0; extra == 'full'
|
|
39
|
-
Requires-Dist: tree-sitter>=0.21.0; extra == 'full'
|
|
40
|
-
Provides-Extra: graph
|
|
41
|
-
Requires-Dist: duckdb>=1.0.0; extra == 'graph'
|
|
42
|
-
Requires-Dist: leidenalg>=0.10.0; extra == 'graph'
|
|
43
|
-
Requires-Dist: networkx>=3.2; extra == 'graph'
|
|
44
|
-
Requires-Dist: pyarrow>=15.0.0; extra == 'graph'
|
|
45
|
-
Requires-Dist: python-igraph>=0.11.0; extra == 'graph'
|
|
46
|
-
Provides-Extra: ie
|
|
47
|
-
Requires-Dist: fastcoref>=2.1.6; extra == 'ie'
|
|
48
|
-
Requires-Dist: gliner>=0.2.0; extra == 'ie'
|
|
49
|
-
Requires-Dist: spacy>=3.7.0; extra == 'ie'
|
|
50
|
-
Provides-Extra: ingest
|
|
51
|
-
Requires-Dist: docling>=2.0.0; extra == 'ingest'
|
|
52
|
-
Requires-Dist: drain3>=0.9.11; extra == 'ingest'
|
|
53
|
-
Requires-Dist: tree-sitter>=0.21.0; extra == 'ingest'
|
|
54
|
-
Provides-Extra: langchain
|
|
55
|
-
Requires-Dist: langchain-core>=0.3.0; extra == 'langchain'
|
|
56
|
-
Provides-Extra: llamaindex
|
|
57
|
-
Requires-Dist: llama-index-core>=0.11.0; extra == 'llamaindex'
|
|
58
|
-
Provides-Extra: mcp
|
|
59
|
-
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
60
|
-
Provides-Extra: neo4j
|
|
61
|
-
Requires-Dist: neo4j>=5.0.0; extra == 'neo4j'
|
|
62
|
-
Provides-Extra: ocr
|
|
63
|
-
Requires-Dist: rapidocr-onnxruntime>=1.3.0; extra == 'ocr'
|
|
64
|
-
Provides-Extra: rerank
|
|
65
|
-
Requires-Dist: sentence-transformers>=3.0.0; extra == 'rerank'
|
|
66
|
-
Provides-Extra: security
|
|
67
|
-
Requires-Dist: openfga-sdk>=0.5.0; extra == 'security'
|
|
68
|
-
Provides-Extra: vision
|
|
69
|
-
Requires-Dist: colpali-engine>=0.3.0; extra == 'vision'
|
|
70
|
-
Description-Content-Type: text/markdown
|
|
71
|
-
|
|
72
1
|
# TextGraph
|
|
73
2
|
|
|
74
|
-
[](https://pypi.org/project/textgraph-kg/)
|
|
3
|
+
[](https://pypi.org/project/textgraph-kg/)
|
|
75
4
|
[](https://pypi.org/project/textgraph-kg/)
|
|
76
|
-
[](https://github.com/krishddd/Wiki_textgraph/actions/workflows/test.yml)
|
|
6
|
+
[](https://github.com/krishddd/Wiki_textgraph/actions/workflows/determinism.yml)
|
|
7
|
+
[](https://krishddd.github.io/Wiki_textgraph/)
|
|
8
|
+
[](LICENSE)
|
|
79
9
|
|
|
80
10
|
> Turn a pile of case documents into a **queryable knowledge graph with byte-level provenance on every claim** — local-first, deterministic, and agent-legible.
|
|
81
11
|
>
|
|
82
|
-
>
|
|
12
|
+
> **`pip install textgraph-kg`** · **[Live demo →](https://krishddd.github.io/Wiki_textgraph/)** · **[vs. Semantica →](docs/COMPARISON_SEMANTICA.md)**
|
|
83
13
|
|
|
84
14
|
TextGraph is built to help investigators make sense of **financial-crime and technical-crime** evidence: filings, contracts, wire-transfer logs, SARs, memos, chat/email exports, and reports. It ingests that corpus and emits a structured, versioned graph that shows **who is connected to whom, through what, and — crucially — *why*** — with every edge carrying the exact source span that supports it, so a finding can be re-verified and stands up to audit.
|
|
85
15
|
|
|
@@ -97,6 +27,26 @@ Most GraphRAG tools build the graph *with an LLM*: extraction is non-determinist
|
|
|
97
27
|
|
|
98
28
|
Local-first / DuckDB stays the default; a graph DB (Neo4j) is an *optional* scale-out backend, never required. The trade is deliberate: the deterministic default caps peak recall vs an LLM extractor, which is exactly why the higher-recall `[ie]` and opt-in LLM paths exist — but the reproducibility and re-verifiable citations are the moat.
|
|
99
29
|
|
|
30
|
+
## TextGraph vs. Semantica
|
|
31
|
+
|
|
32
|
+
[Semantica](https://github.com/semantica-agi/semantica) is the closest peer — same regulated-domain focus, PROV-O provenance, decision intelligence (`record_decision` / `trace_decision_chain` / `find_similar_decisions`), conflict detection, and bi-temporal facts. Independent convergence on the same shape is a good sign. Here's the honest split ([full comparison →](docs/COMPARISON_SEMANTICA.md)):
|
|
33
|
+
|
|
34
|
+
**✅ Where TextGraph leads**
|
|
35
|
+
|
|
36
|
+
- **Byte-identical builds, gated in CI** — diff two runs, reproduce any finding. (Semantica guarantees deterministic *reasoning*, not a byte-identical *build*.)
|
|
37
|
+
- **Re-hashable byte-span citations** — every non-generated edge re-verifies against source bytes; 100% re-verify is gated. (Stronger than document/field-level provenance.)
|
|
38
|
+
- **Zero-LLM, dependency-free core** — the whole default pipeline runs CPU-only, no API key, no vector DB. LLM/embeddings are opt-in and `GENERATED`-quarantined.
|
|
39
|
+
- **Interop with provenance intact** — `textgraph export` emits **RDF/Turtle** (loads into Oxigraph/Jena/any SPARQL store, with cited spans as reified `rdf:Statement`s), an **OWL** vocabulary, a **SHACL** shapes graph, and a **PROV-O** decision trail — all deterministic.
|
|
40
|
+
|
|
41
|
+
**🧭 Where to improve (roadmap)**
|
|
42
|
+
|
|
43
|
+
- **LPG storage backends** — Semantica is polyglot (RDF *and* labeled-property graphs: Neo4j/Neptune/AGE). TextGraph now exports RDF and has a Neo4j design; a live LPG driver is next.
|
|
44
|
+
- **Rule reasoning** — Semantica has Datalog/Rete/SPARQL. TextGraph has typed labels, Graph-of-Thoughts, GQL, and now OWL/SHACL export for external validators; an embedded forward-chaining rule engine is on the roadmap.
|
|
45
|
+
- **Provider & vector-store breadth** — Semantica spans LiteLLM providers and FAISS/Qdrant/Weaviate/Milvus. TextGraph ships one OpenAI-compatible client (chat + embeddings) + a cosine index; more backends welcome.
|
|
46
|
+
- **Ecosystem polish** — Semantica has a hosted docs site and published benchmarks. TextGraph has an **MCP server**, a **REST API** (the console's `/api/*`), a **live demo**, and honest fixture benchmarks ([BENCHMARKS.md](BENCHMARKS.md)) — and is growing the rest.
|
|
47
|
+
|
|
48
|
+
The design rule that keeps the moat while closing the gap: **the LLM augments, it never becomes ground truth** — anything model-authored is `GENERATED`-tagged next to its re-verifiable citations.
|
|
49
|
+
|
|
100
50
|
## Who it's for
|
|
101
51
|
|
|
102
52
|
- **Financial-crime analysts** — trace structuring/layering, link cases through a shared beneficial owner, follow the money across accounts, and answer *why* two cases are related with a cited path.
|
|
@@ -127,11 +77,32 @@ Unknown extensions fall back to plain text; a format needing a missing extra is
|
|
|
127
77
|
> how to open the interactive UI.
|
|
128
78
|
|
|
129
79
|
```bash
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
pip install -r requirements.txt && pip install -e .
|
|
133
|
-
# (or, with uv: uv sync — then prefix commands with `uv run`)
|
|
80
|
+
pip install textgraph-kg # the import package + CLI are named `textgraph`
|
|
81
|
+
```
|
|
134
82
|
|
|
83
|
+
**Python API** — build once, then call the eight typed, cited tools:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from textgraph.pipeline import build
|
|
87
|
+
from textgraph.l8_retrieval import QueryEngine
|
|
88
|
+
|
|
89
|
+
result = build("./case-files") # deterministic; byte-identical graph.json
|
|
90
|
+
engine = QueryEngine(result.nodes, result.edges)
|
|
91
|
+
|
|
92
|
+
hits = engine.search("who transferred funds to whom", k=5)
|
|
93
|
+
for h in hits.hits:
|
|
94
|
+
print(h.name, "→", [c.ref() for c in h.citations]) # every hit re-verifiable
|
|
95
|
+
|
|
96
|
+
engine.path("Acme Corp", "Gamma Holdings") # max-likelihood cited path
|
|
97
|
+
engine.why("Acme Corp") # cited claims + validity windows
|
|
98
|
+
engine.conflicts() # single-truth conflicts, surfaced not merged
|
|
99
|
+
engine.trace_decision_chain("beneficial owner policy") # decision lineage
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**CLI** — the same tools from the shell:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# ...or from source (dev): pip install -r requirements.txt && pip install -e .
|
|
135
106
|
textgraph build ./case-files -o textgraph-out
|
|
136
107
|
# → textgraph-out/graph.json, GRAPH_REPORT.md, graph.html, schema.yaml, manifest.json
|
|
137
108
|
|
|
@@ -23,8 +23,9 @@ for compliance-grade AI.
|
|
|
23
23
|
| **Extraction** | Rule + GLiNER (deterministic); **opt-in LLM relation enrichment** (v3.2). | NER/relation/event/triplet backends, LLM-assisted. |
|
|
24
24
|
| **Retrieval** | BM25 + Personalized-PageRank + **dense embeddings** (v3.2), RRF-fused. | Hybrid dense+sparse over FAISS/Qdrant/Weaviate/Milvus/… |
|
|
25
25
|
| **Answers** | Templated + cited by default; **opt-in grounded LLM synthesis** (v3.2). | Rule-engine justifications; explicitly avoids LLM prose for answers. |
|
|
26
|
-
| **Graph store** | DuckDB default;
|
|
27
|
-
| **Ontology** |
|
|
26
|
+
| **Graph store** | DuckDB default; **RDF/Turtle export** (loads into Oxigraph/Jena/any SPARQL store); Neo4j design. | Polyglot: RDF (Oxigraph/Jena/…) **and** LPG (Neo4j/Neptune/…), live. |
|
|
27
|
+
| **Ontology** | **OWL vocabulary + SHACL shapes export** (induced from the graph) + PROV-O. | OWL generation, SHACL validation, SKOS. |
|
|
28
|
+
| **Export formats** | `graph.json`, **RDF/Turtle**, **OWL**, **SHACL**, **PROV-O JSON-LD**, RDF-reified provenance. | RDF, OWL, Parquet, Cypher, JSON-LD, PROV-O. |
|
|
28
29
|
| **Reasoning** | Graph-of-Thoughts (complexity-gated), GQL. | Forward chaining, Rete, Datalog, SPARQL. |
|
|
29
30
|
| **Footprint** | Dependency-free core (stdlib); everything heavy behind extras. | Broader dependency surface (many backends/providers). |
|
|
30
31
|
| **Access control** | Built-in ReBAC/ABAC, security-aware retrieval. | Self-hosted; enterprise data-platform integrations. |
|
|
@@ -180,14 +180,20 @@ never deleted. Strategies: `most_recent`, `voting`, `credibility_weighted` (the
|
|
|
180
180
|
a `--credibility source_name.json` map). Bake a resolution into `graph.json` with
|
|
181
181
|
`textgraph build ./docs --resolve-conflicts voting`.
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
decision as a `prov:Activity`, cited to its source span, with `CAUSED`/`INFLUENCED`/
|
|
185
|
-
`PRECEDENT_FOR` links rendered as `prov:wasInformedBy`:
|
|
183
|
+
**Interoperable exports** — the graph as standard semantic-web artifacts, all deterministic:
|
|
186
184
|
|
|
187
185
|
```bash
|
|
188
|
-
textgraph export ./my-documents --format
|
|
186
|
+
textgraph export ./my-documents --format rdf -o graph.ttl # RDF/Turtle triple store
|
|
187
|
+
textgraph export ./my-documents --format owl -o ontology.ttl # OWL vocabulary
|
|
188
|
+
textgraph export ./my-documents --format shacl -o shapes.ttl # SHACL shapes
|
|
189
|
+
textgraph export ./my-documents --format prov-o -o decisions.jsonld # PROV-O decision trail
|
|
189
190
|
```
|
|
190
191
|
|
|
192
|
+
The **RDF/Turtle** export loads straight into Oxigraph, Apache Jena, RDF4J, or any SPARQL
|
|
193
|
+
store — and cited edges become reified `rdf:Statement`s carrying the re-verifiable byte span,
|
|
194
|
+
so provenance survives the round-trip. **PROV-O** renders each decision as a `prov:Activity`
|
|
195
|
+
with `CAUSED`/`INFLUENCED`/`PRECEDENT_FOR` as `prov:wasInformedBy`.
|
|
196
|
+
|
|
191
197
|
Run `textgraph --help` for the full list.
|
|
192
198
|
|
|
193
199
|
## 7. Running the tests (contributors)
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "textgraph-kg"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.3.0"
|
|
4
4
|
description = "Turn any textual corpus into a queryable knowledge graph with byte-level provenance on every claim. Local-first, deterministic, zero-LLM-by-default."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
license = { text = "MIT" }
|
|
8
|
+
license-files = ["LICENSE"]
|
|
8
9
|
authors = [{ name = "krishddd" }]
|
|
9
10
|
keywords = ["knowledge-graph", "provenance", "information-extraction", "mcp", "deterministic", "rag"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Development Status :: 5 - Production/Stable",
|
|
13
|
+
"Intended Audience :: Developers",
|
|
14
|
+
"Intended Audience :: Legal Industry",
|
|
15
|
+
"Intended Audience :: Financial and Insurance Industry",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
23
|
+
"Topic :: Text Processing :: Linguistic",
|
|
24
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
25
|
+
"Typing :: Typed",
|
|
26
|
+
]
|
|
27
|
+
|
|
10
28
|
dependencies = [
|
|
11
29
|
# Lean core: content addressing + pure-Python structural parsers.
|
|
12
30
|
# Everything heavy (Docling, tree-sitter, encoder models) lives behind extras.
|
|
@@ -19,6 +37,14 @@ dependencies = [
|
|
|
19
37
|
"pypdf>=4.0.0",
|
|
20
38
|
]
|
|
21
39
|
|
|
40
|
+
[project.urls]
|
|
41
|
+
Homepage = "https://krishddd.github.io/Wiki_textgraph/"
|
|
42
|
+
Repository = "https://github.com/krishddd/Wiki_textgraph"
|
|
43
|
+
Documentation = "https://github.com/krishddd/Wiki_textgraph/blob/main/docs/RUNNING.md"
|
|
44
|
+
Changelog = "https://github.com/krishddd/Wiki_textgraph/blob/main/CHANGELOG.md"
|
|
45
|
+
"Live demo" = "https://krishddd.github.io/Wiki_textgraph/"
|
|
46
|
+
"Bug Tracker" = "https://github.com/krishddd/Wiki_textgraph/issues"
|
|
47
|
+
|
|
22
48
|
[project.optional-dependencies]
|
|
23
49
|
# Higher-fidelity rich-document ingestion. Docling adds layout/table/OCR; tree-sitter/Drain3
|
|
24
50
|
# give deterministic structured-text/log parsing. (PDF text works without this — see core.)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""RDF / OWL / SHACL export — deterministic, valid Turtle triple-store artifacts."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from textgraph.cli import main
|
|
7
|
+
from textgraph.l9_artifacts.ontology import export_owl_bytes, export_shacl_bytes
|
|
8
|
+
from textgraph.l9_artifacts.rdf import export_rdf_bytes
|
|
9
|
+
from textgraph.pipeline import build
|
|
10
|
+
|
|
11
|
+
DOCS = Path(__file__).parent.parent / "fixtures" / "corpora" / "docs"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _built() -> object:
|
|
15
|
+
return build(DOCS)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# --- RDF (Turtle) ------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_rdf_has_prefixes_classes_and_relations() -> None:
|
|
22
|
+
r = _built()
|
|
23
|
+
ttl = export_rdf_bytes(r.nodes, r.edges).decode("utf-8")
|
|
24
|
+
assert ttl.startswith("@prefix")
|
|
25
|
+
assert "@prefix rdf:" in ttl and "@prefix prov:" in ttl
|
|
26
|
+
assert "a <https://textgraph.dev/class/" in ttl # node typed by its label
|
|
27
|
+
assert "<https://textgraph.dev/rel/" in ttl # relation predicate triples
|
|
28
|
+
assert ttl.endswith("\n")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_rdf_reifies_provenance_for_cited_edges() -> None:
|
|
32
|
+
r = _built()
|
|
33
|
+
ttl = export_rdf_bytes(r.nodes, r.edges).decode("utf-8")
|
|
34
|
+
# Cited edges become rdf:Statement with the re-verifiable byte span (G3).
|
|
35
|
+
assert "a rdf:Statement" in ttl
|
|
36
|
+
assert "tgo:sourceHash" in ttl and "prov:wasDerivedFrom" in ttl
|
|
37
|
+
assert "tgo:confidenceTag" in ttl
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_rdf_is_deterministic() -> None:
|
|
41
|
+
r = _built()
|
|
42
|
+
assert export_rdf_bytes(r.nodes, r.edges) == export_rdf_bytes(r.nodes, r.edges)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# --- OWL ---------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_owl_declares_classes_and_object_properties() -> None:
|
|
49
|
+
r = _built()
|
|
50
|
+
owl = export_owl_bytes(r.nodes, r.edges).decode("utf-8")
|
|
51
|
+
assert "owl:Class" in owl
|
|
52
|
+
assert "owl:ObjectProperty" in owl
|
|
53
|
+
assert "owl:DatatypeProperty" in owl # scalar property keys
|
|
54
|
+
assert export_owl_bytes(r.nodes, r.edges) == export_owl_bytes(r.nodes, r.edges)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# --- SHACL -------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def test_shacl_emits_node_shapes_per_class() -> None:
|
|
61
|
+
r = _built()
|
|
62
|
+
shacl = export_shacl_bytes(r.nodes, r.edges).decode("utf-8")
|
|
63
|
+
assert "sh:NodeShape" in shacl
|
|
64
|
+
assert "sh:targetClass" in shacl
|
|
65
|
+
assert "sh:property" in shacl and "sh:minCount 1" in shacl
|
|
66
|
+
assert export_shacl_bytes(r.nodes, r.edges) == export_shacl_bytes(r.nodes, r.edges)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# --- validity (optional, only if rdflib happens to be installed) -------------
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_all_exports_are_valid_turtle() -> None:
|
|
73
|
+
rdflib = pytest.importorskip("rdflib")
|
|
74
|
+
r = _built()
|
|
75
|
+
for fn in (export_rdf_bytes, export_owl_bytes, export_shacl_bytes):
|
|
76
|
+
g = rdflib.Graph()
|
|
77
|
+
g.parse(data=fn(r.nodes, r.edges).decode("utf-8"), format="turtle")
|
|
78
|
+
assert len(g) > 0 # parsed into real triples
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
# --- CLI ---------------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@pytest.mark.parametrize("fmt", ["rdf", "owl", "shacl"])
|
|
85
|
+
def test_export_cli_writes_file(fmt: str, tmp_path: Path) -> None:
|
|
86
|
+
out = tmp_path / f"graph.{fmt}"
|
|
87
|
+
assert main(["export", str(DOCS), "--format", fmt, "-o", str(out)]) == 0
|
|
88
|
+
body = out.read_text(encoding="utf-8")
|
|
89
|
+
assert body.startswith("@prefix") and body.endswith("\n")
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_export_cli_rdf_to_stdout(capsys: pytest.CaptureFixture[str]) -> None:
|
|
93
|
+
assert main(["export", str(DOCS), "--format", "rdf"]) == 0
|
|
94
|
+
out = capsys.readouterr().out
|
|
95
|
+
assert "@prefix tg:" in out and "class/" in out
|