diff --git a/setup.py b/setup.py index 5ff3793..c8957dd 100644 --- a/setup.py +++ b/setup.py @@ -8,12 +8,12 @@ def read(file_path): setup( name = 'shexer', packages = find_packages(exclude=["*.local_code.*"]), # this must be the same as the name above - version = '2.5.2', + version = '2.5.3', description = 'Automatic schema extraction for RDF graphs', author = 'Daniel Fernandez-Alvarez', author_email = 'danifdezalvarez@gmail.com', url = 'https://github.com/DaniFdezAlvarez/shexer', - download_url = 'https://github.com/DaniFdezAlvarez/shexer/archive/2.5.2.tar.gz', + download_url = 'https://github.com/DaniFdezAlvarez/shexer/archive/2.5.3.tar.gz', keywords = ['testing', 'shexer', 'shexerp3', "rdf", "shex", "shacl", "schema"], long_description = read('README.md'), long_description_content_type='text/markdown', diff --git a/shexer/io/uml/uml_serializer.py b/shexer/io/uml/uml_serializer.py index 68e73b7..dea1a43 100644 --- a/shexer/io/uml/uml_serializer.py +++ b/shexer/io/uml/uml_serializer.py @@ -109,7 +109,7 @@ def _is_a_shape_link(self, statement): def _declare_and_open_shape(self, a_shape): target_name = prefixize_shape_name_if_possible(a_shape_name=a_shape.name, namespaces_prefix_dict=self._namespaces_dict) - if target_name.startswith(":") or target_name.startswith("<") : + if ":" in target_name or "-" in target_name or target_name.startswith("<") : self._declare_shape_with_alias(target_name) else: self._declare_shape_without_alias(target_name) @@ -119,9 +119,11 @@ def _declare_shape_without_alias(self, target_name): self._write_line(f"object {target_name} {{") def _declare_shape_with_alias(self, target_name): - if target_name.startswith(":"): - alias = target_name[1:] - else: + alias = target_name + alias = alias.replace(":", "_") + alias = alias.replace("-", "_") + + if alias.startswith("<"): alias = target_name[1:-1] self._shape_alias[target_name] = alias self._write_line(f'object "{target_name}" as {alias} {{')