iolanta 2.0.5__tar.gz → 2.0.6__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.
Files changed (137) hide show
  1. {iolanta-2.0.5 → iolanta-2.0.6}/PKG-INFO +2 -2
  2. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/main.py +2 -2
  3. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/textual-browser.yaml +6 -0
  4. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/locator.py +19 -0
  5. iolanta-2.0.6/iolanta/facets/textual_no_facet_found.py +68 -0
  6. iolanta-2.0.6/iolanta/widgets/description.py +12 -0
  7. {iolanta-2.0.5 → iolanta-2.0.6}/pyproject.toml +2 -2
  8. {iolanta-2.0.5 → iolanta-2.0.6}/README.md +0 -0
  9. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/__init__.py +0 -0
  10. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/base_plugin.py +0 -0
  11. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/__init__.py +0 -0
  12. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/formatters/__init__.py +0 -0
  13. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/formatters/choose.py +0 -0
  14. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/formatters/csv.py +0 -0
  15. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/formatters/json.py +0 -0
  16. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/formatters/pretty.py +0 -0
  17. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/models.py +0 -0
  18. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/cli/pretty_print.py +0 -0
  19. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/context.py +0 -0
  20. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/conversions.py +0 -0
  21. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/cli.yaml +0 -0
  22. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/context.yaml +0 -0
  23. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/graph-triples.yamlld +0 -0
  24. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/html.yaml +0 -0
  25. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/data/iolanta.yaml +0 -0
  26. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/ensure_is_context.py +0 -0
  27. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/entry_points.py +0 -0
  28. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/errors.py +0 -0
  29. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/__init__.py +0 -0
  30. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/__init__.py +0 -0
  31. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/base.py +0 -0
  32. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/default.py +0 -0
  33. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/record.py +0 -0
  34. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/sparql/link.sparql +0 -0
  35. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/cli/sparql/record.sparql +0 -0
  36. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/errors.py +0 -0
  37. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/facet.py +0 -0
  38. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/foaf_person_title/__init__.py +0 -0
  39. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/foaf_person_title/facet.py +0 -0
  40. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/foaf_person_title/sparql/names.sparql +0 -0
  41. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/generic/__init__.py +0 -0
  42. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/generic/bool_literal.py +0 -0
  43. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/generic/date_literal.py +0 -0
  44. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/generic/default.py +0 -0
  45. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/generic/sparql/default.sparql +0 -0
  46. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/html/__init__.py +0 -0
  47. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/html/base.py +0 -0
  48. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/html/code_literal.py +0 -0
  49. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/html/default.py +0 -0
  50. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/icon.py +0 -0
  51. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/page_title.py +0 -0
  52. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/qname.py +0 -0
  53. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/__init__.py +0 -0
  54. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/app.py +0 -0
  55. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/facet.py +0 -0
  56. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/history.py +0 -0
  57. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/home.py +0 -0
  58. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/location.py +0 -0
  59. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/models.py +0 -0
  60. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/page.py +0 -0
  61. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_browser/page_switcher.py +0 -0
  62. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_class/__init__.py +0 -0
  63. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_class/facets.py +0 -0
  64. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_class/sparql/instances.sparql +0 -0
  65. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/__init__.py +0 -0
  66. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/facets.py +0 -0
  67. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/sparql/inverse-properties.sparql +0 -0
  68. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/sparql/label.sparql +0 -0
  69. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/sparql/nodes-for-property.sparql +0 -0
  70. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/sparql/properties.sparql +0 -0
  71. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/tcss/default.tcss +0 -0
  72. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/templates/default.md +0 -0
  73. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/triple_uri_ref.py +0 -0
  74. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_default/widgets.py +0 -0
  75. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_graph/__init__.py +0 -0
  76. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_graph/facets.py +0 -0
  77. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_graph/sparql/triples.sparql +0 -0
  78. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_graph_triples.py +0 -0
  79. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_link/__init__.py +0 -0
  80. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_link/facet.py +0 -0
  81. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/__init__.py +0 -0
  82. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/facet.py +0 -0
  83. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/models.py +0 -0
  84. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/nanopublication_widget.py +0 -0
  85. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/term_list_widget.py +0 -0
  86. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_nanopublication/term_widget.py +0 -0
  87. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_ontology/__init__.py +0 -0
  88. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_ontology/facets.py +0 -0
  89. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_ontology/sparql/terms.sparql +0 -0
  90. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_ontology/sparql/visualization-vocab.sparql +0 -0
  91. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_property_pairs_table.py +0 -0
  92. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_provenance/__init__.py +0 -0
  93. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_provenance/facets.py +0 -0
  94. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_provenance/sparql/graphs.sparql +0 -0
  95. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/textual_provenance/sparql/triples.sparql +0 -0
  96. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/title/__init__.py +0 -0
  97. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/title/facets.py +0 -0
  98. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/title/sparql/title.sparql +0 -0
  99. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/wikibase_statement_title/__init__.py +0 -0
  100. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/wikibase_statement_title/facets.py +0 -0
  101. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/facets/wikibase_statement_title/sparql/statement-title.sparql +0 -0
  102. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/iolanta.py +0 -0
  103. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/__init__.py +0 -0
  104. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/base.py +0 -0
  105. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/data_type_choice.py +0 -0
  106. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/dict_loader.py +0 -0
  107. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/errors.py +0 -0
  108. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/http.py +0 -0
  109. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/local_directory.py +0 -0
  110. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/local_file.py +0 -0
  111. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/loaders/scheme_choice.py +0 -0
  112. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/models.py +0 -0
  113. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/namespaces.py +0 -0
  114. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/node_to_qname.py +0 -0
  115. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parse_quads.py +0 -0
  116. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/__init__.py +0 -0
  117. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/base.py +0 -0
  118. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/dict_parser.py +0 -0
  119. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/errors.py +0 -0
  120. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/json.py +0 -0
  121. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/markdown.py +0 -0
  122. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/parsers/yaml.py +0 -0
  123. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/plugin.py +0 -0
  124. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/query_result.py +0 -0
  125. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/reformat_blank_nodes.py +0 -0
  126. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/resolvers/__init__.py +0 -0
  127. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/resolvers/base.py +0 -0
  128. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/resolvers/python_import.py +0 -0
  129. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/shortcuts.py +0 -0
  130. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/__init__.py +0 -0
  131. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/cli.py +0 -0
  132. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/inference/wikibase-claim.sparql +0 -0
  133. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/inference/wikibase-statement-property.sparql +0 -0
  134. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/processor.py +0 -0
  135. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/sparqlspace/sparqlspace.py +0 -0
  136. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/widgets/__init__.py +0 -0
  137. {iolanta-2.0.5 → iolanta-2.0.6}/iolanta/widgets/mixin.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: iolanta
3
- Version: 2.0.5
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.7)
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
 
@@ -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(url).absolute()
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
@@ -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
+ )
@@ -0,0 +1,12 @@
1
+ from textual.widgets import Label
2
+
3
+
4
+ class Description(Label):
5
+ """Free form textual description."""
6
+
7
+ DEFAULT_CSS = """
8
+ Description {
9
+ padding: 1;
10
+ padding-left: 4;
11
+ }
12
+ """ # noqa: WPS115
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "iolanta"
3
- version = "2.0.5"
3
+ version = "2.0.6"
4
4
  description = "Semantic Web browser"
5
5
  authors = ["Anatoly Scherbakov <altaisoft@gmail.com>"]
6
6
  license = "MIT"
@@ -23,7 +23,7 @@ rich = ">=13.3.1"
23
23
  textual = ">=0.83.0"
24
24
  yarl = ">=1.9.4"
25
25
  boltons = ">=24.0.0"
26
- yaml-ld = ">=1.1.7"
26
+ yaml-ld = ">=1.1.9"
27
27
  reasonable = ">=0.2.6"
28
28
  oxrdflib = ">=0.4.0"
29
29
  loguru = ">=0.7.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes