iolanta 2.1.10__py3-none-any.whl → 2.1.12__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.
- iolanta/facets/facet.py +15 -9
- iolanta/facets/mermaid_roadmap/__init__.py +0 -0
- iolanta/facets/mermaid_roadmap/facet.py +133 -0
- iolanta/facets/mermaid_roadmap/inference/blocks.sparql +13 -0
- iolanta/facets/mermaid_roadmap/inference/has-task-default-type.sparql +16 -0
- iolanta/facets/mermaid_roadmap/inference/task.sparql +26 -0
- iolanta/facets/mermaid_roadmap/inference/unblocked.sparql +21 -0
- iolanta/facets/mermaid_roadmap/mermaid_roadmap.yamlld +59 -0
- iolanta/facets/mermaid_roadmap/sparql/edges.sparql +25 -0
- iolanta/facets/mermaid_roadmap/sparql/nodes.sparql +17 -0
- iolanta/iolanta.py +146 -55
- iolanta/mcp/cli.py +1 -17
- iolanta/mermaid/models.py +61 -36
- iolanta/parse_quads.py +18 -15
- iolanta/sparqlspace/processor.py +250 -255
- iolanta/sparqlspace/redirects.py +79 -0
- {iolanta-2.1.10.dist-info → iolanta-2.1.12.dist-info}/METADATA +2 -2
- {iolanta-2.1.10.dist-info → iolanta-2.1.12.dist-info}/RECORD +20 -12
- {iolanta-2.1.10.dist-info → iolanta-2.1.12.dist-info}/entry_points.txt +1 -0
- iolanta/mcp/prompts/nanopublication_assertion_authoring_rules.md +0 -63
- iolanta/mcp/prompts/rules.md +0 -83
- {iolanta-2.1.10.dist-info → iolanta-2.1.12.dist-info}/WHEEL +0 -0
iolanta/parse_quads.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import dataclasses
|
|
2
2
|
import hashlib
|
|
3
|
-
from types import MappingProxyType
|
|
4
3
|
from typing import Iterable, Optional
|
|
5
4
|
from urllib.parse import unquote
|
|
6
5
|
|
|
@@ -11,11 +10,7 @@ from rdflib.term import Node
|
|
|
11
10
|
from iolanta.errors import UnresolvedIRI
|
|
12
11
|
from iolanta.models import Quad
|
|
13
12
|
from iolanta.namespaces import IOLANTA, META
|
|
14
|
-
|
|
15
|
-
NORMALIZE_TERMS_MAP = MappingProxyType({
|
|
16
|
-
URIRef(_url := 'http://www.w3.org/2002/07/owl'): URIRef(f'{_url}#'),
|
|
17
|
-
URIRef(_url := 'http://www.w3.org/2000/01/rdf-schema'): URIRef(f'{_url}#'),
|
|
18
|
-
})
|
|
13
|
+
from iolanta.sparqlspace.redirects import apply_redirect
|
|
19
14
|
|
|
20
15
|
|
|
21
16
|
def parse_term( # noqa: C901
|
|
@@ -35,8 +30,8 @@ def parse_term( # noqa: C901
|
|
|
35
30
|
if term_type == 'literal':
|
|
36
31
|
language = term.get('language')
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
datatype_raw = term.get('datatype')
|
|
34
|
+
datatype = URIRef(datatype_raw) if datatype_raw else None
|
|
40
35
|
|
|
41
36
|
if language and datatype:
|
|
42
37
|
datatype = None
|
|
@@ -89,7 +84,7 @@ def _parse_quads_per_subgraph(
|
|
|
89
84
|
)
|
|
90
85
|
|
|
91
86
|
|
|
92
|
-
def parse_quads(
|
|
87
|
+
def parse_quads( # noqa: WPS210
|
|
93
88
|
quads_document,
|
|
94
89
|
graph: URIRef,
|
|
95
90
|
blank_node_prefix: str = '',
|
|
@@ -132,12 +127,20 @@ def parse_quads(
|
|
|
132
127
|
)
|
|
133
128
|
|
|
134
129
|
for quad in quads: # noqa: WPS526
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
# Build replacement map with subgraph names and nanopub temp namespace
|
|
131
|
+
replacement_map = subgraph_names | {
|
|
132
|
+
# To enable nanopub rendering
|
|
133
|
+
URIRef('http://purl.org/nanopub/temp/np/'): graph,
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
# Apply redirects to all URIRefs in the replacement map
|
|
137
|
+
normalized_replacement_map = {
|
|
138
|
+
apply_redirect(key) if isinstance(key, URIRef) else key:
|
|
139
|
+
apply_redirect(value_node) if isinstance(value_node, URIRef) else value_node # noqa: WPS110
|
|
140
|
+
for key, value_node in replacement_map.items()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
yield quad.replace(normalized_replacement_map).normalize()
|
|
141
144
|
|
|
142
145
|
|
|
143
146
|
def raise_if_term_is_qname(term_value: str):
|