rdf4j-python 0.1.0__py3-none-any.whl → 0.1.1a0__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.
- rdf4j_python/__init__.py +3 -3
- rdf4j_python/_driver/__init__.py +4 -4
- rdf4j_python/_driver/_async_rdf4j_db.py +10 -8
- rdf4j_python/_driver/_async_repository.py +66 -8
- rdf4j_python/exception/repo_exception.py +9 -0
- rdf4j_python/model/__init__.py +16 -0
- rdf4j_python/model/_namespace.py +56 -0
- rdf4j_python/model/_repository_config.py +899 -0
- rdf4j_python/model/{repository.py → _repository_info.py} +3 -3
- rdf4j_python-0.1.1a0.dist-info/METADATA +77 -0
- rdf4j_python-0.1.1a0.dist-info/RECORD +19 -0
- {rdf4j_python-0.1.0.dist-info → rdf4j_python-0.1.1a0.dist-info}/WHEEL +1 -1
- rdf4j_python-0.1.1a0.dist-info/licenses/LICENSE +28 -0
- rdf4j_python-0.1.0.dist-info/METADATA +0 -8
- rdf4j_python-0.1.0.dist-info/RECORD +0 -15
- {rdf4j_python-0.1.0.dist-info → rdf4j_python-0.1.1a0.dist-info}/top_level.txt +0 -0
|
@@ -7,9 +7,9 @@ from ._base_model import _BaseModel
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
@dataclass
|
|
10
|
-
class
|
|
10
|
+
class RepositoryMetadata(_BaseModel):
|
|
11
11
|
"""
|
|
12
|
-
Represents a repository
|
|
12
|
+
Represents a repository metadata RDF4J.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
15
|
id: str # The repository identifier
|
|
@@ -25,7 +25,7 @@ class RepositoryInfo(_BaseModel):
|
|
|
25
25
|
@classmethod
|
|
26
26
|
def from_rdflib_binding(
|
|
27
27
|
cls, result: Mapping[Variable, Identifier]
|
|
28
|
-
) -> "
|
|
28
|
+
) -> "RepositoryMetadata":
|
|
29
29
|
"""
|
|
30
30
|
Create a Repository instance from a SPARQL query result
|
|
31
31
|
represented as a Mapping from rdflib Variables to Identifiers.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rdf4j-python
|
|
3
|
+
Version: 0.1.1a0
|
|
4
|
+
Summary: The Python client for RDF4J
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: httpx>=0.28.1
|
|
9
|
+
Requires-Dist: rdflib>=7.1.4
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
|
|
12
|
+
# 🐍 rdf4j-python
|
|
13
|
+
|
|
14
|
+
**A Pythonic interface to the powerful Java-based [Eclipse RDF4J](https://rdf4j.org/) framework.**
|
|
15
|
+
|
|
16
|
+
> ⚠️ **Note:** This project is currently under active development and considered **experimental**. Interfaces may change. Use with caution in production environments—and feel free to help shape its future!
|
|
17
|
+
|
|
18
|
+
✅ **Supports both asynchronous (`async/await`) and synchronous programming styles.**
|
|
19
|
+
|
|
20
|
+
## 🌐 Overview
|
|
21
|
+
|
|
22
|
+
`rdf4j-python` bridges the gap between Python applications and the [Eclipse RDF4J](https://rdf4j.org/) framework, enabling seamless interaction with RDF4J repositories directly from Python. This integration allows developers to leverage RDF4J's robust capabilities for managing RDF data and executing SPARQL queries without leaving the Python ecosystem.
|
|
23
|
+
|
|
24
|
+
## 🚀 Features
|
|
25
|
+
|
|
26
|
+
- **Seamless Integration**: Interact with RDF4J repositories using Pythonic constructs.
|
|
27
|
+
- **SPARQL Support**: Execute SPARQL queries and updates effortlessly.
|
|
28
|
+
- **Repository Management**: Create, access, and manage RDF4J repositories programmatically.
|
|
29
|
+
- **Data Handling**: Add and retrieve RDF triples with ease.
|
|
30
|
+
- **Format Flexibility**: Support for various RDF serialization formats.
|
|
31
|
+
|
|
32
|
+
## 📦 Installation
|
|
33
|
+
|
|
34
|
+
Install via pip:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install rdf4j-python
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## 🧪 Usage (Async)
|
|
41
|
+
|
|
42
|
+
Here's a basic example of how to use `rdf4j-python` to create an in-memory sail repository
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from rdf4j_python import AsyncRdf4j
|
|
46
|
+
from rdf4j_python.model import MemoryStoreConfig, RepositoryConfig
|
|
47
|
+
from rdf4j_python.utils.const import Rdf4jContentType
|
|
48
|
+
|
|
49
|
+
async with AsyncRdf4j("http://localhost:19780/rdf4j-server") as db:
|
|
50
|
+
repo_config = (
|
|
51
|
+
RepositoryConfig.builder_with_sail_repository(
|
|
52
|
+
MemoryStoreConfig.Builder().persist(False).build(),
|
|
53
|
+
)
|
|
54
|
+
.repo_id("example-repo")
|
|
55
|
+
.title("Example Repository")
|
|
56
|
+
.build()
|
|
57
|
+
)
|
|
58
|
+
await db.create_repository(
|
|
59
|
+
repository_id=repo_config.repo_id,
|
|
60
|
+
rdf_config_data=repo_config.to_turtle(),
|
|
61
|
+
content_type=Rdf4jContentType.TURTLE,
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For more detailed examples, refer to the [examples](https://github.com/odysa/rdf4j-python/tree/main/examples) directory.
|
|
66
|
+
|
|
67
|
+
## 🤝 Contributing
|
|
68
|
+
|
|
69
|
+
We welcome contributions and feedback! If you'd like to help improve this project:
|
|
70
|
+
|
|
71
|
+
- Fork the repo and submit a pull request
|
|
72
|
+
- Open an issue for bugs, feature ideas, or discussions
|
|
73
|
+
- ⭐ Star the repo if you find it useful!
|
|
74
|
+
|
|
75
|
+
## 📄 License
|
|
76
|
+
|
|
77
|
+
This project is licensed under the MIT License. See the [LICENSE](https://github.com/odysa/rdf4j-python/blob/main/LICENSE) file for details.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
rdf4j_python/__init__.py,sha256=Ltuo15XbZKeKwBTbl2q03OYDZvmYshsMbxxlRtpgJiE,209
|
|
2
|
+
rdf4j_python/_client/__init__.py,sha256=L5q5RTHXCNyHp2WNP4xTemGXNntUW4RF_QJPoCWciUQ,98
|
|
3
|
+
rdf4j_python/_client/_client.py,sha256=gBuw0tfV18SXUmoh4JgJcaa-RwxkGejm2LnQwYlbmIo,3105
|
|
4
|
+
rdf4j_python/_driver/__init__.py,sha256=p4UG1SImBOJHRQFqfYczTv3WnLoy2Me-bpcAYC1nK9E,153
|
|
5
|
+
rdf4j_python/_driver/_async_rdf4j_db.py,sha256=FG0ziBVBmjKQat2voalgvY944hPVyIVXAavIXgNmH5c,3493
|
|
6
|
+
rdf4j_python/_driver/_async_repository.py,sha256=X_IeQaRcLmFlCNTkTH5hTqhPQlzE69PbOac1NuvI7K4,4700
|
|
7
|
+
rdf4j_python/exception/repo_exception.py,sha256=29lQ_1_Ir4GIoCbbOCMCCy0a_YxhMfsjxYTwUNNpRjQ,249
|
|
8
|
+
rdf4j_python/model/__init__.py,sha256=qBJeBaIS_eTBbvxn8IrEbEAbZawRs2-cIG4SQOd3kZE,335
|
|
9
|
+
rdf4j_python/model/_base_model.py,sha256=YOcgb83NfObDlrj7-d8f3yg1ZJGzkKs4blI7wOYb4LA,812
|
|
10
|
+
rdf4j_python/model/_namespace.py,sha256=9ic_Nh1pKWNn4g2qTgAtlKiSr1DzzY8qWAPvqgjWuIw,1483
|
|
11
|
+
rdf4j_python/model/_repository_config.py,sha256=iWfC-81d-blzqPQ6CiQEvZViOQQMGFz6LMYR9AnSLxg,34451
|
|
12
|
+
rdf4j_python/model/_repository_info.py,sha256=ZFwIjL_ZzdF_PZPOQRgxF8iMBM1MI261ZVxK3o1FLJU,1373
|
|
13
|
+
rdf4j_python/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
+
rdf4j_python/utils/const.py,sha256=awf0oGwDs54K02v2GPl2vTgUvrjG0YbX6cAUfXFMsug,838
|
|
15
|
+
rdf4j_python-0.1.1a0.dist-info/licenses/LICENSE,sha256=sGjA7CzoCG1LVlkh0ZB76ZdgWHVpUFegLU41YYDkGIA,1499
|
|
16
|
+
rdf4j_python-0.1.1a0.dist-info/METADATA,sha256=17yBFlB7wTbduJapzrQWc_ZgRCRMEpSK8v7IFyrtq2w,2842
|
|
17
|
+
rdf4j_python-0.1.1a0.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
18
|
+
rdf4j_python-0.1.1a0.dist-info/top_level.txt,sha256=Lf2K8d8WcEkmvo5giLGuZ3gl20rNEwMssyAFBeVzbCs,13
|
|
19
|
+
rdf4j_python-0.1.1a0.dist-info/RECORD,,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Chengxu Bian
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
rdf4j_python/__init__.py,sha256=-Ux0t15UPMS7zpvvedvR2xs8wtY5k_TiY74YdExI2PY,203
|
|
2
|
-
rdf4j_python/_client/__init__.py,sha256=L5q5RTHXCNyHp2WNP4xTemGXNntUW4RF_QJPoCWciUQ,98
|
|
3
|
-
rdf4j_python/_client/_client.py,sha256=gBuw0tfV18SXUmoh4JgJcaa-RwxkGejm2LnQwYlbmIo,3105
|
|
4
|
-
rdf4j_python/_driver/__init__.py,sha256=ryxQ9zig30THoIFcFvSYouof7OEvoeaven15gzQqUZY,147
|
|
5
|
-
rdf4j_python/_driver/_async_rdf4j_db.py,sha256=nUYXhZ2ku8ibRfPjveEv246P86-eXYiRS_u2-uRP-0U,3361
|
|
6
|
-
rdf4j_python/_driver/_async_repository.py,sha256=xTaR8RJdnQFZ4s43KXRm7rr9YNQO8_Me2S6CGjSRYIk,2132
|
|
7
|
-
rdf4j_python/exception/repo_exception.py,sha256=-PMWkw1ieOeSCHt1jHwIFHQsrXJn3KGsBWIn58-833w,102
|
|
8
|
-
rdf4j_python/model/_base_model.py,sha256=YOcgb83NfObDlrj7-d8f3yg1ZJGzkKs4blI7wOYb4LA,812
|
|
9
|
-
rdf4j_python/model/repository.py,sha256=LLKJnCer9dRDs-aS_Fyn3vKfmmRbmWguLuJlxvCWTro,1368
|
|
10
|
-
rdf4j_python/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
rdf4j_python/utils/const.py,sha256=awf0oGwDs54K02v2GPl2vTgUvrjG0YbX6cAUfXFMsug,838
|
|
12
|
-
rdf4j_python-0.1.0.dist-info/METADATA,sha256=HNAT_i0qrKvFotzwclMSoIA8R7Ct9MHEB1DF7fAco-Y,215
|
|
13
|
-
rdf4j_python-0.1.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
14
|
-
rdf4j_python-0.1.0.dist-info/top_level.txt,sha256=Lf2K8d8WcEkmvo5giLGuZ3gl20rNEwMssyAFBeVzbCs,13
|
|
15
|
-
rdf4j_python-0.1.0.dist-info/RECORD,,
|
|
File without changes
|