rdf4j-python 0.1.1a0__py3-none-any.whl → 0.1.3__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 +9 -4
- rdf4j_python/_client/_client.py +156 -5
- rdf4j_python/_driver/__init__.py +2 -0
- rdf4j_python/_driver/_async_named_graph.py +76 -0
- rdf4j_python/_driver/_async_rdf4j_db.py +60 -34
- rdf4j_python/_driver/_async_repository.py +307 -25
- rdf4j_python/exception/__init__.py +5 -0
- rdf4j_python/exception/repo_exception.py +26 -5
- rdf4j_python/model/__init__.py +5 -10
- rdf4j_python/model/_namespace.py +115 -14
- rdf4j_python/model/_repository_info.py +36 -15
- rdf4j_python/model/{_repository_config.py → repository_config.py} +671 -70
- rdf4j_python/model/term.py +20 -0
- rdf4j_python/model/vocabulary.py +7 -0
- rdf4j_python/utils/__init__.py +3 -0
- rdf4j_python/utils/const.py +4 -4
- rdf4j_python/utils/helpers.py +20 -0
- {rdf4j_python-0.1.1a0.dist-info → rdf4j_python-0.1.3.dist-info}/METADATA +13 -13
- rdf4j_python-0.1.3.dist-info/RECORD +23 -0
- {rdf4j_python-0.1.1a0.dist-info → rdf4j_python-0.1.3.dist-info}/WHEEL +1 -1
- rdf4j_python/model/_base_model.py +0 -26
- rdf4j_python-0.1.1a0.dist-info/RECORD +0 -19
- {rdf4j_python-0.1.1a0.dist-info → rdf4j_python-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {rdf4j_python-0.1.1a0.dist-info → rdf4j_python-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
|
-
from typing import Mapping
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
from ._base_model import _BaseModel
|
|
3
|
+
import pyoxigraph as og
|
|
7
4
|
|
|
8
5
|
|
|
9
6
|
@dataclass
|
|
10
|
-
class RepositoryMetadata
|
|
7
|
+
class RepositoryMetadata:
|
|
11
8
|
"""
|
|
12
9
|
Represents a repository metadata RDF4J.
|
|
13
10
|
"""
|
|
@@ -19,23 +16,47 @@ class RepositoryMetadata(_BaseModel):
|
|
|
19
16
|
writable: bool # Whether the repository is writable
|
|
20
17
|
|
|
21
18
|
def __str__(self):
|
|
22
|
-
|
|
19
|
+
"""
|
|
20
|
+
Returns a string representation of the RepositoryMetadata.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
str: A string representation of the RepositoryMetadata.
|
|
24
|
+
"""
|
|
23
25
|
return f"Repository(id={self.id}, title={self.title}, uri={self.uri})"
|
|
24
26
|
|
|
25
27
|
@classmethod
|
|
26
|
-
def
|
|
27
|
-
cls,
|
|
28
|
+
def from_sparql_query_solution(
|
|
29
|
+
cls, query_solution: og.QuerySolution
|
|
28
30
|
) -> "RepositoryMetadata":
|
|
29
31
|
"""
|
|
30
|
-
Create a
|
|
31
|
-
|
|
32
|
+
Create a RepositoryMetadata instance from a SPARQL query result.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
query_solution (og.QuerySolution): The SPARQL query result.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
RepositoryMetadata: The RepositoryMetadata instance.
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
ValueError: If the query solution is missing required fields.
|
|
32
42
|
"""
|
|
33
43
|
|
|
34
44
|
# Construct and return the Repository object
|
|
45
|
+
if query_solution["id"] is None:
|
|
46
|
+
raise ValueError("id is required")
|
|
47
|
+
if query_solution["uri"] is None:
|
|
48
|
+
raise ValueError("uri is required")
|
|
49
|
+
if query_solution["title"] is None:
|
|
50
|
+
raise ValueError("title is required")
|
|
51
|
+
if query_solution["readable"] is None:
|
|
52
|
+
raise ValueError("readable is required")
|
|
53
|
+
if query_solution["writable"] is None:
|
|
54
|
+
raise ValueError("writable is required")
|
|
55
|
+
|
|
35
56
|
return cls(
|
|
36
|
-
id=
|
|
37
|
-
uri=
|
|
38
|
-
title=
|
|
39
|
-
readable=
|
|
40
|
-
writable=
|
|
57
|
+
id=query_solution["id"].value,
|
|
58
|
+
uri=query_solution["uri"].value,
|
|
59
|
+
title=query_solution["title"].value,
|
|
60
|
+
readable=bool(query_solution["readable"].value),
|
|
61
|
+
writable=bool(query_solution["writable"].value),
|
|
41
62
|
)
|