This is a continuation of the conversation in the Dev: Cross-DNA Links channel on the Mattermost chat. The conversation explored how to idiomatically reference content from another DNA in your own DNA, given that Holochain doesn’t directly support cross-DNA linking.
Yes this would be a very useful feature… will this be implemented one day?
I don’t know if it’ll ever be implemented in Holochain directly, but maybe — we’ve always said that patterns that are useful enough will get pushed down into core. For now, it should be sufficient for us to talk about creating an idiomatic way of referring to a resource in a separate DNA — the core team has talked about possible options in this HackMD, which is mostly about migrating an agent’s activity from one DNA to another but also talks about links.
When you use it as a graph database, a Holochain DHT can be very amenable to RDF. In RDF, links follow subject-predicate-object syntax. (E.g., “Alice knows Bob”.) In Holochain, the subject is called the ‘base’, the predicate is called the ‘link type’, and the object is called the ‘target’.
As long as you can define a consistent way of identifying an entry in a DHT, you can create a link between two entries. The case of entries that share a DHT is simple and built-in (just use
link_entries), and the case of entries that are on two different DHTs just needs a standard data format.
@pospi and @lucksus did you have any further off-channel conversations about this? I’m curious to hear what your current thinking is. Seems to me that this could go a few different directions, including ‘anchors’ that represent the foreign entry, ‘back-link’ DNAs, and more.
I have a PoC of this, that’s what the Graph database abstraction thread is there to discuss. The underlying pattern (which should be self-evident if you browse through the library code) is the mentioned ‘anchor’ entry which records are referenced by. This seems to work well both between zomes in the same DNA and for foreign content.
The other needed component for this is a working Holochain URI resolver implementation, see holo-rea/#49 and holo-rea/#50. Would appreciate any advice on either of those issues as there are a lot of unknowns pending work in core.