mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2025-01-10 06:04:28 +00:00
make names less lengthy by only contatenating one layer of nesting with __
This commit is contained in:
parent
b2d7b12a78
commit
9bfee3548e
2 changed files with 23 additions and 2 deletions
3
.github/workflows/tests.yml
vendored
3
.github/workflows/tests.yml
vendored
|
@ -2,6 +2,9 @@ name: Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -133,7 +133,24 @@ class ClassAdapter(Adapter):
|
||||||
"""The full name of the object in the generated linkml
|
"""The full name of the object in the generated linkml
|
||||||
|
|
||||||
Distinct from 'name' which is the thing that's used to define position in
|
Distinct from 'name' which is the thing that's used to define position in
|
||||||
a hierarchical data setting
|
a hierarchical data setting.
|
||||||
|
|
||||||
|
Combines names from ``parent``, if present, using ``"__"`` .
|
||||||
|
Rather than concatenating the full series of names with ``__`` like
|
||||||
|
|
||||||
|
* ``Parent``
|
||||||
|
* ``Parent__child1``
|
||||||
|
* ``Parent__child1__child2``
|
||||||
|
|
||||||
|
we only keep the last parent, so
|
||||||
|
|
||||||
|
* ``Parent``
|
||||||
|
* ``Parent__child1``
|
||||||
|
* ``child1__child2``
|
||||||
|
|
||||||
|
The assumption is that a child name may not be unique, but the combination of
|
||||||
|
a parent/child pair should be unique enough to avoid name shadowing without
|
||||||
|
making humongous and cumbersome names.
|
||||||
"""
|
"""
|
||||||
if self.cls.neurodata_type_def:
|
if self.cls.neurodata_type_def:
|
||||||
name = self.cls.neurodata_type_def
|
name = self.cls.neurodata_type_def
|
||||||
|
@ -141,7 +158,8 @@ class ClassAdapter(Adapter):
|
||||||
# not necessarily a unique name, so we combine parent names
|
# not necessarily a unique name, so we combine parent names
|
||||||
name_parts = []
|
name_parts = []
|
||||||
if self.parent is not None:
|
if self.parent is not None:
|
||||||
name_parts.append(self.parent._get_full_name())
|
parent_name = self.parent._get_full_name().split("__")[-1]
|
||||||
|
name_parts.append(parent_name)
|
||||||
|
|
||||||
name_parts.append(self.cls.name)
|
name_parts.append(self.cls.name)
|
||||||
name = "__".join(name_parts)
|
name = "__".join(name_parts)
|
||||||
|
|
Loading…
Reference in a new issue