rdf-construct 0.2.0__py3-none-any.whl
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/__init__.py +12 -0
- rdf_construct/__main__.py +0 -0
- rdf_construct/cli.py +1762 -0
- rdf_construct/core/__init__.py +33 -0
- rdf_construct/core/config.py +116 -0
- rdf_construct/core/ordering.py +219 -0
- rdf_construct/core/predicate_order.py +212 -0
- rdf_construct/core/profile.py +157 -0
- rdf_construct/core/selector.py +64 -0
- rdf_construct/core/serialiser.py +232 -0
- rdf_construct/core/utils.py +89 -0
- rdf_construct/cq/__init__.py +77 -0
- rdf_construct/cq/expectations.py +365 -0
- rdf_construct/cq/formatters/__init__.py +45 -0
- rdf_construct/cq/formatters/json.py +104 -0
- rdf_construct/cq/formatters/junit.py +104 -0
- rdf_construct/cq/formatters/text.py +146 -0
- rdf_construct/cq/loader.py +300 -0
- rdf_construct/cq/runner.py +321 -0
- rdf_construct/diff/__init__.py +59 -0
- rdf_construct/diff/change_types.py +214 -0
- rdf_construct/diff/comparator.py +338 -0
- rdf_construct/diff/filters.py +133 -0
- rdf_construct/diff/formatters/__init__.py +71 -0
- rdf_construct/diff/formatters/json.py +192 -0
- rdf_construct/diff/formatters/markdown.py +210 -0
- rdf_construct/diff/formatters/text.py +195 -0
- rdf_construct/docs/__init__.py +60 -0
- rdf_construct/docs/config.py +238 -0
- rdf_construct/docs/extractors.py +603 -0
- rdf_construct/docs/generator.py +360 -0
- rdf_construct/docs/renderers/__init__.py +7 -0
- rdf_construct/docs/renderers/html.py +803 -0
- rdf_construct/docs/renderers/json.py +390 -0
- rdf_construct/docs/renderers/markdown.py +628 -0
- rdf_construct/docs/search.py +278 -0
- rdf_construct/docs/templates/html/base.html.jinja +44 -0
- rdf_construct/docs/templates/html/class.html.jinja +152 -0
- rdf_construct/docs/templates/html/hierarchy.html.jinja +28 -0
- rdf_construct/docs/templates/html/index.html.jinja +110 -0
- rdf_construct/docs/templates/html/instance.html.jinja +90 -0
- rdf_construct/docs/templates/html/namespaces.html.jinja +37 -0
- rdf_construct/docs/templates/html/property.html.jinja +124 -0
- rdf_construct/docs/templates/html/single_page.html.jinja +169 -0
- rdf_construct/lint/__init__.py +75 -0
- rdf_construct/lint/config.py +214 -0
- rdf_construct/lint/engine.py +396 -0
- rdf_construct/lint/formatters.py +327 -0
- rdf_construct/lint/rules.py +692 -0
- rdf_construct/main.py +6 -0
- rdf_construct/puml2rdf/__init__.py +103 -0
- rdf_construct/puml2rdf/config.py +230 -0
- rdf_construct/puml2rdf/converter.py +420 -0
- rdf_construct/puml2rdf/merger.py +200 -0
- rdf_construct/puml2rdf/model.py +202 -0
- rdf_construct/puml2rdf/parser.py +565 -0
- rdf_construct/puml2rdf/validators.py +451 -0
- rdf_construct/shacl/__init__.py +56 -0
- rdf_construct/shacl/config.py +166 -0
- rdf_construct/shacl/converters.py +520 -0
- rdf_construct/shacl/generator.py +364 -0
- rdf_construct/shacl/namespaces.py +93 -0
- rdf_construct/stats/__init__.py +29 -0
- rdf_construct/stats/collector.py +178 -0
- rdf_construct/stats/comparator.py +298 -0
- rdf_construct/stats/formatters/__init__.py +83 -0
- rdf_construct/stats/formatters/json.py +38 -0
- rdf_construct/stats/formatters/markdown.py +153 -0
- rdf_construct/stats/formatters/text.py +186 -0
- rdf_construct/stats/metrics/__init__.py +26 -0
- rdf_construct/stats/metrics/basic.py +147 -0
- rdf_construct/stats/metrics/complexity.py +137 -0
- rdf_construct/stats/metrics/connectivity.py +130 -0
- rdf_construct/stats/metrics/documentation.py +128 -0
- rdf_construct/stats/metrics/hierarchy.py +207 -0
- rdf_construct/stats/metrics/properties.py +88 -0
- rdf_construct/uml/__init__.py +22 -0
- rdf_construct/uml/context.py +194 -0
- rdf_construct/uml/mapper.py +371 -0
- rdf_construct/uml/odm_renderer.py +789 -0
- rdf_construct/uml/renderer.py +684 -0
- rdf_construct/uml/uml_layout.py +393 -0
- rdf_construct/uml/uml_style.py +613 -0
- rdf_construct-0.2.0.dist-info/METADATA +431 -0
- rdf_construct-0.2.0.dist-info/RECORD +88 -0
- rdf_construct-0.2.0.dist-info/WHEEL +4 -0
- rdf_construct-0.2.0.dist-info/entry_points.txt +3 -0
- rdf_construct-0.2.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rdf-construct
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Semantic RDF manipulation toolkit - order, serialize, and diff RDF ontologies
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: rdf,ontology,turtle,owl,rdfs,knowledge-graph,knowledge-base,serialization,ontology-engineering,ontology-management,sparql
|
|
8
|
+
Author: Dave Dyke
|
|
9
|
+
Author-email: 23141680+aigora-de@users.noreply.github.com
|
|
10
|
+
Maintainer: Dave Dyke
|
|
11
|
+
Maintainer-email: 23141680+aigora-de@users.noreply.github.com
|
|
12
|
+
Requires-Python: >=3.10
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Intended Audience :: Information Technology
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
25
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Dist: click (>=8.1.0,<9.0.0)
|
|
28
|
+
Requires-Dist: jinja2 (>=3.1.0,<4.0.0)
|
|
29
|
+
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
30
|
+
Requires-Dist: rdflib (>=7.0.0,<8.0.0)
|
|
31
|
+
Requires-Dist: rich (>=13.0.0,<14.0.0)
|
|
32
|
+
Project-URL: Bug Tracker, https://github.com/aigora-de/rdf-construct/issues
|
|
33
|
+
Project-URL: Changelog, https://github.com/aigora-de/rdf-construct/blob/main/CHANGELOG.md
|
|
34
|
+
Project-URL: Documentation, https://github.com/aigora-de/rdf-construct#readme
|
|
35
|
+
Project-URL: Homepage, https://github.com/aigora-de/rdf-construct
|
|
36
|
+
Project-URL: Repository, https://github.com/aigora-de/rdf-construct.git
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# rdf-construct
|
|
40
|
+
|
|
41
|
+
> *"The ROM construct itself is a hardwired ROM cassette replicating a dead man's skills..."* — William Gibson, Neuromancer
|
|
42
|
+
|
|
43
|
+
**Semantic RDF manipulation toolkit** for ordering, documenting, validating, comparing, and visualising RDF ontologies.
|
|
44
|
+
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
[](https://www.python.org/downloads/)
|
|
47
|
+
|
|
48
|
+
## Features
|
|
49
|
+
|
|
50
|
+
- **Semantic Ordering**: Serialise RDF/Turtle with intelligent ordering instead of alphabetical chaos
|
|
51
|
+
- **Documentation Generation**: Create navigable HTML, Markdown, or JSON documentation from ontologies
|
|
52
|
+
- **UML Generation**: Create PlantUML class diagrams from RDF ontologies
|
|
53
|
+
- **PUML2RDF**: Convert PlantUML diagrams to RDF/OWL ontologies (diagram-first design)
|
|
54
|
+
- **SHACL Generation**: Generate SHACL validation shapes from OWL definitions
|
|
55
|
+
- **Semantic Diff**: Compare ontology versions and identify meaningful changes
|
|
56
|
+
- **Ontology Linting**: Check quality with 11 configurable rules
|
|
57
|
+
- **Competency Question Testing**: Validate ontologies against SPARQL-based tests
|
|
58
|
+
- **Ontology Statistics**: Comprehensive metrics with comparison mode
|
|
59
|
+
- **Flexible Styling**: Configure colours, layouts, and visual themes for diagrams
|
|
60
|
+
- **Profile-Based**: Define multiple strategies in YAML configuration
|
|
61
|
+
- **Deterministic**: Same input + profile = same output, always
|
|
62
|
+
|
|
63
|
+
## Why?
|
|
64
|
+
|
|
65
|
+
RDFlib's built-in serialisers always sort alphabetically, which:
|
|
66
|
+
- Obscures semantic structure
|
|
67
|
+
- Makes diffs noisy (unrelated changes mixed together)
|
|
68
|
+
- Loses author's intentional organisation
|
|
69
|
+
- Makes large ontologies hard to navigate
|
|
70
|
+
|
|
71
|
+
**rdf-construct** preserves semantic meaning in serialisation, making RDF files more maintainable.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
### Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# From PyPI (recommended)
|
|
79
|
+
pip install rdf-construct
|
|
80
|
+
|
|
81
|
+
# From source
|
|
82
|
+
git clone https://github.com/aigora-de/rdf-construct.git
|
|
83
|
+
cd rdf-construct
|
|
84
|
+
pip install -e .
|
|
85
|
+
|
|
86
|
+
# For development
|
|
87
|
+
poetry install
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Compare Ontology Versions
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Basic comparison
|
|
94
|
+
rdf-construct diff v1.0.ttl v1.1.ttl
|
|
95
|
+
|
|
96
|
+
# Generate markdown changelog
|
|
97
|
+
rdf-construct diff v1.0.ttl v1.1.ttl --format markdown -o CHANGELOG.md
|
|
98
|
+
|
|
99
|
+
# JSON output for CI/scripting
|
|
100
|
+
rdf-construct diff old.ttl new.ttl --format json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Generate Documentation
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# HTML documentation with search
|
|
107
|
+
rdf-construct docs ontology.ttl -o api-docs/
|
|
108
|
+
|
|
109
|
+
# Markdown for GitHub wiki
|
|
110
|
+
rdf-construct docs ontology.ttl --format markdown
|
|
111
|
+
|
|
112
|
+
# JSON for custom rendering
|
|
113
|
+
rdf-construct docs ontology.ttl --format json
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Generate UML Diagrams
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Generate diagrams from an example ontology
|
|
120
|
+
rdf-construct uml examples/animal_ontology.ttl -C examples/uml_contexts.yml
|
|
121
|
+
|
|
122
|
+
# With styling and layout
|
|
123
|
+
rdf-construct uml examples/animal_ontology.ttl -C examples/uml_contexts.yml \
|
|
124
|
+
--style-config examples/uml_styles.yml --style default \
|
|
125
|
+
--layout-config examples/uml_layouts.yml --layout hierarchy
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Reorder RDF Files
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Order an ontology using all profiles
|
|
132
|
+
rdf-construct order ontology.ttl order_config.yml
|
|
133
|
+
|
|
134
|
+
# Generate specific profiles only
|
|
135
|
+
rdf-construct order ontology.ttl order_config.yml -p alpha -p logical_topo
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Check Ontology Quality
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Run all lint rules
|
|
142
|
+
rdf-construct lint ontology.ttl
|
|
143
|
+
|
|
144
|
+
# Strict checking for CI
|
|
145
|
+
rdf-construct lint ontology.ttl --level strict --format json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Run Competency Question Tests
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Run tests
|
|
152
|
+
rdf-construct cq-test ontology.ttl tests.yml
|
|
153
|
+
|
|
154
|
+
# JUnit output for CI
|
|
155
|
+
rdf-construct cq-test ontology.ttl tests.yml --format junit -o results.xml
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Generate SHACL Shapes
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# Basic generation
|
|
162
|
+
rdf-construct shacl-gen ontology.ttl -o shapes.ttl
|
|
163
|
+
|
|
164
|
+
# Strict mode with closed shapes
|
|
165
|
+
rdf-construct shacl-gen ontology.ttl --level strict --closed
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Ontology Statistics
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Display statistics
|
|
172
|
+
rdf-construct stats ontology.ttl
|
|
173
|
+
|
|
174
|
+
# Compare two versions
|
|
175
|
+
rdf-construct stats v1.ttl v2.ttl --compare --format markdown
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
📚 **[Complete Documentation](docs/index.md)** - Start here
|
|
181
|
+
|
|
182
|
+
**For Users**:
|
|
183
|
+
- [Getting Started](docs/user_guides/GETTING_STARTED.md) - 5-minute quick start
|
|
184
|
+
- [Docs Guide](docs/user_guides/DOCS_GUIDE.md) - Documentation generation
|
|
185
|
+
- [UML Guide](docs/user_guides/UML_GUIDE.md) - Complete UML features
|
|
186
|
+
- [PlantUML Import Guide](docs/user_guides/PLANTUML_IMPORT_GUIDE.md) - Diagram-first design
|
|
187
|
+
- [SHACL Guide](docs/user_guides/SHACL_GUIDE.md) - SHACL shape generation
|
|
188
|
+
- [Diff Guide](docs/user_guides/DIFF_GUIDE.md) - Semantic ontology comparison
|
|
189
|
+
- [Lint Guide](docs/user_guides/LINT_GUIDE.md) - Ontology quality checking
|
|
190
|
+
- [CQ Testing Guide](docs/user_guides/CQ_TEST_GUIDE.md) - Competency question testing
|
|
191
|
+
- [Stats Guide](docs/user_guides/STATS_GUIDE.md) - Ontology metrics
|
|
192
|
+
- [CLI Reference](docs/user_guides/CLI_REFERENCE.md) - All commands and options
|
|
193
|
+
|
|
194
|
+
**For Developers**:
|
|
195
|
+
- [Architecture](docs/dev/ARCHITECTURE.md) - System design
|
|
196
|
+
- [UML Implementation](docs/dev/UML_IMPLEMENTATION.md) - Technical details
|
|
197
|
+
- [Contributing](CONTRIBUTING.md) - Development guide
|
|
198
|
+
|
|
199
|
+
**Additional**:
|
|
200
|
+
- [Code Index](CODE_INDEX.md) - Complete file inventory
|
|
201
|
+
- [Quick Reference](docs/user_guides/QUICK_REFERENCE.md) - Cheat sheet
|
|
202
|
+
|
|
203
|
+
## Example
|
|
204
|
+
|
|
205
|
+
### Input (Alphabetically Ordered - Hard to Read)
|
|
206
|
+
|
|
207
|
+
```turtle
|
|
208
|
+
ex:Bird rdfs:subClassOf ex:Animal .
|
|
209
|
+
ex:Cat rdfs:subClassOf ex:Mammal .
|
|
210
|
+
ex:Dog rdfs:subClassOf ex:Mammal .
|
|
211
|
+
ex:Eagle rdfs:subClassOf ex:Bird .
|
|
212
|
+
ex:Mammal rdfs:subClassOf ex:Animal .
|
|
213
|
+
ex:Sparrow rdfs:subClassOf ex:Bird .
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Output (Semantically Ordered - Easy to Understand)
|
|
217
|
+
|
|
218
|
+
```turtle
|
|
219
|
+
# Root class first
|
|
220
|
+
ex:Animal a owl:Class .
|
|
221
|
+
|
|
222
|
+
# Then its direct subclasses
|
|
223
|
+
ex:Mammal rdfs:subClassOf ex:Animal .
|
|
224
|
+
ex:Bird rdfs:subClassOf ex:Animal .
|
|
225
|
+
|
|
226
|
+
# Then their subclasses
|
|
227
|
+
ex:Dog rdfs:subClassOf ex:Mammal .
|
|
228
|
+
ex:Cat rdfs:subClassOf ex:Mammal .
|
|
229
|
+
|
|
230
|
+
ex:Eagle rdfs:subClassOf ex:Bird .
|
|
231
|
+
ex:Sparrow rdfs:subClassOf ex:Bird .
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Semantic Diff
|
|
235
|
+
|
|
236
|
+
Compare ontology versions and see what actually changed:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
$ rdf-construct diff v1.0.ttl v1.1.ttl
|
|
240
|
+
|
|
241
|
+
Comparing v1.0.ttl → v1.1.ttl
|
|
242
|
+
|
|
243
|
+
ADDED (2 entities):
|
|
244
|
+
+ Class ex:SmartBuilding (subclass of ex:Building)
|
|
245
|
+
+ DataProperty ex:energyRating
|
|
246
|
+
|
|
247
|
+
REMOVED (1 entity):
|
|
248
|
+
- Class ex:DeprecatedStructure
|
|
249
|
+
|
|
250
|
+
MODIFIED (1 entity):
|
|
251
|
+
~ Class ex:Building
|
|
252
|
+
+ rdfs:comment "A constructed physical structure."@en
|
|
253
|
+
|
|
254
|
+
Summary: 2 added, 1 removed, 1 modified
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Unlike text-based `diff`, semantic diff ignores:
|
|
258
|
+
- Statement reordering
|
|
259
|
+
- Prefix rebinding (`ex:` → `example:`)
|
|
260
|
+
- Whitespace and formatting changes
|
|
261
|
+
|
|
262
|
+
## Complete Toolkit
|
|
263
|
+
|
|
264
|
+
### Semantic Ordering
|
|
265
|
+
|
|
266
|
+
**Topological Sort**: Parents before children using Kahn's algorithm
|
|
267
|
+
```yaml
|
|
268
|
+
profiles:
|
|
269
|
+
logical_topo:
|
|
270
|
+
sections:
|
|
271
|
+
- classes:
|
|
272
|
+
sort: topological
|
|
273
|
+
roots: ["ies:Element"]
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Root-Based Ordering**: Organise by explicit hierarchy
|
|
277
|
+
```yaml
|
|
278
|
+
sections:
|
|
279
|
+
- classes:
|
|
280
|
+
sort: topological
|
|
281
|
+
roots:
|
|
282
|
+
- ex:Mammal
|
|
283
|
+
- ex:Bird
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Documentation Generation
|
|
287
|
+
|
|
288
|
+
Generate professional documentation in multiple formats:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# HTML with search, navigation, and cross-references
|
|
292
|
+
rdf-construct docs ontology.ttl -o docs/
|
|
293
|
+
|
|
294
|
+
# Markdown for GitHub/GitLab wikis
|
|
295
|
+
rdf-construct docs ontology.ttl --format markdown
|
|
296
|
+
|
|
297
|
+
# JSON for custom rendering
|
|
298
|
+
rdf-construct docs ontology.ttl --format json
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### UML Context System
|
|
302
|
+
|
|
303
|
+
**Root Classes Strategy**: Start from specific concepts
|
|
304
|
+
```yaml
|
|
305
|
+
animal_taxonomy:
|
|
306
|
+
root_classes: [ex:Animal]
|
|
307
|
+
include_descendants: true
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Focus Classes Strategy**: Hand-pick classes
|
|
311
|
+
```yaml
|
|
312
|
+
key_concepts:
|
|
313
|
+
focus_classes: [ex:Dog, ex:Cat, ex:Eagle]
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
**Property Filtering**: Control what relationships show
|
|
317
|
+
```yaml
|
|
318
|
+
properties:
|
|
319
|
+
mode: domain_based # or connected, explicit, all, none
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Quality Checking
|
|
323
|
+
|
|
324
|
+
11 built-in lint rules across three categories:
|
|
325
|
+
|
|
326
|
+
| Category | Rules |
|
|
327
|
+
|----------|-------|
|
|
328
|
+
| Structural | orphan-class, dangling-reference, circular-subclass, property-no-type, empty-ontology |
|
|
329
|
+
| Documentation | missing-label, missing-comment |
|
|
330
|
+
| Best Practice | redundant-subclass, property-no-domain, property-no-range, inconsistent-naming |
|
|
331
|
+
|
|
332
|
+
### Styling and Layout
|
|
333
|
+
|
|
334
|
+
**Visual Themes**:
|
|
335
|
+
- `default` - Professional blue scheme
|
|
336
|
+
- `high_contrast` - Bold colours for presentations
|
|
337
|
+
- `grayscale` - Black and white for academic papers
|
|
338
|
+
- `minimal` - Bare-bones for debugging
|
|
339
|
+
|
|
340
|
+
**Layout Control**:
|
|
341
|
+
- Direction (top-to-bottom, left-to-right)
|
|
342
|
+
- Arrow hints for hierarchy
|
|
343
|
+
- Spacing and grouping
|
|
344
|
+
|
|
345
|
+
## Project Status
|
|
346
|
+
|
|
347
|
+
**Current**: v0.2.0 - Feature complete for core ontology workflows
|
|
348
|
+
**License**: MIT
|
|
349
|
+
|
|
350
|
+
### Implemented
|
|
351
|
+
✅ RDF semantic ordering
|
|
352
|
+
✅ Topological sorting with root-based branches
|
|
353
|
+
✅ Custom Turtle serialisation (preserves order)
|
|
354
|
+
✅ PlantUML diagram generation from RDF
|
|
355
|
+
✅ PlantUML to RDF conversion
|
|
356
|
+
✅ Configurable styling and layouts
|
|
357
|
+
✅ Semantic diff (compare ontology versions)
|
|
358
|
+
✅ Documentation generation (HTML, Markdown, JSON)
|
|
359
|
+
✅ SHACL shape generation
|
|
360
|
+
✅ Ontology linting (11 rules)
|
|
361
|
+
✅ Competency question testing
|
|
362
|
+
✅ Ontology statistics
|
|
363
|
+
✅ Comprehensive documentation
|
|
364
|
+
|
|
365
|
+
### (Possible) Roadmap
|
|
366
|
+
- [ ] Multi-format input support (JSON-LD, RDF/XML)
|
|
367
|
+
- [ ] Streaming mode for very large graphs
|
|
368
|
+
- [ ] Web UI for diagram configuration
|
|
369
|
+
- [ ] Additional lint rules
|
|
370
|
+
|
|
371
|
+
## Contributing
|
|
372
|
+
|
|
373
|
+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
# Setup development environment
|
|
377
|
+
git clone https://github.com/aigora-de/rdf-construct.git
|
|
378
|
+
cd rdf-construct
|
|
379
|
+
poetry install
|
|
380
|
+
pre-commit install
|
|
381
|
+
|
|
382
|
+
# Run tests
|
|
383
|
+
pytest
|
|
384
|
+
|
|
385
|
+
# Format and lint
|
|
386
|
+
black src/ tests/
|
|
387
|
+
ruff check src/ tests/
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
## Dependencies
|
|
391
|
+
|
|
392
|
+
**Runtime**:
|
|
393
|
+
- Python 3.10+
|
|
394
|
+
- rdflib >= 7.0.0
|
|
395
|
+
- click >= 8.1.0
|
|
396
|
+
- pyyaml >= 6.0
|
|
397
|
+
- rich >= 13.0.0
|
|
398
|
+
- jinja2 >= 3.1.0
|
|
399
|
+
|
|
400
|
+
**Development**:
|
|
401
|
+
- black, ruff, mypy
|
|
402
|
+
- pytest, pytest-cov
|
|
403
|
+
- pre-commit
|
|
404
|
+
|
|
405
|
+
## Inspiration
|
|
406
|
+
|
|
407
|
+
Named after the **ROM construct** from William Gibson's *Neuromancer*—preserved, structured knowledge that can be queried and transformed.
|
|
408
|
+
|
|
409
|
+
The project aims to preserve the semantic structure of RDF ontologies in serialised form, making them as readable and maintainable as the author intended.
|
|
410
|
+
|
|
411
|
+
## Credits
|
|
412
|
+
|
|
413
|
+
Built on the excellent [rdflib](https://github.com/RDFLib/rdflib) library.
|
|
414
|
+
|
|
415
|
+
Influenced by the need for better RDF tooling in ontology engineering and the [IES (Information Exchange Standard)](http://informationexchangestandard.org/) work.
|
|
416
|
+
|
|
417
|
+
## License
|
|
418
|
+
|
|
419
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
420
|
+
|
|
421
|
+
## Links
|
|
422
|
+
|
|
423
|
+
- **Documentation**: [docs/index.md](docs/index.md)
|
|
424
|
+
- **Issues**: https://github.com/aigora-de/rdf-construct/issues
|
|
425
|
+
- **Discussions**: https://github.com/aigora-de/rdf-construct/discussions
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
**Status**: v0.2.0
|
|
430
|
+
**Python**: 3.10+ required
|
|
431
|
+
**Maintainer**: See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
rdf_construct/__init__.py,sha256=pEWpK7Ac7y64Q-RKxe3w8elUih_z8Xbnfu6Np3PZMmk,296
|
|
2
|
+
rdf_construct/__main__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
rdf_construct/cli.py,sha256=xboP4icN3kH6Xoh7srohE8Sstsi2M8iiUK_5_3T15iU,53787
|
|
4
|
+
rdf_construct/core/__init__.py,sha256=YgxXUPGHgBqToc8u06qksfWh_vx25g2eCg8_X8vg5l4,781
|
|
5
|
+
rdf_construct/core/config.py,sha256=uOAvvZ7keI8o4o6r6ESzHC4AkKHN1Ja2FADiHZqZDaM,3523
|
|
6
|
+
rdf_construct/core/ordering.py,sha256=fGw5aGIY8SpsGgbm1Z1YH5mzlDv7mU7b9Is07ekJxZg,7248
|
|
7
|
+
rdf_construct/core/predicate_order.py,sha256=ITQYC_pWtH6d4JbvOwKjyU7xGL_bSDoHHLQOTac8kMc,6688
|
|
8
|
+
rdf_construct/core/profile.py,sha256=CpA6fNMZKzDQgYa91KMylbfMv9RBiVo3AlUJ91_buzI,5475
|
|
9
|
+
rdf_construct/core/selector.py,sha256=Ie_J3ZcAHYVxk7hP2YzbtJ0oE93CikWBd8cbWq8c9PE,2386
|
|
10
|
+
rdf_construct/core/serialiser.py,sha256=Sba4Bn_8oUzRu6ntwapw215aSHC6B56Z8GSYU1Hsn04,7414
|
|
11
|
+
rdf_construct/core/utils.py,sha256=dhu92LvvNJ21UI7FpdcjW1PaoHPo6UXcgnrofhkO_WE,2557
|
|
12
|
+
rdf_construct/cq/__init__.py,sha256=PDFzRuBjlMKhyaimnOEHDpQ1Ok98xa4T6qtztju4Edw,1832
|
|
13
|
+
rdf_construct/cq/expectations.py,sha256=IHQhKd8-eetyj-jvbGn502vFcL0qoUzX_4IT0GfBSGE,11850
|
|
14
|
+
rdf_construct/cq/formatters/__init__.py,sha256=U5xqneRA1BwB_xWpQm3U_bNLxcBOsZbWhm45R7nwgWI,1275
|
|
15
|
+
rdf_construct/cq/formatters/json.py,sha256=VJixlGV3LY1EPRioQ7bqDi_aQMDWUVTNwk6gjBOIt1U,2932
|
|
16
|
+
rdf_construct/cq/formatters/junit.py,sha256=Jd019364vFZXKfNO6wxBwtlXe7FGPN7OpdE1lIgHUIM,3484
|
|
17
|
+
rdf_construct/cq/formatters/text.py,sha256=GI059SUomtyXDorxlQ7Whc7eHpw9AeyPnkwnwiIndco,4278
|
|
18
|
+
rdf_construct/cq/loader.py,sha256=at224OKu6Y7JKdJU-JRd03_54Q2m0bSCRhZ9R0pWEEU,8771
|
|
19
|
+
rdf_construct/cq/runner.py,sha256=QqkobjHHjxSdO2XeFaOHjBx5wrcokJme94QQhNgDHkA,9930
|
|
20
|
+
rdf_construct/diff/__init__.py,sha256=EewERur1p2ynqpyzwGFzpPS-E5DkA-VJEGO7QX9VhLU,1378
|
|
21
|
+
rdf_construct/diff/change_types.py,sha256=t12h6O6WQSrpSJdzTutuOXLB1fqm8gTob5gIhAfQ8rU,6383
|
|
22
|
+
rdf_construct/diff/comparator.py,sha256=e1bmXPJS-tkyC9Flopl6R8wcP5wHK8Tsk0-ngpUxwDc,10247
|
|
23
|
+
rdf_construct/diff/filters.py,sha256=KSigvCQ8Y9zVHwDagTYGGFueVkmEPvHDRRZXPoPscMQ,4247
|
|
24
|
+
rdf_construct/diff/formatters/__init__.py,sha256=YGcV_CkBnB5YW5BRq9GRqYS9-AIuuaZUH6bg_X03xXs,1694
|
|
25
|
+
rdf_construct/diff/formatters/json.py,sha256=rfh5OVPJW2hVBbWRoPLDuetkQAir40luO9aYXB6t7Vc,5741
|
|
26
|
+
rdf_construct/diff/formatters/markdown.py,sha256=FpoYneZecA81drKODiD0_KKE6DtcjJkGbyrRXTyshlU,5970
|
|
27
|
+
rdf_construct/diff/formatters/text.py,sha256=SRHHSs1eZCBMUQM49FeFYvjh6FU6YrUgOChxnTdE174,5773
|
|
28
|
+
rdf_construct/docs/__init__.py,sha256=pUiKoNsBpjAIrlqu7ERS0M_ODhemqxvmHGfCLGfq6c0,1592
|
|
29
|
+
rdf_construct/docs/config.py,sha256=CD8vrp3Xs_CJFKJzJWGo4G1MaSy-6XX0zQbp4aepJok,7681
|
|
30
|
+
rdf_construct/docs/extractors.py,sha256=mvizOxdZUpe9lzSJjYZWXIgu8azPnUsNVGxujAOFESY,18559
|
|
31
|
+
rdf_construct/docs/generator.py,sha256=_zb2rxI-8zKrDY4H8mlnGQOpoA1ap7lakTPVa2eoLaU,11127
|
|
32
|
+
rdf_construct/docs/renderers/__init__.py,sha256=2wCvhHarnvc87B4xlaFFmCWMPvyWWNsT-Yy_fjL2GHg,226
|
|
33
|
+
rdf_construct/docs/renderers/html.py,sha256=qnV5PcxvSPGjnc0Cp03NbS-fkJqc1f8RZdrCPU0afp8,21549
|
|
34
|
+
rdf_construct/docs/renderers/json.py,sha256=SQf9Fo83NyK1B_3C52aURWxeLXIzd6-GDgqo4sPErhg,12872
|
|
35
|
+
rdf_construct/docs/renderers/markdown.py,sha256=6upSBOS9eNW6nZilwwPuokWUdscWXz7rf4755zvpoSo,20638
|
|
36
|
+
rdf_construct/docs/search.py,sha256=dMkByM9a441JTdpwDcW-42NkD38wlj3cg7qivIqd-os,7991
|
|
37
|
+
rdf_construct/docs/templates/html/base.html.jinja,sha256=vRkwbY4LcsBQ5THFRxBsz-d5BFIYjohT9UsYed0CiLc,1441
|
|
38
|
+
rdf_construct/docs/templates/html/class.html.jinja,sha256=zLccSDhEQ2RD6KZ8Rz4cYSX-ScjH59olFav-Ow2Es5Q,5037
|
|
39
|
+
rdf_construct/docs/templates/html/hierarchy.html.jinja,sha256=pbMgmedPilyBgEUGiR0Hj31qJcVBaIe-nvosidTkk5M,657
|
|
40
|
+
rdf_construct/docs/templates/html/index.html.jinja,sha256=msABJ5mYb1-MKqrhtjaD21Gkp-5FGrVSOAJuMyiU5Rs,3311
|
|
41
|
+
rdf_construct/docs/templates/html/instance.html.jinja,sha256=jhFEq7f4NL_HgonIUoR_-U4Sv8lWG2I9tC8_2Iyq0X4,2807
|
|
42
|
+
rdf_construct/docs/templates/html/namespaces.html.jinja,sha256=ABL0GA-vHXKf1tW6TkJgA1fflYxAGezj3Nh48gYJk0w,850
|
|
43
|
+
rdf_construct/docs/templates/html/property.html.jinja,sha256=8fHsSyMSQDw5Pg5_QiiOIcRGVuTe-7dFtcNHZSBC3os,4051
|
|
44
|
+
rdf_construct/docs/templates/html/single_page.html.jinja,sha256=p1OV6sL0Yw-jgks7uSUJZvn1YY5I9hxj6knYI-iLWCQ,5557
|
|
45
|
+
rdf_construct/lint/__init__.py,sha256=xqC77f3EMhZ3O-TDDG7-e98EtIrT3uJsgBcDWfqe3bo,1418
|
|
46
|
+
rdf_construct/lint/config.py,sha256=aMrP-B8UNlI-8lgegG0i6go_7UzXOmctskcEWZ3iL-s,5967
|
|
47
|
+
rdf_construct/lint/engine.py,sha256=Eppc9ax6FiAPWVQa71xBM2tKCDd9mhFL8VYplMhjAGE,12362
|
|
48
|
+
rdf_construct/lint/formatters.py,sha256=IG6jPXn0YmyNAc2PnU5ZcPluGPQHnUt5PCysPuq7tMc,10019
|
|
49
|
+
rdf_construct/lint/rules.py,sha256=qkC_cGNMnd9fnq13dP30Hzao_1paZt_iS8y3t_6PEMk,22177
|
|
50
|
+
rdf_construct/main.py,sha256=k3Lm5MY9gO_q-mIchCoUMOJU5veeQSXHPEGzICUZ5NU,107
|
|
51
|
+
rdf_construct/puml2rdf/__init__.py,sha256=H6OCPA15ucd3snMNA08Nsnf3LJYizTwZrFRzmXQnd44,2247
|
|
52
|
+
rdf_construct/puml2rdf/config.py,sha256=FwTR--KsS2i5dwKi81LUZ9QcGF4h9OF1LquJl_dlhqw,7200
|
|
53
|
+
rdf_construct/puml2rdf/converter.py,sha256=uvhAdotxKP8uXP3X0XFsLjnP1cCNGcKkbqrbobPIwl4,14669
|
|
54
|
+
rdf_construct/puml2rdf/merger.py,sha256=xEyk5d6AoeA49d-7mYhqgeEExCDxCakcgvdofOoe27U,6528
|
|
55
|
+
rdf_construct/puml2rdf/model.py,sha256=L73spx4XTmo99i1SfeNNoKMOXRMPA7MsUWonDSydsgE,6187
|
|
56
|
+
rdf_construct/puml2rdf/parser.py,sha256=I_8nF6wPcuZGZ5ihRUd8t42AoDSs_Hv1OhRjS_Zlyds,18608
|
|
57
|
+
rdf_construct/puml2rdf/validators.py,sha256=PiY9uJdiDUn08uRd4R2by9gD_KQWIOdLEzzOv1Akybg,15313
|
|
58
|
+
rdf_construct/shacl/__init__.py,sha256=ft45S6QvDvNCZAKqdbbs8tM5xC1dzh2wLUp9FAMz3X0,1488
|
|
59
|
+
rdf_construct/shacl/config.py,sha256=eVJGEjiqyLpvBpz4i8F0YsCLjow6TGEvNxkk37dwBhA,5499
|
|
60
|
+
rdf_construct/shacl/converters.py,sha256=vtqNcZcUqhJxyAo27-KlAUT7I4ylnvZBAy3mrtxCIsM,17827
|
|
61
|
+
rdf_construct/shacl/generator.py,sha256=s2UPoV6Mxb2Ps4i2xvrtQZgGRRaZ2TNVWthSep2DHP4,12206
|
|
62
|
+
rdf_construct/shacl/namespaces.py,sha256=bw00jYDS0t0SiPqSzvNOIUVaqzNXD2Di79PDPR6z8aQ,1807
|
|
63
|
+
rdf_construct/stats/__init__.py,sha256=1lBwUEpsWo2Nc0Qmn0FeKS4Tjk4kHmWSoANrHYFWjA0,649
|
|
64
|
+
rdf_construct/stats/collector.py,sha256=kx50rXp0yUX4dLYjXgNhCEkd8OVzVGJiqeP2YqSR5Nk,7084
|
|
65
|
+
rdf_construct/stats/comparator.py,sha256=lWCOcew-xB0Q6rcDF9hY8ZgD0Q0v14RKX_kwDg4PbJM,10347
|
|
66
|
+
rdf_construct/stats/formatters/__init__.py,sha256=S6U2skVbKnWTrEUwvc7SxzHMS-LzVXUePdRMEJzKMPw,2405
|
|
67
|
+
rdf_construct/stats/formatters/json.py,sha256=V8yjib5cF4ekFEfNZOcCGuN5HUIxnKxYE_JBUE13rhE,967
|
|
68
|
+
rdf_construct/stats/formatters/markdown.py,sha256=rEBXGolzD1D5zapUGXs80pDPcl1q3yUFT-fqwWDGM1U,5351
|
|
69
|
+
rdf_construct/stats/formatters/text.py,sha256=lOvvg8KS_0FJxI6BNU7ZF2HpfT7u-k4Op--vtrFS7nU,6876
|
|
70
|
+
rdf_construct/stats/metrics/__init__.py,sha256=F94As1xuaGF6nJFQ3yLqzADa3fCFfxR5FN5YX42LkvM,957
|
|
71
|
+
rdf_construct/stats/metrics/basic.py,sha256=S950-qhBxZzriyx0tGJ1AWIaleDTnHAP5LuyYP3FMu4,4003
|
|
72
|
+
rdf_construct/stats/metrics/complexity.py,sha256=Omlr_5O7LlTGdLHU5wgcDaGhLcnWBR1UmSfeHbMjJcc,4107
|
|
73
|
+
rdf_construct/stats/metrics/connectivity.py,sha256=UMpO7Fx4ELyfuekvf6vEPqZMyQPetQFWMWQvqRzCFHs,3777
|
|
74
|
+
rdf_construct/stats/metrics/documentation.py,sha256=6XExTtd2BjgY0EM2AOvyIXqidfcOO_j8DbYPHtizlBo,3770
|
|
75
|
+
rdf_construct/stats/metrics/hierarchy.py,sha256=EodpxowJaD9gTTXyLq-dvmpda9UfYD7mSzeWLJoFCAY,6125
|
|
76
|
+
rdf_construct/stats/metrics/properties.py,sha256=seerFOY9m-g-15vUXM5SCKpUZpMzrL1gmcmBxnTgxm4,2780
|
|
77
|
+
rdf_construct/uml/__init__.py,sha256=9IRGqCEt8DvLhsa6YUfg4_f9_Pnj2QGsqLqlQ43yWK8,591
|
|
78
|
+
rdf_construct/uml/context.py,sha256=4VEs_-HZxBo9YIuX5phPhmYn_FVmThfFP0elu7ORGJg,7161
|
|
79
|
+
rdf_construct/uml/mapper.py,sha256=_I-DIrBhqTE7UhJmtNbboKyyK3XR39zsshni6ix32NA,12466
|
|
80
|
+
rdf_construct/uml/odm_renderer.py,sha256=X4QqzWXJ-FX64ZIfu0Nx6gpHbEQsJOo2hq2fbY3KaOQ,26222
|
|
81
|
+
rdf_construct/uml/renderer.py,sha256=Zj3udsghxXqJ5NPqvVSoIK177Vtzh-fFgsDzYxF5OoY,23755
|
|
82
|
+
rdf_construct/uml/uml_layout.py,sha256=PBd_qOBJzDq2N8SCqDJqgAoFmYnzZC4jrLgCQ4biYBM,13217
|
|
83
|
+
rdf_construct/uml/uml_style.py,sha256=ngVqmbS18Y4mAi9ggtL26IeVF5VbcOIOvalvI62jSO4,21876
|
|
84
|
+
rdf_construct-0.2.0.dist-info/METADATA,sha256=kPZhuYyWcfxJoid7QJhMZ9SVcv5THH-9HjskW37Q004,12503
|
|
85
|
+
rdf_construct-0.2.0.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
86
|
+
rdf_construct-0.2.0.dist-info/entry_points.txt,sha256=L4Mh7BDMt2BUHq_x9BwyPVZmZ-j_wifbD574Zm3qXZY,55
|
|
87
|
+
rdf_construct-0.2.0.dist-info/licenses/LICENSE,sha256=Fh-f4K2IlA0QH5XThePUIoG6_J_UqDkQyihGfvHcvpk,1061
|
|
88
|
+
rdf_construct-0.2.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dave
|
|
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.
|