BlueBrain / BlueBrain/nexus-forge

Retrieving resources when accessing Resource.<attribute>

Open
#38 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
52
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Following a discussion on Slack with @pafonta and @MFSY :

Currently, with some of the linked resources, the only way to navigate to a wanted resource (due to how they are registered on Nexus) is the following:

```python
"""
a: instance of kgforge.core.Resource
path: instance of list
forge: instance of kgforge.core.KnowledgeGraphForge
"""

r = a
path = ['b', 'c', 'd', 'e', 'f']
for x in path:
rid = r.get(x).id
r = forge.retrieve(rid)
```

I wanted to open up a discussion for being able to traverse the path in these cases without the user having to call for the for the `forge.retrieve` in each step. I.e. the user would be able to do:

```python
"""
a: instance of kgforge.core.Resource
"""

f = a.b.c.d.e.f
```

Whether or not it is feasible, risky, useful, or if it should or should not be implemented, is up for discussion.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.