ontosql 0.1.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.
- ontosql-0.1.0/.gitignore +18 -0
- ontosql-0.1.0/LICENSE +21 -0
- ontosql-0.1.0/PKG-INFO +123 -0
- ontosql-0.1.0/README.md +81 -0
- ontosql-0.1.0/docs/DEPS.md +196 -0
- ontosql-0.1.0/docs/PLAN.md +103 -0
- ontosql-0.1.0/docs/RELEASING.md +48 -0
- ontosql-0.1.0/docs/ROADMAP.md +136 -0
- ontosql-0.1.0/docs/SPECS.md +155 -0
- ontosql-0.1.0/examples/fastapi_demo.py +29 -0
- ontosql-0.1.0/pyproject.toml +99 -0
- ontosql-0.1.0/src/ontosql/__init__.py +24 -0
- ontosql-0.1.0/src/ontosql/_meta.py +244 -0
- ontosql-0.1.0/src/ontosql/decorator.py +98 -0
- ontosql-0.1.0/src/ontosql/fastapi/__init__.py +28 -0
- ontosql-0.1.0/src/ontosql/fastapi/negotiate.py +96 -0
- ontosql-0.1.0/src/ontosql/fastapi/responses.py +84 -0
- ontosql-0.1.0/src/ontosql/fields.py +86 -0
- ontosql-0.1.0/src/ontosql/jsonld.py +187 -0
- ontosql-0.1.0/src/ontosql/mixin.py +39 -0
- ontosql-0.1.0/src/ontosql/py.typed +0 -0
- ontosql-0.1.0/src/ontosql/rdf.py +87 -0
- ontosql-0.1.0/src/ontosql/registry.py +114 -0
- ontosql-0.1.0/tests/__init__.py +0 -0
- ontosql-0.1.0/tests/conftest.py +22 -0
- ontosql-0.1.0/tests/models.py +39 -0
- ontosql-0.1.0/tests/test_coverage_full.py +507 -0
- ontosql-0.1.0/tests/test_coverage_gaps.py +65 -0
- ontosql-0.1.0/tests/test_decorator.py +30 -0
- ontosql-0.1.0/tests/test_decorator_errors.py +15 -0
- ontosql-0.1.0/tests/test_fastapi.py +53 -0
- ontosql-0.1.0/tests/test_fastapi_errors.py +12 -0
- ontosql-0.1.0/tests/test_fields.py +37 -0
- ontosql-0.1.0/tests/test_fields_extra.py +52 -0
- ontosql-0.1.0/tests/test_iri_fallback.py +17 -0
- ontosql-0.1.0/tests/test_jsonld.py +87 -0
- ontosql-0.1.0/tests/test_jsonld_advanced.py +55 -0
- ontosql-0.1.0/tests/test_jsonld_types.py +103 -0
- ontosql-0.1.0/tests/test_meta.py +68 -0
- ontosql-0.1.0/tests/test_mixin.py +34 -0
- ontosql-0.1.0/tests/test_mixin_errors.py +15 -0
- ontosql-0.1.0/tests/test_negotiate.py +93 -0
- ontosql-0.1.0/tests/test_rdf.py +37 -0
- ontosql-0.1.0/tests/test_registry.py +52 -0
- ontosql-0.1.0/tests/test_registry_extra.py +28 -0
ontosql-0.1.0/.gitignore
ADDED
ontosql-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OntoSQL Contributors
|
|
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.
|
ontosql-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ontosql
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Semantic interoperability for SQLModel — JSON-LD and RDF export with ontology-aware fields (import ontosql)
|
|
5
|
+
Project-URL: Homepage, https://github.com/eddiethedean/ontosql
|
|
6
|
+
Project-URL: Documentation, https://github.com/eddiethedean/ontosql#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/eddiethedean/ontosql
|
|
8
|
+
Project-URL: Issues, https://github.com/eddiethedean/ontosql/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/eddiethedean/ontosql/blob/main/CHANGELOG.md
|
|
10
|
+
Author: OntoSQL Contributors
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: fastapi,json-ld,ontology,rdf,semantic-web,sqlmodel
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: rdflib>=7.0.0
|
|
26
|
+
Requires-Dist: sqlmodel>=0.0.14
|
|
27
|
+
Requires-Dist: typing-extensions>=4.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: fastapi>=0.100; extra == 'dev'
|
|
30
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
31
|
+
Requires-Dist: orjson>=3.9; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-xdist>=3.8; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
37
|
+
Requires-Dist: ty>=0.0.37; extra == 'dev'
|
|
38
|
+
Provides-Extra: fastapi
|
|
39
|
+
Requires-Dist: fastapi>=0.100; extra == 'fastapi'
|
|
40
|
+
Requires-Dist: orjson>=3.9; extra == 'fastapi'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# OntoSQL
|
|
44
|
+
|
|
45
|
+
**Semantic interoperability for SQLModel** — enrich operational models with ontology metadata and export JSON-LD and RDF without leaving Python.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install ontosql
|
|
49
|
+
pip install "ontosql[fastapi]" # optional API helpers
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quick start
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from sqlmodel import Field, SQLModel
|
|
56
|
+
from ontosql import OntoMixin, onto_field, onto_model
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@onto_model(type_="schema:Person", iri_template="http://example.org/person/{id}")
|
|
60
|
+
class Person(SQLModel, OntoMixin, table=False):
|
|
61
|
+
id: int | None = Field(default=None, primary_key=True)
|
|
62
|
+
name: str = onto_field(ontology="schema:name")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
person = Person(id=1, name="Ada Lovelace")
|
|
66
|
+
print(person.to_jsonld())
|
|
67
|
+
print(person.to_rdf(format="turtle"))
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Features (0.1.0)
|
|
71
|
+
|
|
72
|
+
- `onto_field()` — attach ontology CURIEs/IRIs to model fields
|
|
73
|
+
- `onto_model()` — declare RDF type and instance IRI templates on classes
|
|
74
|
+
- `PrefixRegistry` — manage namespace prefixes for JSON-LD `@context`
|
|
75
|
+
- `to_jsonld()` / `to_rdf()` — export instances to semantic web formats
|
|
76
|
+
- FastAPI response helpers with content negotiation (`ontosql[fastapi]`)
|
|
77
|
+
|
|
78
|
+
## FastAPI
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from fastapi import FastAPI, Request
|
|
82
|
+
from ontosql.fastapi import negotiate_onto_response
|
|
83
|
+
|
|
84
|
+
app = FastAPI()
|
|
85
|
+
|
|
86
|
+
@app.get("/person/{person_id}")
|
|
87
|
+
def get_person(person_id: int, request: Request):
|
|
88
|
+
person = Person(id=person_id, name="Ada Lovelace")
|
|
89
|
+
return negotiate_onto_response(request, person)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
See [examples/fastapi_demo.py](https://github.com/eddiethedean/ontosql/blob/main/examples/fastapi_demo.py).
|
|
93
|
+
|
|
94
|
+
## Limitations (0.1.0)
|
|
95
|
+
|
|
96
|
+
- No RDF import or SHACL generation yet (planned for 0.2+)
|
|
97
|
+
- Foreign-key-only relationships export as `@id` references, not nested objects (use a nested `OntoMixin` field for embedded objects)
|
|
98
|
+
- JSON-LD framing requires a future `ontosql[jsonld]` extra (PyLD)
|
|
99
|
+
- Do not map two fields to the same ontology property; if you do, nested objects are preferred over FK integers (a warning is emitted)
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
|
|
103
|
+
- [Roadmap](https://github.com/eddiethedean/ontosql/blob/main/docs/ROADMAP.md)
|
|
104
|
+
- [Technical specification](https://github.com/eddiethedean/ontosql/blob/main/docs/SPECS.md)
|
|
105
|
+
- [Project plan](https://github.com/eddiethedean/ontosql/blob/main/docs/PLAN.md)
|
|
106
|
+
- [Dependency assessment](https://github.com/eddiethedean/ontosql/blob/main/docs/DEPS.md)
|
|
107
|
+
- [Changelog](https://github.com/eddiethedean/ontosql/blob/main/CHANGELOG.md)
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
See [Releasing](https://github.com/eddiethedean/ontosql/blob/main/docs/RELEASING.md) for the version publish checklist.
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pip install -e ".[dev]"
|
|
115
|
+
ruff check src tests
|
|
116
|
+
ruff format src tests
|
|
117
|
+
ty check
|
|
118
|
+
pytest --cov=ontosql --cov-fail-under=100
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT — see [LICENSE](https://github.com/eddiethedean/ontosql/blob/main/LICENSE).
|
ontosql-0.1.0/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# OntoSQL
|
|
2
|
+
|
|
3
|
+
**Semantic interoperability for SQLModel** — enrich operational models with ontology metadata and export JSON-LD and RDF without leaving Python.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install ontosql
|
|
7
|
+
pip install "ontosql[fastapi]" # optional API helpers
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Quick start
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from sqlmodel import Field, SQLModel
|
|
14
|
+
from ontosql import OntoMixin, onto_field, onto_model
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@onto_model(type_="schema:Person", iri_template="http://example.org/person/{id}")
|
|
18
|
+
class Person(SQLModel, OntoMixin, table=False):
|
|
19
|
+
id: int | None = Field(default=None, primary_key=True)
|
|
20
|
+
name: str = onto_field(ontology="schema:name")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
person = Person(id=1, name="Ada Lovelace")
|
|
24
|
+
print(person.to_jsonld())
|
|
25
|
+
print(person.to_rdf(format="turtle"))
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Features (0.1.0)
|
|
29
|
+
|
|
30
|
+
- `onto_field()` — attach ontology CURIEs/IRIs to model fields
|
|
31
|
+
- `onto_model()` — declare RDF type and instance IRI templates on classes
|
|
32
|
+
- `PrefixRegistry` — manage namespace prefixes for JSON-LD `@context`
|
|
33
|
+
- `to_jsonld()` / `to_rdf()` — export instances to semantic web formats
|
|
34
|
+
- FastAPI response helpers with content negotiation (`ontosql[fastapi]`)
|
|
35
|
+
|
|
36
|
+
## FastAPI
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from fastapi import FastAPI, Request
|
|
40
|
+
from ontosql.fastapi import negotiate_onto_response
|
|
41
|
+
|
|
42
|
+
app = FastAPI()
|
|
43
|
+
|
|
44
|
+
@app.get("/person/{person_id}")
|
|
45
|
+
def get_person(person_id: int, request: Request):
|
|
46
|
+
person = Person(id=person_id, name="Ada Lovelace")
|
|
47
|
+
return negotiate_onto_response(request, person)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
See [examples/fastapi_demo.py](https://github.com/eddiethedean/ontosql/blob/main/examples/fastapi_demo.py).
|
|
51
|
+
|
|
52
|
+
## Limitations (0.1.0)
|
|
53
|
+
|
|
54
|
+
- No RDF import or SHACL generation yet (planned for 0.2+)
|
|
55
|
+
- Foreign-key-only relationships export as `@id` references, not nested objects (use a nested `OntoMixin` field for embedded objects)
|
|
56
|
+
- JSON-LD framing requires a future `ontosql[jsonld]` extra (PyLD)
|
|
57
|
+
- Do not map two fields to the same ontology property; if you do, nested objects are preferred over FK integers (a warning is emitted)
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
- [Roadmap](https://github.com/eddiethedean/ontosql/blob/main/docs/ROADMAP.md)
|
|
62
|
+
- [Technical specification](https://github.com/eddiethedean/ontosql/blob/main/docs/SPECS.md)
|
|
63
|
+
- [Project plan](https://github.com/eddiethedean/ontosql/blob/main/docs/PLAN.md)
|
|
64
|
+
- [Dependency assessment](https://github.com/eddiethedean/ontosql/blob/main/docs/DEPS.md)
|
|
65
|
+
- [Changelog](https://github.com/eddiethedean/ontosql/blob/main/CHANGELOG.md)
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
See [Releasing](https://github.com/eddiethedean/ontosql/blob/main/docs/RELEASING.md) for the version publish checklist.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install -e ".[dev]"
|
|
73
|
+
ruff check src tests
|
|
74
|
+
ruff format src tests
|
|
75
|
+
ty check
|
|
76
|
+
pytest --cov=ontosql --cov-fail-under=100
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## License
|
|
80
|
+
|
|
81
|
+
MIT — see [LICENSE](https://github.com/eddiethedean/ontosql/blob/main/LICENSE).
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# OntoSQL Dependency Ecosystem Assessment
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This document evaluates recommended Python package dependencies and ecosystem integrations for **ontosql**. The goal is to maintain a lightweight, Pythonic, operationally focused semantic interoperability framework centered on SQLModel and FastAPI.
|
|
6
|
+
|
|
7
|
+
## Dependency Philosophy
|
|
8
|
+
|
|
9
|
+
The `ontosql` package should maintain:
|
|
10
|
+
|
|
11
|
+
- A small and stable core
|
|
12
|
+
- Optional extras for advanced integrations
|
|
13
|
+
- Strong SQLModel compatibility
|
|
14
|
+
- Minimal developer friction
|
|
15
|
+
- Pythonic APIs over RDF-native complexity
|
|
16
|
+
|
|
17
|
+
The package should avoid becoming a heavyweight semantic-web framework.
|
|
18
|
+
|
|
19
|
+
## Core Dependencies
|
|
20
|
+
|
|
21
|
+
### SQLModel
|
|
22
|
+
|
|
23
|
+
- Primary operational model layer
|
|
24
|
+
- SQLAlchemy + Pydantic integration
|
|
25
|
+
- FastAPI-native ergonomics
|
|
26
|
+
|
|
27
|
+
### Pydantic
|
|
28
|
+
|
|
29
|
+
- Validation and serialization
|
|
30
|
+
- Type system foundation
|
|
31
|
+
- JSON schema generation
|
|
32
|
+
|
|
33
|
+
### typing-extensions
|
|
34
|
+
|
|
35
|
+
- Advanced typing compatibility
|
|
36
|
+
|
|
37
|
+
### RDFLib
|
|
38
|
+
|
|
39
|
+
- RDF graph backend
|
|
40
|
+
- Serialization and parsing
|
|
41
|
+
- Namespace handling
|
|
42
|
+
|
|
43
|
+
## FastAPI Ecosystem Extras
|
|
44
|
+
|
|
45
|
+
### FastAPI
|
|
46
|
+
|
|
47
|
+
- Ontology-aware API integration
|
|
48
|
+
- Content negotiation
|
|
49
|
+
- OpenAPI enhancement
|
|
50
|
+
|
|
51
|
+
### orjson
|
|
52
|
+
|
|
53
|
+
- High-performance JSON serialization
|
|
54
|
+
- Efficient JSON-LD support
|
|
55
|
+
|
|
56
|
+
## Semantic Validation Extras
|
|
57
|
+
|
|
58
|
+
### pySHACL
|
|
59
|
+
|
|
60
|
+
- SHACL validation support
|
|
61
|
+
- RDF graph validation
|
|
62
|
+
- Enterprise interoperability validation
|
|
63
|
+
|
|
64
|
+
## JSON-LD Ecosystem
|
|
65
|
+
|
|
66
|
+
### PyLD
|
|
67
|
+
|
|
68
|
+
- JSON-LD compaction
|
|
69
|
+
- Framing
|
|
70
|
+
- Expansion
|
|
71
|
+
- Canonicalization
|
|
72
|
+
|
|
73
|
+
PyLD significantly improves JSON-LD capabilities beyond basic RDFLib support.
|
|
74
|
+
|
|
75
|
+
## Graph Database Integrations
|
|
76
|
+
|
|
77
|
+
### SPARQLWrapper
|
|
78
|
+
|
|
79
|
+
- SPARQL endpoint communication
|
|
80
|
+
- RDF graph database interoperability
|
|
81
|
+
|
|
82
|
+
### Neo4j Python Driver
|
|
83
|
+
|
|
84
|
+
- Property graph integrations
|
|
85
|
+
- Hybrid knowledge graph architectures
|
|
86
|
+
|
|
87
|
+
## AI and LLM Ecosystem
|
|
88
|
+
|
|
89
|
+
### Instructor
|
|
90
|
+
|
|
91
|
+
- Structured LLM extraction into Pydantic models
|
|
92
|
+
- Strong alignment with OntoSQL architecture
|
|
93
|
+
|
|
94
|
+
### PydanticAI
|
|
95
|
+
|
|
96
|
+
- Typed AI agent systems
|
|
97
|
+
- Structured ontology extraction
|
|
98
|
+
|
|
99
|
+
### DeepOnto
|
|
100
|
+
|
|
101
|
+
- Ontology alignment
|
|
102
|
+
- Semantic embeddings
|
|
103
|
+
- AI-assisted ontology workflows
|
|
104
|
+
|
|
105
|
+
## Developer Tooling
|
|
106
|
+
|
|
107
|
+
### pytest
|
|
108
|
+
|
|
109
|
+
- Testing framework
|
|
110
|
+
|
|
111
|
+
### ty
|
|
112
|
+
|
|
113
|
+
- Static typing validation
|
|
114
|
+
|
|
115
|
+
### ruff
|
|
116
|
+
|
|
117
|
+
- Linting and formatting
|
|
118
|
+
|
|
119
|
+
### mkdocs-material
|
|
120
|
+
|
|
121
|
+
- Documentation platform
|
|
122
|
+
- Developer experience optimization
|
|
123
|
+
|
|
124
|
+
## Future Integrations
|
|
125
|
+
|
|
126
|
+
### Owlready2
|
|
127
|
+
|
|
128
|
+
- OWL reasoning support
|
|
129
|
+
- Ontology manipulation
|
|
130
|
+
|
|
131
|
+
### networkx
|
|
132
|
+
|
|
133
|
+
- Graph algorithms
|
|
134
|
+
- Graph traversal
|
|
135
|
+
|
|
136
|
+
### Polars
|
|
137
|
+
|
|
138
|
+
- DataFrame interoperability
|
|
139
|
+
- Typed ETL pipelines
|
|
140
|
+
- Ontology-aware DataFrame workflows
|
|
141
|
+
|
|
142
|
+
## Extras in pyproject.toml (0.1.0)
|
|
143
|
+
|
|
144
|
+
```toml
|
|
145
|
+
[project.optional-dependencies]
|
|
146
|
+
fastapi = ["fastapi>=0.100", "orjson>=3.9"]
|
|
147
|
+
dev = ["pytest", "pytest-cov", "ty", "ruff", "httpx", "fastapi", "orjson", ...]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- **`fastapi`** — installs FastAPI and orjson; `ontosql.fastapi` uses orjson for JSON-LD responses when available
|
|
151
|
+
- **`dev`** — test, lint, and type-check tooling
|
|
152
|
+
|
|
153
|
+
Install examples:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
pip install ontosql
|
|
157
|
+
pip install ontosql[fastapi]
|
|
158
|
+
pip install -e ".[dev]"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Proposed future extras
|
|
162
|
+
|
|
163
|
+
The following are **not** yet defined in `pyproject.toml` but are under consideration:
|
|
164
|
+
|
|
165
|
+
```toml
|
|
166
|
+
jsonld = ["PyLD"] # framing and advanced JSON-LD
|
|
167
|
+
shacl = ["pySHACL"] # SHACL validation
|
|
168
|
+
graphdb = ["SPARQLWrapper", "neo4j"]
|
|
169
|
+
ai = ["instructor", "pydantic-ai", "deeponto"]
|
|
170
|
+
owl = ["Owlready2"]
|
|
171
|
+
polars = ["polars"]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Strategic Recommendations
|
|
175
|
+
|
|
176
|
+
**Strongest foundational dependencies:**
|
|
177
|
+
|
|
178
|
+
- SQLModel
|
|
179
|
+
- Pydantic
|
|
180
|
+
- RDFLib
|
|
181
|
+
|
|
182
|
+
**Highest-value optional integrations:**
|
|
183
|
+
|
|
184
|
+
- FastAPI
|
|
185
|
+
- PyLD
|
|
186
|
+
- pySHACL
|
|
187
|
+
- Instructor
|
|
188
|
+
|
|
189
|
+
**Highest long-term strategic opportunities:**
|
|
190
|
+
|
|
191
|
+
- PydanticAI
|
|
192
|
+
- Polars
|
|
193
|
+
- Neo4j
|
|
194
|
+
- DeepOnto
|
|
195
|
+
|
|
196
|
+
OntoSQL should expose Pythonic model-centric APIs rather than RDF-native APIs. RDFLib should remain an internal implementation detail wherever possible.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# OntoSQL Project Plan
|
|
2
|
+
|
|
3
|
+
## Vision
|
|
4
|
+
|
|
5
|
+
Build **ontosql** — a Python package that combines SQLModel, Pydantic, FastAPI, and ontology tooling into a unified semantic application framework. Developers define operational database models once and automatically gain semantic interoperability through JSON-LD, RDF, SHACL, and ontology-aware APIs.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install ontosql
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Core Thesis
|
|
12
|
+
|
|
13
|
+
Traditional ontology tooling is operationally difficult, while FastAPI + SQLModel ecosystems are highly ergonomic. OntoSQL bridges those worlds by adding ontology metadata and graph interoperability to normal Python web applications.
|
|
14
|
+
|
|
15
|
+
## Primary Goals
|
|
16
|
+
|
|
17
|
+
- Preserve SQLModel ergonomics
|
|
18
|
+
- Add ontology metadata to fields and models
|
|
19
|
+
- Enable JSON-LD and RDF export/import
|
|
20
|
+
- Generate SHACL shapes automatically
|
|
21
|
+
- Integrate deeply with FastAPI
|
|
22
|
+
- Support graph database synchronization
|
|
23
|
+
- Remain Pythonic and developer-friendly
|
|
24
|
+
|
|
25
|
+
## Target Users
|
|
26
|
+
|
|
27
|
+
- Enterprise data platform teams
|
|
28
|
+
- Knowledge graph engineers
|
|
29
|
+
- AI/RAG platform developers
|
|
30
|
+
- FastAPI backend teams
|
|
31
|
+
- Government and defense metadata systems
|
|
32
|
+
- Research and biomedical platforms
|
|
33
|
+
|
|
34
|
+
## MVP Scope
|
|
35
|
+
|
|
36
|
+
Version 0.1 should focus on:
|
|
37
|
+
|
|
38
|
+
- `OntoMixin`
|
|
39
|
+
- `onto_field()`
|
|
40
|
+
- JSON-LD export
|
|
41
|
+
- RDFLib graph export
|
|
42
|
+
- `PrefixRegistry`
|
|
43
|
+
- FastAPI content negotiation
|
|
44
|
+
|
|
45
|
+
## Non-Goals for v1
|
|
46
|
+
|
|
47
|
+
- Full OWL reasoning engine
|
|
48
|
+
- Native graph database query language
|
|
49
|
+
- Complex ontology editing UI
|
|
50
|
+
- Replacing RDF-native tooling like Protégé
|
|
51
|
+
|
|
52
|
+
## Suggested Stack
|
|
53
|
+
|
|
54
|
+
| Layer | Packages |
|
|
55
|
+
|-------|----------|
|
|
56
|
+
| Models | SQLModel, Pydantic v2 |
|
|
57
|
+
| API | FastAPI |
|
|
58
|
+
| Graph | RDFLib |
|
|
59
|
+
| Validation | pySHACL |
|
|
60
|
+
| HTTP | httpx |
|
|
61
|
+
| Typing | typing_extensions |
|
|
62
|
+
|
|
63
|
+
## Roadmap
|
|
64
|
+
|
|
65
|
+
### v0.1 (released)
|
|
66
|
+
|
|
67
|
+
- Ontology field metadata (`onto_field`, `@onto_model`)
|
|
68
|
+
- JSON-LD serialization (including typed literals and duplicate-property handling)
|
|
69
|
+
- RDF export (Turtle, JSON-LD, N-Triples, RDF/XML)
|
|
70
|
+
- `PrefixRegistry`
|
|
71
|
+
- FastAPI content negotiation and response classes (`ontosql[fastapi]`)
|
|
72
|
+
|
|
73
|
+
### v0.2
|
|
74
|
+
|
|
75
|
+
- SHACL generation
|
|
76
|
+
- RDF import
|
|
77
|
+
- Extended prefix / vocabulary management
|
|
78
|
+
|
|
79
|
+
### v0.3
|
|
80
|
+
|
|
81
|
+
- FastAPI `OntoRouter` and OpenAPI semantic enrichment
|
|
82
|
+
|
|
83
|
+
### v0.4
|
|
84
|
+
|
|
85
|
+
- Graph synchronization adapters
|
|
86
|
+
- SPARQL endpoint publishing
|
|
87
|
+
|
|
88
|
+
### v1.0
|
|
89
|
+
|
|
90
|
+
- Stable public API for `ontosql`
|
|
91
|
+
- Production examples
|
|
92
|
+
- Schema packs
|
|
93
|
+
- Full documentation
|
|
94
|
+
|
|
95
|
+
## Long-Term Vision
|
|
96
|
+
|
|
97
|
+
OntoSQL becomes the operational semantic layer for Python applications:
|
|
98
|
+
|
|
99
|
+
- Typed knowledge graphs
|
|
100
|
+
- AI semantic memory systems
|
|
101
|
+
- Metadata governance
|
|
102
|
+
- Enterprise interoperability
|
|
103
|
+
- LLM extraction pipelines
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Releasing OntoSQL
|
|
2
|
+
|
|
3
|
+
Checklist for publishing a new version.
|
|
4
|
+
|
|
5
|
+
## Pre-release
|
|
6
|
+
|
|
7
|
+
1. Ensure `version` in `pyproject.toml` matches the release tag.
|
|
8
|
+
2. Update `CHANGELOG.md` (move items from `[Unreleased]` to a new version section).
|
|
9
|
+
3. Run the full CI suite locally:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install -e ".[dev]"
|
|
13
|
+
ruff check src tests
|
|
14
|
+
ruff format --check src tests
|
|
15
|
+
ty check
|
|
16
|
+
pytest --cov=ontosql --cov-fail-under=100
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
4. Build and smoke-test the wheel:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install build
|
|
23
|
+
python -m build
|
|
24
|
+
pip install dist/ontosql-*.whl
|
|
25
|
+
python -c "import ontosql; print(ontosql.__version__)"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## GitHub release
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git tag -a v0.1.0 -m "Release 0.1.0"
|
|
32
|
+
git push origin v0.1.0
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Create a GitHub release from the tag and paste the relevant `CHANGELOG.md` section.
|
|
36
|
+
|
|
37
|
+
## PyPI
|
|
38
|
+
|
|
39
|
+
The PyPI distribution name is **`ontosql`**.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m build
|
|
43
|
+
pip install twine
|
|
44
|
+
twine check dist/*
|
|
45
|
+
twine upload dist/*
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Requires PyPI credentials configured (`~/.pypirc` or `TWINE_USERNAME` / `TWINE_PASSWORD`).
|