iolanta 2.0.5__py3-none-any.whl → 2.0.6__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/cli/main.py +2 -2
- iolanta/data/textual-browser.yaml +6 -0
- iolanta/facets/locator.py +19 -0
- iolanta/facets/textual_no_facet_found.py +68 -0
- iolanta/widgets/description.py +12 -0
- {iolanta-2.0.5.dist-info → iolanta-2.0.6.dist-info}/METADATA +2 -2
- {iolanta-2.0.5.dist-info → iolanta-2.0.6.dist-info}/RECORD +9 -7
- {iolanta-2.0.5.dist-info → iolanta-2.0.6.dist-info}/WHEEL +0 -0
- {iolanta-2.0.5.dist-info → iolanta-2.0.6.dist-info}/entry_points.txt +0 -0
iolanta/cli/main.py
CHANGED
|
@@ -94,7 +94,7 @@ def render_command( # noqa: WPS231, WPS238, WPS210, C901
|
|
|
94
94
|
)
|
|
95
95
|
|
|
96
96
|
node_url = URL(url)
|
|
97
|
-
if node_url.scheme:
|
|
97
|
+
if node_url.scheme and node_url.scheme != 'file':
|
|
98
98
|
node = URIRef(url)
|
|
99
99
|
|
|
100
100
|
iolanta: Iolanta = Iolanta(
|
|
@@ -102,7 +102,7 @@ def render_command( # noqa: WPS231, WPS238, WPS210, C901
|
|
|
102
102
|
logger=logger,
|
|
103
103
|
)
|
|
104
104
|
else:
|
|
105
|
-
path = Path(
|
|
105
|
+
path = Path(node_url.path).absolute()
|
|
106
106
|
node = URIRef(f'file://{path}')
|
|
107
107
|
iolanta: Iolanta = Iolanta(
|
|
108
108
|
language=Literal(language),
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
iolanta:outputs:
|
|
14
14
|
"@type": "@id"
|
|
15
15
|
|
|
16
|
+
iolanta:when-no-facet-found:
|
|
17
|
+
"@type": "@id"
|
|
18
|
+
|
|
16
19
|
$: rdfs:label
|
|
17
20
|
→:
|
|
18
21
|
"@type": "@id"
|
|
@@ -125,3 +128,6 @@
|
|
|
125
128
|
↦:
|
|
126
129
|
- ASK WHERE { ?instance a $this }
|
|
127
130
|
- ASK WHERE { $this rdfs:subClassOf ?superclass }
|
|
131
|
+
|
|
132
|
+
- $id: https://iolanta.tech/cli/textual
|
|
133
|
+
iolanta:when-no-facet-found: python://iolanta.facets.textual_no_facet_found.TextualNoFacetFound
|
iolanta/facets/locator.py
CHANGED
|
@@ -240,6 +240,22 @@ class FacetFinder: # noqa: WPS214
|
|
|
240
240
|
for row in rows
|
|
241
241
|
]
|
|
242
242
|
|
|
243
|
+
def by_facet_not_found(self) -> Iterable[FoundRow]:
|
|
244
|
+
"""What facet to show if no facets are found?"""
|
|
245
|
+
rows = self.iolanta.query( # noqa: WPS462
|
|
246
|
+
"""
|
|
247
|
+
SELECT ?facet ?output_datatype WHERE {
|
|
248
|
+
$output_datatype iolanta:when-no-facet-found ?facet .
|
|
249
|
+
}
|
|
250
|
+
""",
|
|
251
|
+
output_datatype=self.as_datatype,
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
return [
|
|
255
|
+
FoundRow(facet=row['facet'], output_datatype=row['output_datatype'])
|
|
256
|
+
for row in rows
|
|
257
|
+
]
|
|
258
|
+
|
|
243
259
|
def retrieve_facets_preference_ordering(self) -> set[tuple[URIRef, URIRef]]:
|
|
244
260
|
"""
|
|
245
261
|
Construct partial ordering on the set of facets.
|
|
@@ -263,6 +279,9 @@ class FacetFinder: # noqa: WPS214
|
|
|
263
279
|
"""Return all suitable facets."""
|
|
264
280
|
rows = list(self._found_facets())
|
|
265
281
|
|
|
282
|
+
if not rows:
|
|
283
|
+
rows = self.by_facet_not_found()
|
|
284
|
+
|
|
266
285
|
if len(rows) == 1:
|
|
267
286
|
# Nothing to order.
|
|
268
287
|
return rows
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from rich.markdown import Markdown
|
|
4
|
+
from textual.containers import Vertical
|
|
5
|
+
from yarl import URL
|
|
6
|
+
|
|
7
|
+
from iolanta import Facet
|
|
8
|
+
from iolanta.facets.page_title import PageTitle
|
|
9
|
+
from iolanta.widgets.description import Description
|
|
10
|
+
|
|
11
|
+
TEXT = """
|
|
12
|
+
**😕 Iolanta is unable to visualize this resource**
|
|
13
|
+
|
|
14
|
+
* The URI might be incorrect;
|
|
15
|
+
* Or, no edges might exist which involve it;
|
|
16
|
+
* Or maybe Iolanta does not know of such edges.
|
|
17
|
+
{content}
|
|
18
|
+
**What can you do?**
|
|
19
|
+
|
|
20
|
+
* If you feel this might indicate a bug 🐛, please do let us know at GitHub
|
|
21
|
+
issues: https://github.com/iolanta.tech/iolanta/issues
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
CONTENT_TEMPLATE = """
|
|
25
|
+
**File content**
|
|
26
|
+
|
|
27
|
+
```{type}
|
|
28
|
+
{content}
|
|
29
|
+
```
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class TextualNoFacetFound(Facet):
|
|
34
|
+
"""Facet to handle the case when no facet is found."""
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def raw_content(self):
|
|
38
|
+
"""Content of the file, if applicable."""
|
|
39
|
+
url = URL(self.uriref)
|
|
40
|
+
if url.scheme != 'file':
|
|
41
|
+
return None
|
|
42
|
+
|
|
43
|
+
path = Path(url.path)
|
|
44
|
+
if not path.is_relative_to(self.iolanta.project_root):
|
|
45
|
+
return None
|
|
46
|
+
|
|
47
|
+
if not path.exists():
|
|
48
|
+
return None
|
|
49
|
+
|
|
50
|
+
if path.is_dir():
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
file_content = path.read_text()
|
|
54
|
+
return CONTENT_TEMPLATE.format(
|
|
55
|
+
content=file_content,
|
|
56
|
+
type={
|
|
57
|
+
'.yamlld': 'yaml',
|
|
58
|
+
}.get(path.suffix, ''),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def show(self):
|
|
62
|
+
"""Compose the page."""
|
|
63
|
+
return Vertical(
|
|
64
|
+
PageTitle(self.this),
|
|
65
|
+
Description(
|
|
66
|
+
Markdown(TEXT.format(content=self.raw_content or '')),
|
|
67
|
+
),
|
|
68
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: iolanta
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.6
|
|
4
4
|
Summary: Semantic Web browser
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Anatoly Scherbakov
|
|
@@ -32,7 +32,7 @@ Requires-Dist: rich (>=13.3.1)
|
|
|
32
32
|
Requires-Dist: textual (>=0.83.0)
|
|
33
33
|
Requires-Dist: typer (>=0.9.0)
|
|
34
34
|
Requires-Dist: watchfiles (>=1.0.4,<2.0.0)
|
|
35
|
-
Requires-Dist: yaml-ld (>=1.1.
|
|
35
|
+
Requires-Dist: yaml-ld (>=1.1.9)
|
|
36
36
|
Requires-Dist: yarl (>=1.9.4)
|
|
37
37
|
Description-Content-Type: text/markdown
|
|
38
38
|
|
|
@@ -6,7 +6,7 @@ iolanta/cli/formatters/choose.py,sha256=LWzsO_9IBSSgYNIyLlItkp8TNvpW3v6YCQ8-6kbI
|
|
|
6
6
|
iolanta/cli/formatters/csv.py,sha256=ceJ_DTz0beqeK-d6FPBQqqjXrziEfF0FRSLoGZCt_fs,760
|
|
7
7
|
iolanta/cli/formatters/json.py,sha256=Og5B9UrSM_0NWqW5Afpsy6WH8ZfYgPMVXYvT3i-43Jc,748
|
|
8
8
|
iolanta/cli/formatters/pretty.py,sha256=IypZRAr2vNqcXFY6NOIc75mpyfpFWh56aCBlOPDDieQ,2901
|
|
9
|
-
iolanta/cli/main.py,sha256=
|
|
9
|
+
iolanta/cli/main.py,sha256=W1SoQK9kncaSUsy4X5yMrzu8lQUlu-eE6YyIu4dNnec,3167
|
|
10
10
|
iolanta/cli/models.py,sha256=cjbpowdzI4wAP0DUk3qoVHyimk6AZwlXi9CGmusZTuM,159
|
|
11
11
|
iolanta/cli/pretty_print.py,sha256=M6E3TmhzA6JY5GeUVmDZLmOh5u70-393PVit4voFKDI,977
|
|
12
12
|
iolanta/context.py,sha256=bZR-tbZIrDQ-Vby01PMDZ6ifxM-0YMK68RJvAsyqCTs,507
|
|
@@ -16,7 +16,7 @@ iolanta/data/context.yaml,sha256=LUBasiBKgQeGAYjYV_T5XvgPlrdzACeKaZwY_rKzjtI,163
|
|
|
16
16
|
iolanta/data/graph-triples.yamlld,sha256=oACKRwqWcMp6TBobXMG6gbbnaauyd6wlK-gH2vVkPps,241
|
|
17
17
|
iolanta/data/html.yaml,sha256=hVFdLWLy8FMY8xpOrJMYc-tE3S0Nq83xuxVkjRW_7rI,517
|
|
18
18
|
iolanta/data/iolanta.yaml,sha256=xubIFBNU02lmFXhgOSuyQwUcZD3xCqVfeVAZMvOxKbI,1433
|
|
19
|
-
iolanta/data/textual-browser.yaml,sha256=
|
|
19
|
+
iolanta/data/textual-browser.yaml,sha256=SajFDOdqISVLsBVneS3uh3s8vuYAUIuC0nWvVqIWMZ0,4141
|
|
20
20
|
iolanta/ensure_is_context.py,sha256=9aok8asyEx7KPesOR28VBDb3Ch9kfc3eoCpQSJwj07U,717
|
|
21
21
|
iolanta/entry_points.py,sha256=DZbf-udlEwELFGqeWENj0M2BOUPOWlmGJdqyaEtnot0,504
|
|
22
22
|
iolanta/errors.py,sha256=t_RltahnoEvcytVa1BOq2MADgHps3JNd_h5-SFu7_wM,1250
|
|
@@ -42,7 +42,7 @@ iolanta/facets/html/base.py,sha256=JcpK7YM_QQE9vwH5w5F_EgPkPv-XRzOrcZlVSy4LhIs,1
|
|
|
42
42
|
iolanta/facets/html/code_literal.py,sha256=qCddzBrg6Y5XMIKohFQ52Tf9GPOcU7bj83tfAU1FLLU,394
|
|
43
43
|
iolanta/facets/html/default.py,sha256=Dmf_kYiL2M954iigyYsiWrMstwZ1nvxKetuR6aW3xYY,647
|
|
44
44
|
iolanta/facets/icon.py,sha256=ddZcolx1Q5_wo3w0jqiCzcc5Lsru6-jA7s7oAd1T8Og,494
|
|
45
|
-
iolanta/facets/locator.py,sha256=
|
|
45
|
+
iolanta/facets/locator.py,sha256=b9TEK5_5SklTfEc6lUt7DJt1mKXsiL_urA2zxMk59EY,9152
|
|
46
46
|
iolanta/facets/page_title.py,sha256=TwgZK2g_e5UoWYjKNgDzzkmq1EI3cY58680iC8N9kZI,1407
|
|
47
47
|
iolanta/facets/qname.py,sha256=ztyBbjjcW8dNZzuiNMqhcWfAUxk-gSjbseVGrQE7kVY,531
|
|
48
48
|
iolanta/facets/textual_browser/__init__.py,sha256=sKgDvXOwib9n9d63kdtKCEv26-FoL0VN6zxDmfcheZ8,104
|
|
@@ -79,6 +79,7 @@ iolanta/facets/textual_nanopublication/models.py,sha256=MphggSvKmYac6v866GOKW5lc
|
|
|
79
79
|
iolanta/facets/textual_nanopublication/nanopublication_widget.py,sha256=sQPgEx25XJ15VqB5zjZuz2q2bf_B5GWXEp32FAufxQ4,2387
|
|
80
80
|
iolanta/facets/textual_nanopublication/term_list_widget.py,sha256=NZNATKjFmgI2sE5R0ebyQh5Qk2g-kf-MT4YZ-Vw78M4,992
|
|
81
81
|
iolanta/facets/textual_nanopublication/term_widget.py,sha256=uI5msCTSIYumAIS3I8nBfUz57_vRzvCKkouevrS3Qwk,3536
|
|
82
|
+
iolanta/facets/textual_no_facet_found.py,sha256=gYRSAYDX0t6EHln0S8msLZE27Svfef8iPVfZQ3Vf8Ns,1625
|
|
82
83
|
iolanta/facets/textual_ontology/__init__.py,sha256=3H6bfYaEbXFr90C6ZpGWC4O-24uaO18tnTXx7mckQSA,94
|
|
83
84
|
iolanta/facets/textual_ontology/facets.py,sha256=60g8ANmePb9_i_-d4ui-FdtNwg9aktrOKXHkTQtLp1w,3338
|
|
84
85
|
iolanta/facets/textual_ontology/sparql/terms.sparql,sha256=oVLxN452nqog_95qRaTWnvar6rxPNxPrRonSo7oFFTg,324
|
|
@@ -129,8 +130,9 @@ iolanta/sparqlspace/inference/wikibase-statement-property.sparql,sha256=SkSHZZlx
|
|
|
129
130
|
iolanta/sparqlspace/processor.py,sha256=CXxdi7ORpddXxPh0UlnRG7oqNT9q-WdSPMxqB4CgOis,23570
|
|
130
131
|
iolanta/sparqlspace/sparqlspace.py,sha256=Y8_ZPXwuGEXbEes6XQjaQWA2Zv9y8SWxMPDFdqVBGFo,796
|
|
131
132
|
iolanta/widgets/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
133
|
+
iolanta/widgets/description.py,sha256=Qj5R2wgxJzlAHU0LHyKIoZSCkGk4VBuImWIyiUallhs,215
|
|
132
134
|
iolanta/widgets/mixin.py,sha256=nDRCOc-gizCf1a5DAcYs4hW8eZEd6pHBPFsfm0ncv7E,251
|
|
133
|
-
iolanta-2.0.
|
|
134
|
-
iolanta-2.0.
|
|
135
|
-
iolanta-2.0.
|
|
136
|
-
iolanta-2.0.
|
|
135
|
+
iolanta-2.0.6.dist-info/METADATA,sha256=zqVS0cP1WoIfWm-4NCgDrrryi5uxKwILIyquK8khpGA,2230
|
|
136
|
+
iolanta-2.0.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
137
|
+
iolanta-2.0.6.dist-info/entry_points.txt,sha256=z9RPLmGuz3tYGPV7Qf4nNjuSJYdTUS9enC4595poe-M,221
|
|
138
|
+
iolanta-2.0.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|