rdf-construct 0.3.0__tar.gz → 0.4.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.
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/PKG-INFO +28 -6
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/README.md +27 -6
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/pyproject.toml +1 -1
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/__init__.py +1 -1
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cli.py +127 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/__init__.py +93 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/analyzer.py +176 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/documentation.py +146 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/formatters/__init__.py +47 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/formatters/json.py +65 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/formatters/markdown.py +275 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/formatters/text.py +315 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/hierarchy.py +232 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/imports.py +213 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/metadata.py +187 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/metrics.py +145 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/models.py +552 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/namespaces.py +180 -0
- rdf_construct-0.4.0/src/rdf_construct/describe/profiles.py +415 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/LICENSE +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/__main__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/ordering.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/predicate_order.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/profile.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/selector.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/serialiser.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/core/utils.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/expectations.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/formatters/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/formatters/json.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/formatters/junit.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/formatters/text.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/loader.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/cq/runner.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/change_types.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/comparator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/filters.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/formatters/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/formatters/json.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/formatters/markdown.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/diff/formatters/text.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/extractors.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/generator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/renderers/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/renderers/html.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/renderers/json.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/renderers/markdown.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/search.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/base.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/class.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/hierarchy.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/index.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/instance.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/namespaces.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/property.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/docs/templates/html/single_page.html.jinja +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/lint/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/lint/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/lint/engine.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/lint/formatters.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/lint/rules.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/extractor.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/formatters/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/formatters/markdown.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/formatters/text.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/merger.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/localise/reporter.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/main.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/conflicts.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/formatters.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/merger.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/migrator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/rules.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/merge/splitter.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/converter.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/merger.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/model.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/parser.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/puml2rdf/validators.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/deprecator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/formatters/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/formatters/text.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/refactor/renamer.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/shacl/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/shacl/config.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/shacl/converters.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/shacl/generator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/shacl/namespaces.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/collector.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/comparator.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/formatters/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/formatters/json.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/formatters/markdown.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/formatters/text.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/basic.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/complexity.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/connectivity.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/documentation.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/hierarchy.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/stats/metrics/properties.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/__init__.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/context.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/mapper.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/odm_renderer.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/renderer.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/uml_layout.py +0 -0
- {rdf_construct-0.3.0 → rdf_construct-0.4.0}/src/rdf_construct/uml/uml_style.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rdf-construct
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Semantic RDF manipulation toolkit - order, serialize, and diff RDF ontologies
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -50,6 +50,7 @@ Description-Content-Type: text/markdown
|
|
|
50
50
|
## Features
|
|
51
51
|
|
|
52
52
|
- **Semantic Ordering**: Serialise RDF/Turtle with intelligent ordering instead of alphabetical chaos
|
|
53
|
+
- **Ontology Description**: Quick orientation to unfamiliar ontologies with profile detection
|
|
53
54
|
- **Documentation Generation**: Create navigable HTML, Markdown, or JSON documentation from ontologies
|
|
54
55
|
- **UML Generation**: Create PlantUML class diagrams from RDF ontologies
|
|
55
56
|
- **PUML2RDF**: Convert PlantUML diagrams to RDF/OWL ontologies (diagram-first design)
|
|
@@ -64,6 +65,7 @@ Description-Content-Type: text/markdown
|
|
|
64
65
|
- **Ontology Statistics**: Comprehensive metrics with comparison mode
|
|
65
66
|
- **Flexible Styling**: Configure colours, layouts, and visual themes for diagrams
|
|
66
67
|
- **Profile-Based**: Define multiple strategies in YAML configuration
|
|
68
|
+
- **Multi-Format Input**: Supports Turtle, RDF/XML, JSON-LD, N-Triples
|
|
67
69
|
- **Deterministic**: Same input + profile = same output, always
|
|
68
70
|
|
|
69
71
|
## Why?
|
|
@@ -93,6 +95,19 @@ pip install -e .
|
|
|
93
95
|
poetry install
|
|
94
96
|
```
|
|
95
97
|
|
|
98
|
+
### Describe an Ontology
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Quick orientation to an unfamiliar ontology
|
|
102
|
+
rdf-construct describe ontology.ttl
|
|
103
|
+
|
|
104
|
+
# Brief summary (metadata + metrics + profile)
|
|
105
|
+
rdf-construct describe ontology.ttl --brief
|
|
106
|
+
|
|
107
|
+
# JSON output for scripting
|
|
108
|
+
rdf-construct describe ontology.ttl --format json
|
|
109
|
+
```
|
|
110
|
+
|
|
96
111
|
### Compare Ontology Versions
|
|
97
112
|
|
|
98
113
|
```bash
|
|
@@ -243,15 +258,16 @@ rdf-construct localise report ontology.ttl --languages en,de,fr
|
|
|
243
258
|
|
|
244
259
|
**For Users**:
|
|
245
260
|
- [Getting Started](docs/user_guides/GETTING_STARTED.md) - 5-minute quick start
|
|
261
|
+
- [Describe Guide](docs/user_guides/DESCRIBE_GUIDE.md) - Quick ontology orientation
|
|
246
262
|
- [Docs Guide](docs/user_guides/DOCS_GUIDE.md) - Documentation generation
|
|
247
263
|
- [UML Guide](docs/user_guides/UML_GUIDE.md) - Complete UML features
|
|
248
|
-
- [
|
|
264
|
+
- [PUML2RDF Guide](docs/user_guides/PUML2RDF_GUIDE.md) - Diagram-first design
|
|
249
265
|
- [SHACL Guide](docs/user_guides/SHACL_GUIDE.md) - SHACL shape generation
|
|
250
266
|
- [Diff Guide](docs/user_guides/DIFF_GUIDE.md) - Semantic ontology comparison
|
|
251
267
|
- [Lint Guide](docs/user_guides/LINT_GUIDE.md) - Ontology quality checking
|
|
252
268
|
- [CQ Testing Guide](docs/user_guides/CQ_TEST_GUIDE.md) - Competency question testing
|
|
253
269
|
- [Stats Guide](docs/user_guides/STATS_GUIDE.md) - Ontology metrics
|
|
254
|
-
- [Merge Guide](docs/user_guides/
|
|
270
|
+
- [Merge & Split Guide](docs/user_guides/MERGE_SPLIT_GUIDE.md) - Combining and modularising ontologies
|
|
255
271
|
- [Refactor Guide](docs/user_guides/REFACTOR_GUIDE.md) - Renaming and deprecation
|
|
256
272
|
- [Localise Guide](docs/user_guides/LOCALISE_GUIDE.md) - Multi-language translations
|
|
257
273
|
- [CLI Reference](docs/user_guides/CLI_REFERENCE.md) - All commands and options
|
|
@@ -409,7 +425,7 @@ properties:
|
|
|
409
425
|
|
|
410
426
|
## Project Status
|
|
411
427
|
|
|
412
|
-
**Current**: v0.
|
|
428
|
+
**Current**: v0.4.0 - Feature complete for core ontology workflows
|
|
413
429
|
**License**: MIT
|
|
414
430
|
|
|
415
431
|
### Implemented
|
|
@@ -425,10 +441,15 @@ properties:
|
|
|
425
441
|
✅ Ontology linting (11 rules)
|
|
426
442
|
✅ Competency question testing
|
|
427
443
|
✅ Ontology statistics
|
|
444
|
+
✅ Ontology merging and splitting
|
|
445
|
+
✅ Ontology refactoring (rename, deprecate)
|
|
446
|
+
✅ Multi-language translation management
|
|
447
|
+
✅ Ontology description and profile detection
|
|
448
|
+
✅ Multi-format input support (Turtle, RDF/XML, JSON-LD, N-Triples)
|
|
428
449
|
✅ Comprehensive documentation
|
|
429
450
|
|
|
430
451
|
### (Possible) Roadmap
|
|
431
|
-
- [ ]
|
|
452
|
+
- [ ] OWL 2 named profile detection (EL, RL, QL)
|
|
432
453
|
- [ ] Streaming mode for very large graphs
|
|
433
454
|
- [ ] Web UI for diagram configuration
|
|
434
455
|
- [ ] Additional lint rules
|
|
@@ -491,6 +512,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
491
512
|
|
|
492
513
|
---
|
|
493
514
|
|
|
494
|
-
**Status**: v0.
|
|
515
|
+
**Status**: v0.4.0
|
|
495
516
|
**Python**: 3.10+ required
|
|
496
517
|
**Maintainer**: See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
518
|
+
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
## Features
|
|
13
13
|
|
|
14
14
|
- **Semantic Ordering**: Serialise RDF/Turtle with intelligent ordering instead of alphabetical chaos
|
|
15
|
+
- **Ontology Description**: Quick orientation to unfamiliar ontologies with profile detection
|
|
15
16
|
- **Documentation Generation**: Create navigable HTML, Markdown, or JSON documentation from ontologies
|
|
16
17
|
- **UML Generation**: Create PlantUML class diagrams from RDF ontologies
|
|
17
18
|
- **PUML2RDF**: Convert PlantUML diagrams to RDF/OWL ontologies (diagram-first design)
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
- **Ontology Statistics**: Comprehensive metrics with comparison mode
|
|
27
28
|
- **Flexible Styling**: Configure colours, layouts, and visual themes for diagrams
|
|
28
29
|
- **Profile-Based**: Define multiple strategies in YAML configuration
|
|
30
|
+
- **Multi-Format Input**: Supports Turtle, RDF/XML, JSON-LD, N-Triples
|
|
29
31
|
- **Deterministic**: Same input + profile = same output, always
|
|
30
32
|
|
|
31
33
|
## Why?
|
|
@@ -55,6 +57,19 @@ pip install -e .
|
|
|
55
57
|
poetry install
|
|
56
58
|
```
|
|
57
59
|
|
|
60
|
+
### Describe an Ontology
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Quick orientation to an unfamiliar ontology
|
|
64
|
+
rdf-construct describe ontology.ttl
|
|
65
|
+
|
|
66
|
+
# Brief summary (metadata + metrics + profile)
|
|
67
|
+
rdf-construct describe ontology.ttl --brief
|
|
68
|
+
|
|
69
|
+
# JSON output for scripting
|
|
70
|
+
rdf-construct describe ontology.ttl --format json
|
|
71
|
+
```
|
|
72
|
+
|
|
58
73
|
### Compare Ontology Versions
|
|
59
74
|
|
|
60
75
|
```bash
|
|
@@ -205,15 +220,16 @@ rdf-construct localise report ontology.ttl --languages en,de,fr
|
|
|
205
220
|
|
|
206
221
|
**For Users**:
|
|
207
222
|
- [Getting Started](docs/user_guides/GETTING_STARTED.md) - 5-minute quick start
|
|
223
|
+
- [Describe Guide](docs/user_guides/DESCRIBE_GUIDE.md) - Quick ontology orientation
|
|
208
224
|
- [Docs Guide](docs/user_guides/DOCS_GUIDE.md) - Documentation generation
|
|
209
225
|
- [UML Guide](docs/user_guides/UML_GUIDE.md) - Complete UML features
|
|
210
|
-
- [
|
|
226
|
+
- [PUML2RDF Guide](docs/user_guides/PUML2RDF_GUIDE.md) - Diagram-first design
|
|
211
227
|
- [SHACL Guide](docs/user_guides/SHACL_GUIDE.md) - SHACL shape generation
|
|
212
228
|
- [Diff Guide](docs/user_guides/DIFF_GUIDE.md) - Semantic ontology comparison
|
|
213
229
|
- [Lint Guide](docs/user_guides/LINT_GUIDE.md) - Ontology quality checking
|
|
214
230
|
- [CQ Testing Guide](docs/user_guides/CQ_TEST_GUIDE.md) - Competency question testing
|
|
215
231
|
- [Stats Guide](docs/user_guides/STATS_GUIDE.md) - Ontology metrics
|
|
216
|
-
- [Merge Guide](docs/user_guides/
|
|
232
|
+
- [Merge & Split Guide](docs/user_guides/MERGE_SPLIT_GUIDE.md) - Combining and modularising ontologies
|
|
217
233
|
- [Refactor Guide](docs/user_guides/REFACTOR_GUIDE.md) - Renaming and deprecation
|
|
218
234
|
- [Localise Guide](docs/user_guides/LOCALISE_GUIDE.md) - Multi-language translations
|
|
219
235
|
- [CLI Reference](docs/user_guides/CLI_REFERENCE.md) - All commands and options
|
|
@@ -371,7 +387,7 @@ properties:
|
|
|
371
387
|
|
|
372
388
|
## Project Status
|
|
373
389
|
|
|
374
|
-
**Current**: v0.
|
|
390
|
+
**Current**: v0.4.0 - Feature complete for core ontology workflows
|
|
375
391
|
**License**: MIT
|
|
376
392
|
|
|
377
393
|
### Implemented
|
|
@@ -387,10 +403,15 @@ properties:
|
|
|
387
403
|
✅ Ontology linting (11 rules)
|
|
388
404
|
✅ Competency question testing
|
|
389
405
|
✅ Ontology statistics
|
|
406
|
+
✅ Ontology merging and splitting
|
|
407
|
+
✅ Ontology refactoring (rename, deprecate)
|
|
408
|
+
✅ Multi-language translation management
|
|
409
|
+
✅ Ontology description and profile detection
|
|
410
|
+
✅ Multi-format input support (Turtle, RDF/XML, JSON-LD, N-Triples)
|
|
390
411
|
✅ Comprehensive documentation
|
|
391
412
|
|
|
392
413
|
### (Possible) Roadmap
|
|
393
|
-
- [ ]
|
|
414
|
+
- [ ] OWL 2 named profile detection (EL, RL, QL)
|
|
394
415
|
- [ ] Streaming mode for very large graphs
|
|
395
416
|
- [ ] Web UI for diagram configuration
|
|
396
417
|
- [ ] Additional lint rules
|
|
@@ -453,6 +474,6 @@ MIT License - see [LICENSE](LICENSE) file for details.
|
|
|
453
474
|
|
|
454
475
|
---
|
|
455
476
|
|
|
456
|
-
**Status**: v0.
|
|
477
|
+
**Status**: v0.4.0
|
|
457
478
|
**Python**: 3.10+ required
|
|
458
|
-
**Maintainer**: See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
479
|
+
**Maintainer**: See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
@@ -1810,6 +1810,133 @@ def stats(
|
|
|
1810
1810
|
sys.exit(1)
|
|
1811
1811
|
|
|
1812
1812
|
|
|
1813
|
+
@cli.command()
|
|
1814
|
+
@click.argument("file", type=click.Path(exists=True, path_type=Path))
|
|
1815
|
+
@click.option(
|
|
1816
|
+
"--output",
|
|
1817
|
+
"-o",
|
|
1818
|
+
type=click.Path(path_type=Path),
|
|
1819
|
+
help="Write output to file instead of stdout",
|
|
1820
|
+
)
|
|
1821
|
+
@click.option(
|
|
1822
|
+
"--format",
|
|
1823
|
+
"-f",
|
|
1824
|
+
"output_format",
|
|
1825
|
+
type=click.Choice(["text", "json", "markdown", "md"], case_sensitive=False),
|
|
1826
|
+
default="text",
|
|
1827
|
+
help="Output format (default: text)",
|
|
1828
|
+
)
|
|
1829
|
+
@click.option(
|
|
1830
|
+
"--brief",
|
|
1831
|
+
is_flag=True,
|
|
1832
|
+
help="Show brief summary only (metadata, metrics, profile)",
|
|
1833
|
+
)
|
|
1834
|
+
@click.option(
|
|
1835
|
+
"--no-resolve",
|
|
1836
|
+
is_flag=True,
|
|
1837
|
+
help="Skip import resolution checks",
|
|
1838
|
+
)
|
|
1839
|
+
@click.option(
|
|
1840
|
+
"--reasoning",
|
|
1841
|
+
is_flag=True,
|
|
1842
|
+
help="Include reasoning analysis",
|
|
1843
|
+
)
|
|
1844
|
+
@click.option(
|
|
1845
|
+
"--no-colour",
|
|
1846
|
+
"--no-color",
|
|
1847
|
+
is_flag=True,
|
|
1848
|
+
help="Disable coloured output (text format only)",
|
|
1849
|
+
)
|
|
1850
|
+
def describe(
|
|
1851
|
+
file: Path,
|
|
1852
|
+
output: Path | None,
|
|
1853
|
+
output_format: str,
|
|
1854
|
+
brief: bool,
|
|
1855
|
+
no_resolve: bool,
|
|
1856
|
+
reasoning: bool,
|
|
1857
|
+
no_colour: bool,
|
|
1858
|
+
):
|
|
1859
|
+
"""Describe an ontology: profile, metrics, imports, and structure.
|
|
1860
|
+
|
|
1861
|
+
Provides a comprehensive analysis of an RDF ontology file, including:
|
|
1862
|
+
- Profile detection (RDF, RDFS, OWL DL, OWL Full)
|
|
1863
|
+
- Basic metrics (classes, properties, individuals)
|
|
1864
|
+
- Import analysis with optional resolvability checking
|
|
1865
|
+
- Namespace categorisation
|
|
1866
|
+
- Class hierarchy analysis
|
|
1867
|
+
- Documentation coverage
|
|
1868
|
+
|
|
1869
|
+
FILE: RDF ontology file to describe (.ttl, .rdf, .owl, etc.)
|
|
1870
|
+
|
|
1871
|
+
\b
|
|
1872
|
+
Examples:
|
|
1873
|
+
# Basic description
|
|
1874
|
+
rdf-construct describe ontology.ttl
|
|
1875
|
+
|
|
1876
|
+
# Brief summary only
|
|
1877
|
+
rdf-construct describe ontology.ttl --brief
|
|
1878
|
+
|
|
1879
|
+
# JSON output for programmatic use
|
|
1880
|
+
rdf-construct describe ontology.ttl --format json -o description.json
|
|
1881
|
+
|
|
1882
|
+
# Markdown for documentation
|
|
1883
|
+
rdf-construct describe ontology.ttl --format markdown -o DESCRIPTION.md
|
|
1884
|
+
|
|
1885
|
+
# Skip slow import resolution
|
|
1886
|
+
rdf-construct describe ontology.ttl --no-resolve
|
|
1887
|
+
|
|
1888
|
+
\b
|
|
1889
|
+
Exit codes:
|
|
1890
|
+
0 - Success
|
|
1891
|
+
1 - Success with warnings (unresolvable imports, etc.)
|
|
1892
|
+
2 - Error (file not found, parse error)
|
|
1893
|
+
"""
|
|
1894
|
+
from rdf_construct.describe import describe_file, format_description
|
|
1895
|
+
|
|
1896
|
+
try:
|
|
1897
|
+
click.echo(f"Analysing {file}...", err=True)
|
|
1898
|
+
|
|
1899
|
+
# Perform analysis
|
|
1900
|
+
description = describe_file(
|
|
1901
|
+
file,
|
|
1902
|
+
brief=brief,
|
|
1903
|
+
resolve_imports=not no_resolve,
|
|
1904
|
+
include_reasoning=reasoning,
|
|
1905
|
+
)
|
|
1906
|
+
|
|
1907
|
+
# Format output
|
|
1908
|
+
use_colour = not no_colour and output_format == "text" and output is None
|
|
1909
|
+
formatted = format_description(
|
|
1910
|
+
description,
|
|
1911
|
+
format_name=output_format,
|
|
1912
|
+
use_colour=use_colour,
|
|
1913
|
+
)
|
|
1914
|
+
|
|
1915
|
+
# Write output
|
|
1916
|
+
if output:
|
|
1917
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
1918
|
+
output.write_text(formatted)
|
|
1919
|
+
click.secho(f"✓ Wrote description to {output}", fg="green", err=True)
|
|
1920
|
+
else:
|
|
1921
|
+
click.echo(formatted)
|
|
1922
|
+
|
|
1923
|
+
# Exit code based on warnings
|
|
1924
|
+
if description.imports and description.imports.unresolvable_count > 0:
|
|
1925
|
+
sys.exit(1)
|
|
1926
|
+
else:
|
|
1927
|
+
sys.exit(0)
|
|
1928
|
+
|
|
1929
|
+
except FileNotFoundError as e:
|
|
1930
|
+
click.secho(f"Error: {e}", fg="red", err=True)
|
|
1931
|
+
sys.exit(2)
|
|
1932
|
+
except ValueError as e:
|
|
1933
|
+
click.secho(f"Error parsing RDF: {e}", fg="red", err=True)
|
|
1934
|
+
sys.exit(2)
|
|
1935
|
+
except Exception as e:
|
|
1936
|
+
click.secho(f"Error: {e}", fg="red", err=True)
|
|
1937
|
+
sys.exit(2)
|
|
1938
|
+
|
|
1939
|
+
|
|
1813
1940
|
@cli.command()
|
|
1814
1941
|
@click.argument("sources", nargs=-1, type=click.Path(exists=True, path_type=Path))
|
|
1815
1942
|
@click.option(
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Describe command for RDF ontology analysis.
|
|
2
|
+
|
|
3
|
+
Provides quick orientation and understanding of ontology files,
|
|
4
|
+
answering: "What is this?", "How big is it?", "What does it depend on?",
|
|
5
|
+
and "Can I work with it?"
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from rdf_construct.describe import describe_file, format_description
|
|
9
|
+
|
|
10
|
+
description = describe_file(Path("ontology.ttl"))
|
|
11
|
+
print(format_description(description))
|
|
12
|
+
|
|
13
|
+
# Brief mode (metadata + metrics + profile only)
|
|
14
|
+
description = describe_file(Path("ontology.ttl"), brief=True)
|
|
15
|
+
|
|
16
|
+
# Skip import resolution (faster)
|
|
17
|
+
description = describe_file(Path("ontology.ttl"), resolve_imports=False)
|
|
18
|
+
|
|
19
|
+
# JSON output
|
|
20
|
+
print(format_description(description, format_name="json"))
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from rdf_construct.describe.models import (
|
|
24
|
+
OntologyDescription,
|
|
25
|
+
OntologyMetadata,
|
|
26
|
+
BasicMetrics,
|
|
27
|
+
ProfileDetection,
|
|
28
|
+
OntologyProfile,
|
|
29
|
+
NamespaceAnalysis,
|
|
30
|
+
NamespaceInfo,
|
|
31
|
+
NamespaceCategory,
|
|
32
|
+
ImportAnalysis,
|
|
33
|
+
ImportInfo,
|
|
34
|
+
ImportStatus,
|
|
35
|
+
HierarchyAnalysis,
|
|
36
|
+
DocumentationCoverage,
|
|
37
|
+
ReasoningAnalysis,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
from rdf_construct.describe.analyzer import (
|
|
41
|
+
describe_ontology,
|
|
42
|
+
describe_file,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
from rdf_construct.describe.formatters import (
|
|
46
|
+
format_description,
|
|
47
|
+
format_text,
|
|
48
|
+
format_markdown,
|
|
49
|
+
format_json,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
from rdf_construct.describe.profiles import detect_profile
|
|
53
|
+
from rdf_construct.describe.metrics import collect_metrics
|
|
54
|
+
from rdf_construct.describe.imports import analyse_imports
|
|
55
|
+
from rdf_construct.describe.namespaces import analyse_namespaces
|
|
56
|
+
from rdf_construct.describe.hierarchy import analyse_hierarchy
|
|
57
|
+
from rdf_construct.describe.documentation import analyse_documentation
|
|
58
|
+
from rdf_construct.describe.metadata import extract_metadata
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
__all__ = [
|
|
62
|
+
# Main functions
|
|
63
|
+
"describe_file",
|
|
64
|
+
"describe_ontology",
|
|
65
|
+
"format_description",
|
|
66
|
+
# Formatters
|
|
67
|
+
"format_text",
|
|
68
|
+
"format_markdown",
|
|
69
|
+
"format_json",
|
|
70
|
+
# Analysis functions (for direct use)
|
|
71
|
+
"detect_profile",
|
|
72
|
+
"collect_metrics",
|
|
73
|
+
"analyse_imports",
|
|
74
|
+
"analyse_namespaces",
|
|
75
|
+
"analyse_hierarchy",
|
|
76
|
+
"analyse_documentation",
|
|
77
|
+
"extract_metadata",
|
|
78
|
+
# Data models
|
|
79
|
+
"OntologyDescription",
|
|
80
|
+
"OntologyMetadata",
|
|
81
|
+
"BasicMetrics",
|
|
82
|
+
"ProfileDetection",
|
|
83
|
+
"OntologyProfile",
|
|
84
|
+
"NamespaceAnalysis",
|
|
85
|
+
"NamespaceInfo",
|
|
86
|
+
"NamespaceCategory",
|
|
87
|
+
"ImportAnalysis",
|
|
88
|
+
"ImportInfo",
|
|
89
|
+
"ImportStatus",
|
|
90
|
+
"HierarchyAnalysis",
|
|
91
|
+
"DocumentationCoverage",
|
|
92
|
+
"ReasoningAnalysis",
|
|
93
|
+
]
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"""Main analyzer for ontology description.
|
|
2
|
+
|
|
3
|
+
Orchestrates all analysis components and aggregates results into
|
|
4
|
+
a complete OntologyDescription.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from rdflib import Graph
|
|
11
|
+
|
|
12
|
+
from rdf_construct.describe.models import OntologyDescription
|
|
13
|
+
from rdf_construct.describe.metadata import extract_metadata
|
|
14
|
+
from rdf_construct.describe.metrics import collect_metrics
|
|
15
|
+
from rdf_construct.describe.profiles import detect_profile
|
|
16
|
+
from rdf_construct.describe.namespaces import analyse_namespaces
|
|
17
|
+
from rdf_construct.describe.imports import analyse_imports
|
|
18
|
+
from rdf_construct.describe.hierarchy import analyse_hierarchy
|
|
19
|
+
from rdf_construct.describe.documentation import analyse_documentation
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def describe_ontology(
|
|
23
|
+
graph: Graph,
|
|
24
|
+
source: str | Path,
|
|
25
|
+
brief: bool = False,
|
|
26
|
+
resolve_imports: bool = True,
|
|
27
|
+
include_reasoning: bool = False,
|
|
28
|
+
) -> OntologyDescription:
|
|
29
|
+
"""Generate a complete description of an ontology.
|
|
30
|
+
|
|
31
|
+
Runs all analysis components and aggregates results.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
graph: Parsed RDF graph to analyse.
|
|
35
|
+
source: Source file path or identifier.
|
|
36
|
+
brief: If True, skip detailed analysis (imports, hierarchy, etc.).
|
|
37
|
+
resolve_imports: Whether to check resolvability of imports.
|
|
38
|
+
include_reasoning: Whether to include reasoning analysis.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
OntologyDescription with all analysis results.
|
|
42
|
+
"""
|
|
43
|
+
# Always perform core analysis
|
|
44
|
+
metadata = extract_metadata(graph)
|
|
45
|
+
metrics = collect_metrics(graph)
|
|
46
|
+
profile = detect_profile(graph)
|
|
47
|
+
|
|
48
|
+
# Create base description
|
|
49
|
+
description = OntologyDescription(
|
|
50
|
+
source=source,
|
|
51
|
+
timestamp=datetime.now(),
|
|
52
|
+
metadata=metadata,
|
|
53
|
+
metrics=metrics,
|
|
54
|
+
profile=profile,
|
|
55
|
+
brief=brief,
|
|
56
|
+
include_reasoning=include_reasoning,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Skip detailed analysis if brief mode
|
|
60
|
+
if brief:
|
|
61
|
+
return description
|
|
62
|
+
|
|
63
|
+
# Full analysis
|
|
64
|
+
description.namespaces = analyse_namespaces(graph)
|
|
65
|
+
description.imports = analyse_imports(graph, resolve=resolve_imports)
|
|
66
|
+
description.hierarchy = analyse_hierarchy(graph)
|
|
67
|
+
description.documentation = analyse_documentation(graph)
|
|
68
|
+
|
|
69
|
+
# Reasoning analysis is optional and off by default
|
|
70
|
+
if include_reasoning:
|
|
71
|
+
description.reasoning = _analyse_reasoning(graph, profile)
|
|
72
|
+
|
|
73
|
+
return description
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def describe_file(
|
|
77
|
+
file_path: Path,
|
|
78
|
+
brief: bool = False,
|
|
79
|
+
resolve_imports: bool = True,
|
|
80
|
+
include_reasoning: bool = False,
|
|
81
|
+
) -> OntologyDescription:
|
|
82
|
+
"""Generate a complete description of an ontology file.
|
|
83
|
+
|
|
84
|
+
Convenience function that handles file loading and format detection.
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
file_path: Path to RDF file.
|
|
88
|
+
brief: If True, skip detailed analysis.
|
|
89
|
+
resolve_imports: Whether to check resolvability of imports.
|
|
90
|
+
include_reasoning: Whether to include reasoning analysis.
|
|
91
|
+
|
|
92
|
+
Returns:
|
|
93
|
+
OntologyDescription with all analysis results.
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
FileNotFoundError: If file does not exist.
|
|
97
|
+
ValueError: If file cannot be parsed.
|
|
98
|
+
"""
|
|
99
|
+
if not file_path.exists():
|
|
100
|
+
raise FileNotFoundError(f"File not found: {file_path}")
|
|
101
|
+
|
|
102
|
+
# Detect format from extension
|
|
103
|
+
rdf_format = _infer_format(file_path)
|
|
104
|
+
|
|
105
|
+
# Parse the file
|
|
106
|
+
graph = Graph()
|
|
107
|
+
try:
|
|
108
|
+
graph.parse(str(file_path), format=rdf_format)
|
|
109
|
+
except Exception as e:
|
|
110
|
+
raise ValueError(f"Failed to parse {file_path}: {e}") from e
|
|
111
|
+
|
|
112
|
+
return describe_ontology(
|
|
113
|
+
graph=graph,
|
|
114
|
+
source=file_path,
|
|
115
|
+
brief=brief,
|
|
116
|
+
resolve_imports=resolve_imports,
|
|
117
|
+
include_reasoning=include_reasoning,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _infer_format(path: Path) -> str:
|
|
122
|
+
"""Infer RDF format from file extension.
|
|
123
|
+
|
|
124
|
+
Args:
|
|
125
|
+
path: Path to RDF file.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
Format string for rdflib.
|
|
129
|
+
"""
|
|
130
|
+
suffix = path.suffix.lower()
|
|
131
|
+
format_map = {
|
|
132
|
+
".ttl": "turtle",
|
|
133
|
+
".turtle": "turtle",
|
|
134
|
+
".rdf": "xml",
|
|
135
|
+
".xml": "xml",
|
|
136
|
+
".owl": "xml",
|
|
137
|
+
".nt": "nt",
|
|
138
|
+
".ntriples": "nt",
|
|
139
|
+
".n3": "n3",
|
|
140
|
+
".jsonld": "json-ld",
|
|
141
|
+
".json": "json-ld",
|
|
142
|
+
}
|
|
143
|
+
return format_map.get(suffix, "turtle")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _analyse_reasoning(graph: Graph, profile) -> "ReasoningAnalysis":
|
|
147
|
+
"""Perform reasoning analysis (optional feature).
|
|
148
|
+
|
|
149
|
+
This is a placeholder for future reasoning analysis functionality.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
graph: RDF graph to analyse.
|
|
153
|
+
profile: Detected profile.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
ReasoningAnalysis with reasoning implications.
|
|
157
|
+
"""
|
|
158
|
+
from rdf_construct.describe.models import ReasoningAnalysis, OntologyProfile
|
|
159
|
+
|
|
160
|
+
# Determine entailment regime based on profile
|
|
161
|
+
regime_map = {
|
|
162
|
+
OntologyProfile.RDF: "none",
|
|
163
|
+
OntologyProfile.RDFS: "rdfs",
|
|
164
|
+
OntologyProfile.OWL_DL_SIMPLE: "owl-dl",
|
|
165
|
+
OntologyProfile.OWL_DL_EXPRESSIVE: "owl-dl",
|
|
166
|
+
OntologyProfile.OWL_FULL: "owl-full",
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
regime = regime_map.get(profile.profile, "unknown")
|
|
170
|
+
|
|
171
|
+
return ReasoningAnalysis(
|
|
172
|
+
entailment_regime=regime,
|
|
173
|
+
inferred_superclasses=[],
|
|
174
|
+
inferred_types=[],
|
|
175
|
+
consistency_notes=[],
|
|
176
|
+
)
|