cmem-cmemc 25.1.0__py3-none-any.whl → 25.2.0__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.
cmem_cmemc/constants.py CHANGED
@@ -13,3 +13,5 @@ NS_ACL = "http://eccenca.com/ac/"
13
13
  NS_USER = "http://eccenca.com/"
14
14
  NS_GROUP = "http://eccenca.com/"
15
15
  NS_ACTION = "https://vocab.eccenca.com/auth/Action/"
16
+
17
+ UNKNOWN_GRAPH_ERROR = "The graph {} is not accessible or does not exist."
cmem_cmemc/context.py CHANGED
@@ -29,9 +29,9 @@ from cmem_cmemc.exceptions import InvalidConfigurationError
29
29
  from cmem_cmemc.string_processor import StringProcessor, process_row
30
30
  from cmem_cmemc.utils import is_enabled, str_to_bool
31
31
 
32
- DI_TARGET_VERSION = "v24.3.0"
32
+ DI_TARGET_VERSION = "v25.1.0"
33
33
 
34
- EXPLORE_TARGET_VERSION = "v24.3.0"
34
+ EXPLORE_TARGET_VERSION = "v25.1.0"
35
35
 
36
36
  KNOWN_CONFIG_KEYS = {
37
37
  "CMEM_BASE_URI": cmempy_config.get_cmem_base_uri,
@@ -11,7 +11,7 @@ class RemoveHideHeaderFooterStatements(MigrationRecipe):
11
11
  id = "hide-header-footer-25.1"
12
12
  description = "Remove triples using deprecated shui:valueQueryHideHeader|Footer terms"
13
13
  component: components = "explore"
14
- first_version = "24.3" # needs to changed right before release
14
+ first_version = "25.1"
15
15
  tags: ClassVar[list[str]] = ["shapes", "user"]
16
16
  check_query = """{{DEFAULT_PREFIXES}}
17
17
  SELECT ?shape
cmem_cmemc/utils.py CHANGED
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING
12
12
  from zipfile import BadZipFile, ZipFile
13
13
 
14
14
  import requests
15
- from click import ClickException
15
+ from click import Argument, ClickException
16
16
  from cmem.cmempy.dp.proxy.graph import get_graphs_list
17
17
  from cmem.cmempy.queries import QueryCatalog
18
18
  from cmem.cmempy.workspace.projects.project import get_projects
@@ -84,27 +84,57 @@ def iri_to_qname(iri: str) -> str:
84
84
  return iri
85
85
 
86
86
 
87
- def read_rdf_graph_files(directory_path: str) -> list[tuple[str, str]]:
88
- """Read all files from directory_path and output as tuples.
87
+ @dataclass
88
+ class RdfGraphData:
89
+ """Represents the data structure for RDF graph information.
90
+
91
+ Attributes:
92
+ file_path: The absolute path to the RDF data file.
93
+ graph_iri: The iri of the graph.
94
+ graph_imports: A list of graph imports.
89
95
 
90
- The tuple format is (filepath, graph_name),
91
- for example ("/tmp/rdf.nt", "http://example.com")
92
96
  """
93
- rdf_graphs = []
97
+
98
+ file_path: str
99
+ graph_iri: str
100
+ graph_imports: list[str]
101
+
102
+
103
+ def read_rdf_graph_files(directory_path: str) -> list[RdfGraphData]:
104
+ """Read all files from directory_path and output as RdfGraphData."""
105
+ rdf_graphs: list[RdfGraphData] = []
94
106
  for root, _, files in os.walk(directory_path):
95
107
  for _file in files:
96
- if _file.endswith(".graph"):
108
+ if _file.endswith((".graph", ".imports")):
97
109
  continue
98
- full_file_path = SmartPath(root) / _file
110
+ file_path = SmartPath(root) / _file
99
111
  # Handle compressed files (like .gz)
100
112
  if _file.endswith(".gz"):
101
- graph_file_name = _file.replace(".gz", ".graph")
113
+ _graph_file = _file.replace(".gz", ".graph")
114
+ _graph_imports_file = _file.replace(".gz", ".imports")
102
115
  else:
103
- graph_file_name = f"{_file}.graph"
104
- full_graph_file_name_path = SmartPath(root) / graph_file_name
105
- if full_graph_file_name_path.exists():
106
- graph_name = read_file_to_string(str(full_graph_file_name_path)).strip()
107
- rdf_graphs.append((str(full_file_path.resolve()), graph_name))
116
+ _graph_file = f"{_file}.graph"
117
+ _graph_imports_file = f"{_file}.imports"
118
+ graph_file_path = SmartPath(root) / _graph_file
119
+ imports_file_path = SmartPath(root) / _graph_imports_file
120
+ graph_name = ""
121
+ graph_imports = []
122
+ if graph_file_path.exists():
123
+ graph_name = read_file_to_string(str(graph_file_path)).strip()
124
+
125
+ if imports_file_path.exists():
126
+ # Read the graph imports.
127
+ imports_content = read_file_to_string(str(imports_file_path)).strip()
128
+ graph_imports = imports_content.split("\n") if imports_content else []
129
+
130
+ if graph_name:
131
+ rdf_graphs.append(
132
+ RdfGraphData(
133
+ file_path=str(file_path.resolve()),
134
+ graph_iri=graph_name,
135
+ graph_imports=graph_imports,
136
+ )
137
+ )
108
138
  return rdf_graphs
109
139
 
110
140
 
@@ -414,3 +444,11 @@ def is_enabled(params: dict[str, str], config: PureSectionConfigParser, key: str
414
444
  return str_to_bool(config.defaults()[key])
415
445
 
416
446
  return False
447
+
448
+
449
+ def tuple_to_list(ctx: type["ApplicationContext"], param: Argument, value: tuple) -> list: # noqa: ARG001
450
+ """Get a list from a tuple
451
+
452
+ Used as callback to have mutable values
453
+ """
454
+ return list(value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cmem-cmemc
3
- Version: 25.1.0
3
+ Version: 25.2.0
4
4
  Summary: Command line client for eccenca Corporate Memory
5
5
  License: Apache-2.0
6
6
  Author: eccenca
@@ -27,7 +27,7 @@ Classifier: Topic :: Software Development :: Testing
27
27
  Classifier: Topic :: Utilities
28
28
  Requires-Dist: beautifulsoup4 (>=4.13.3,<5.0.0)
29
29
  Requires-Dist: certifi (>=2024.2.2)
30
- Requires-Dist: click (>=8.1.8,<9.0.0)
30
+ Requires-Dist: click (>=8.1.8,<8.2.0)
31
31
  Requires-Dist: click-didyoumean (>=0.3.1,<0.4.0)
32
32
  Requires-Dist: click-help-colors (>=0.9.4,<0.10.0)
33
33
  Requires-Dist: cmem-cmempy (==25.1.0)
@@ -2,33 +2,34 @@ cmem_cmemc/__init__.py,sha256=-RPEVweA-fcmEAynszDDMKwArJgxZpGW61UBiV7O4Og,24
2
2
  cmem_cmemc/_cmemc.zsh,sha256=fmkrBHIQxus8cp2AgO1tzZ5mNZdGL_83cYz3a9uAdsg,1326
3
3
  cmem_cmemc/cli.py,sha256=vDdSHFmXUstC3T7OlbPSd0hXxyigJE4VVgRMcsNz5cc,4538
4
4
  cmem_cmemc/command.py,sha256=nBtrwPKFJLRpD3IPk5hKyn2LOMl-1ae7SV9iRhgky8k,1958
5
- cmem_cmemc/command_group.py,sha256=0ltd8xY0yN6_ARR2kkwx7Hibj4glT9M0_bnjKlMhz8g,3371
5
+ cmem_cmemc/command_group.py,sha256=DCHQzt2JXRLZWXbnKd5-ZpIp5GTN0SKX90Me8R8naKQ,3429
6
6
  cmem_cmemc/commands/__init__.py,sha256=NaGM5jOzf0S_-4UIAwlVDOf2AZ3mliGPoRLXQJfTyZs,22
7
7
  cmem_cmemc/commands/acl.py,sha256=zy27D_GeEaYEn3P6EEHtQ55sbWkjgwTgspCeuBWPL14,16006
8
- cmem_cmemc/commands/admin.py,sha256=VGFEen4aVcKr2Fk3IoVu3JX-r8r99r7iE-3QFrkjJs0,9249
8
+ cmem_cmemc/commands/admin.py,sha256=wq9QE-5hfxUM1zQbzicjgQ-T_D9Sa2hlRNVyIHMbzNk,9234
9
9
  cmem_cmemc/commands/client.py,sha256=nBs7MoF2wF45AteTCeIQrXcOwKmHHCd8_lG_SM2mQSA,5127
10
- cmem_cmemc/commands/config.py,sha256=MXiBGMKOj8zVyKOBwly1Hg3ywkylfIBUjEz30WkibkU,5777
10
+ cmem_cmemc/commands/config.py,sha256=VHiVkW6NFuz-tpKXRPl7dO1gIXQLOuEhlGVxb422qwA,5803
11
11
  cmem_cmemc/commands/dataset.py,sha256=zylVsfBD92LzHgQ96edNKaQNsf0zKoPro0VQdX--Mu8,30488
12
- cmem_cmemc/commands/graph.py,sha256=RrrmiMTwKcD8CpWoM5ZUNwOFlOO8AIlauS39G_h41xg,32486
12
+ cmem_cmemc/commands/graph.py,sha256=_VtNpCwZF-Cdrv_WAQ5x1pYUB-FnWOxq4-n5qIzu81E,32335
13
+ cmem_cmemc/commands/graph_imports.py,sha256=gUcBSBLk7TXyvMth1jdLTb1L20iWidzjXNgb9E1fZUg,14157
13
14
  cmem_cmemc/commands/manual.py,sha256=-sZWeFL92Kj8gL3VYsbpKh2ZaVTyM3LgKaUcpNn9u3A,2179
14
15
  cmem_cmemc/commands/metrics.py,sha256=pIBRTq90f7MEI99HLdFLN3D1xQ2Z2u6VKUeTIz0X7DY,12205
15
- cmem_cmemc/commands/migration.py,sha256=MtavtlvXrmFfgBGL_GWlDat_8Ub6cjHeAiNorKtQo_0,9644
16
- cmem_cmemc/commands/project.py,sha256=cAJ6Bwl0clzOP4b6CXa8wXsISrLQJTFEL-vJf_btjPc,20585
17
- cmem_cmemc/commands/python.py,sha256=1It8_6Lh79hHafEtHtl7f3SkJt8Zj_VEIH-muczl5ys,11947
18
- cmem_cmemc/commands/query.py,sha256=AFOBjeDYtSHpPthY8PTfPoBiNikOqMhk8c8SVzsXEVY,27579
19
- cmem_cmemc/commands/resource.py,sha256=O0RV-lJNdTI3-pTmnKv5zcAkfTkuFVs0UbmknCbsgUU,7788
20
- cmem_cmemc/commands/scheduler.py,sha256=Ew-VvhyuoLr4YTPCjEAcQWK1LV8lFoH1cnVjfVwIQnM,8761
21
- cmem_cmemc/commands/store.py,sha256=zZiOBu2rGqZDkfp2xgO7GLHMRhO3Yxt0myODBNM_K3M,10411
16
+ cmem_cmemc/commands/migration.py,sha256=y9v4Be7WELGjDGDBZrfLBeqU_G_JH1fnP5UVG9qjB3g,9638
17
+ cmem_cmemc/commands/project.py,sha256=zHqs7XBsRjzTO6EGxaN_TgZ_rsqyIPF59aObuMhsfmA,20593
18
+ cmem_cmemc/commands/python.py,sha256=7ExdKr7nTED5ZZGjeBk5UngNI3F_KNcavwUgwaxApV0,11965
19
+ cmem_cmemc/commands/query.py,sha256=XtWZHu7BhQfAHEh3gbFTeJwI88mUhHFvMCyrFRVVSVs,27601
20
+ cmem_cmemc/commands/resource.py,sha256=74cn_yqMv3a6xOQAPpNCuluTWEH-_2PGENJnl7y8qz4,7778
21
+ cmem_cmemc/commands/scheduler.py,sha256=zYeO1-Hlxh9D-I9JIweQ-SEA0la0wv0EicY_UY7rNCg,8751
22
+ cmem_cmemc/commands/store.py,sha256=19otpzsOv2F-mH2cuq4Oz2i2vAHYdfSIQm2ec81yIFg,10429
22
23
  cmem_cmemc/commands/user.py,sha256=ANZpeOBA46xiqOcNPrueComsCV0gEBbav-vOL9VgyX4,12535
23
24
  cmem_cmemc/commands/validation.py,sha256=Fv5yBIXzqy8FyjIzo-wJkv_7H5bhtcQhMxFIlJEVoBw,29495
24
- cmem_cmemc/commands/variable.py,sha256=VZ60pl98xoOFCkRGdTnJENfgaHWoUoUTgkgfMT4TQgQ,11568
25
+ cmem_cmemc/commands/variable.py,sha256=aLRH_rFe0h7JBpKIqzcevbk26vczgUGokIDY8g6LPxA,11576
25
26
  cmem_cmemc/commands/vocabulary.py,sha256=fdXsG7gspA6HeOasXis1ky9UIZG-qRYP-NiFcvzCTKM,17840
26
27
  cmem_cmemc/commands/workflow.py,sha256=RRSWJsJzL5w-E7gb--aQgqU1BB1uZt-XCCLaHcNVhxs,25536
27
28
  cmem_cmemc/commands/workspace.py,sha256=IcZgBsvtulLRFofS70qpln6oKQIZunrVLfSAUeiFhCA,4579
28
- cmem_cmemc/completion.py,sha256=I-unDn_zDO5H0fNsRRIgHodQ3_NtCi_sxALwpRickaE,45723
29
+ cmem_cmemc/completion.py,sha256=4DV76QbkpExraDdtjDVVVNFsED4pfWzxuTYavmUGX6k,45502
29
30
  cmem_cmemc/config_parser.py,sha256=NduwOT-BB_uAk3pz1Y-ex18RQJW-jjHzkQKCEUUK6Hc,1276
30
- cmem_cmemc/constants.py,sha256=VKNF5-6fzZXWzPgm1OAGhWvyL4YE8SRq52kkpJjUgB0,475
31
- cmem_cmemc/context.py,sha256=MQG-Qg0UwgaRe-MUgiD_xdF3uNaA3XwFSqtj-1uq8-w,22247
31
+ cmem_cmemc/constants.py,sha256=pzZYbSaTDUiWmE-VOAHB20oivHew5_FP9UTejySsVK4,550
32
+ cmem_cmemc/context.py,sha256=jIta2wgQ3wHviLpzaHKlt-6_Ur7M04I6fBtIIF7s4Cs,22247
32
33
  cmem_cmemc/exceptions.py,sha256=0lsGOfXhciNGJloJGERMbbPuBbs5IwIIJ_5YnY9qQ-8,546
33
34
  cmem_cmemc/manual_helper/__init__.py,sha256=G3Lqw2aPxo8x63Tg7L0aa5VD9BMaRzZDmhrog7IuEPg,43
34
35
  cmem_cmemc/manual_helper/graph.py,sha256=HU04NYWeJ6LmW4UC7qHr1v1qsm2Md61pJ-pgWUHFmHY,3647
@@ -38,7 +39,7 @@ cmem_cmemc/migrations/__init__.py,sha256=i6Ri7qN58ou_MwOzm2KibPkXOD7u-1ELky-nUE5
38
39
  cmem_cmemc/migrations/abc.py,sha256=UGJzrvMzUFdp2-sosp49ObRI-SrUSzLJqLEhvB4QTzg,3564
39
40
  cmem_cmemc/migrations/access_conditions_243.py,sha256=IXcvSuo9pLaTTo4XNBB6_ln-2TzOV5PU5ugti0BWbxA,5083
40
41
  cmem_cmemc/migrations/bootstrap_data.py,sha256=RF0vyFTGUQ_RcpTTWZmm3XLAJAJX2gSYcGwcBmRmU8A,963
41
- cmem_cmemc/migrations/remove_noop_triple_251.py,sha256=XIJyKsqOulpAWQQBb54H4ft4tJNrGJAcdfo5gyjiI1M,1492
42
+ cmem_cmemc/migrations/remove_noop_triple_251.py,sha256=392FZV5ipUMeqqc2QJWfupFeNRR4ceKPmyak17I5xVk,1451
42
43
  cmem_cmemc/migrations/shapes_widget_integrations_243.py,sha256=8lQTOlEJvlrDvdvKkl5OAjnyx1jMRgQnU6Bk_fEORYQ,8543
43
44
  cmem_cmemc/migrations/sparql_query_texts_242.py,sha256=K_GbxaX5-kkQKDZMq8UvT1vHazde53htwdDHGyB0b9s,1568
44
45
  cmem_cmemc/migrations/workspace_configurations.py,sha256=tFmCdfEL10ICjqMXQEIf-9fveE41HBQ_jaWNQJENz50,998
@@ -51,9 +52,9 @@ cmem_cmemc/smart_path/clients/__init__.py,sha256=YFOm69BfTCRvAcJjN_CoUmCv3kzEciy
51
52
  cmem_cmemc/smart_path/clients/http.py,sha256=3clZu2v4uuOvPY4MY_8SVSy7hIXJDNooahFRBRpy0ok,2347
52
53
  cmem_cmemc/string_processor.py,sha256=kSVePdgFmf2ekurKj6TbDJn6ur82VGLwCsTJ9ODfBEU,2879
53
54
  cmem_cmemc/title_helper.py,sha256=7frjAR54_Xc1gszOWXfzSmKFTawNJQ7kkXhZcHmQLyw,1250
54
- cmem_cmemc/utils.py,sha256=TTis2uwB1KB_1Q7oebblsLsNf54Sn-UzIXKBfq874KU,13489
55
- cmem_cmemc-25.1.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
56
- cmem_cmemc-25.1.0.dist-info/METADATA,sha256=IKbknWeYYEPgjS_xcMtXDwFl92eY8tbV29_4qe9b9z8,5642
57
- cmem_cmemc-25.1.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
58
- cmem_cmemc-25.1.0.dist-info/entry_points.txt,sha256=2G0AWAyz501EHpFTjIxccdlCTsHt80NT0pdUGP1QkPA,45
59
- cmem_cmemc-25.1.0.dist-info/RECORD,,
55
+ cmem_cmemc/utils.py,sha256=PkDFDISz7uemJCmyIWmtCcjfR_gRnRBL8ao76Ex-py8,14669
56
+ cmem_cmemc-25.2.0.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
57
+ cmem_cmemc-25.2.0.dist-info/METADATA,sha256=YCX8gSYtSaysjKVoVjTgdE9SP-dqr8K2fS69ajLwhBg,5642
58
+ cmem_cmemc-25.2.0.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
59
+ cmem_cmemc-25.2.0.dist-info/entry_points.txt,sha256=2G0AWAyz501EHpFTjIxccdlCTsHt80NT0pdUGP1QkPA,45
60
+ cmem_cmemc-25.2.0.dist-info/RECORD,,