Add support for link types

I take notes for 12 years now. I also decided to use plain text after moving from one tool to another more than once.

Sometimes I moved from one tool because it became too slow, sometimes because it was aesthetically unpleasant, etc. I moved into Obsidian because it offered to autocomplete the ‘[]’ and the other didn’t.

If you use text, you are not ‘married’ to any tool.

Along the way, I developed my super primitive symbolic system with little cues that I could remember and type in a search box or a grep command. To look at all the notes of my friends, I search the phrase ‘is a friend’, and If I want all the addresses of my friends, I search for ‘is a friend’ and ‘has address’. I’ve seen that many people in this community do this with tags .

I only write graphs because they force me to think better about things; to go for coherence and completeness.

I need to look at the graph and to know what the links are about

2 Likes

Since we control our notes, programs like Juggl (Out now! 1.0.1): A completely interactive, stylable and expandable graph view plugin! of @emile can be used to extract information from our notes and write a graph.

Information could be extracted directly from the Markdown, such as tables, mermaid diagrams, other graphs’ ‘dialects’ etc. This ‘middleware’ can have several outputs, different graph dialects, csv, tables, etc. Or the omnipresent ‘Excel’.

Or perhaps there is something already there that could be reused or built upon? I discovered https://unifiedjs.com/ the other day.

When I write notes, I try to think about how they will be processed years from now. I believe that something that generates structure data is valuable to be used by the current tools or that AI program of the future that will surprise me in the next years, who knows!

This “single” Unix command will extract links from a vault, and reformat them in a form that can go directly into GraphViz:

egrep -roI ‘\[\[[^]]+\]\]’ VaultName|sed ‘s/^/“/;s/.md:\[\[/” → “/;s/\]\]/”/’

Should also work on Mac, but I didn’t test. I only spent about 60 seconds coming up with this so there might be edge cases I didn’t consider. This is what I love about text, and what I love about Obsidian. It doesn’t tie up my data in a format I can’t use elsewhere easily. Easy extraction of links and their types (I didn’t process for types in the above command) means I can externally answer questions like, “How is A related to B?” Then just apply a route-finding algorithm that will output each possible route and the association types that get us there. It would be great if I could tie that functionality into Obsidian, but I’m not holding my breath. Besides, Obsidian doesn’t render self-referencing links (notes with a link to itself) so I can’t completely rely on the visualization. Still, as a tool, Obsidian is compatible with my way of working with notes.

Edit: Escape sequences disappeared, fixed.

Hi @cristian it looks like we have some philosophical alignment on how we handle notes. I avoided moving my notes to different tools only because I never committed to a tool while I continued to research options. There are many great tools out there by which we can build workflows of knowledge management. What I love about Obsidian is that it is aligned closely enough with how I already structure my notes, that moving to it is easy, and moving away from it if necessary is also easy. There’s an elegant power in that freedom. I look forward to what comes next for Obsidian. Hopefully we’ll get named-links. This will provide the context to walk graphs and ask deeper questions via a plugin.

1 Like

This is a fascinating discussion. I am a neuroscience researcher, and I’ve dreamed of being able to have a system that I can input research findings and use graphs to make novel insights and inferences.

I love the flexibility and futureproofing of plain-text notes. But sometimes it would be nice to have the functionality of a more formal database to integrate pieces of data.

There is a tool that does this (based on Neo4J)

But I’m reluctant to build on someone else’s tool.

The ability to specify link types in plain text with Obsidian would allow one to build such maps of interactions between notes in powerful ways. I hope this thread and accompanying tools continue to develop.

This discussion might also be of interest:

2 Likes

Hi all. For the Neo4j Graph View plugin, I want to support a better way to represent link types. I’ve been writing a bit about this here https://publish.obsidian.md/semantic-obsidian/Link+Types

I’d love to get some input from the people in this thread, and to discuss together with the goal of finding a good Markdown specification for link types and link properties. I’ve opened a Discord for the plugin, where we’re having a discussion about exactly this topic: https://discord.gg/sAmSGpaPgM . Feel free to join :slight_smile:

1 Like

I’m reticent to put my data into yet another tool. I like where it is, in a folder of my hard drive :stuck_out_tongue:

Nowadays I miss something that helps you to draw small maps of interactions between notes. A complementary tool for thought, not meant to discover new things but to synthesize, simplify, organize, and merge content.

Perhaps we can imagine a simple way to draw these small maps?

Some use mindmaps, that can be embedded in Maps of Content.

I personally would like a dialect to embed this info, specifying the nodes positions, colors, everything aesthetical that matters or help us to think clearly

```think-map

In 1957 Walt Disney drew the media empire he was trying to build.

He didn’t have a computer to draw connections through…

4 Likes

Proposal to extend the existing link syntax to support user-defined labels on edges in graph view.

Issue

Links in and of themselves provide no meaningful context therefore context must be supplied through the written word. This works when reading the note directly but when viewing the graph view these transitionary contexts are lost – it is not clear from the graph view why a link exists, only that the link exists.

This is a fundamental weakness in all current note taking systems and is a weakness of the web itself.

Benefits

Allowing the user to define labels for edges will make it easy to see at a glance in the graph view the nature of all relationships between this note and the linked notes. Users can quickly “surf” from note to note via the graph view if desired and then “dive in” to a specific note.

Unlike the web there is no need for a centralized canonical registry of labels with agreed upon meanings – users are free to use arbitrary labels with arbitrary meanings.

Labeled arcs also approximate a mind map of the user’s notes. All in the filterable graph view.

Syntax

Given a link [[notename]] the syntax can be extended as follows: [[notename@label]].

@ is chosen as it represents labeling the arc between the nodes.

Ex: [[Teach cats how to build giant robots@bad idea]]

Users could even use emoji labels for shorthand:

Ex: [[Teach cats how to build giant robots@🙀]]

Possible labels

Possible labels may include: (but are limited only by imagination)

  • is a
  • has a / has N
  • supports
  • opposes / contradicts
  • works well with
  • do not use with
  • elaboration/amplification (as in thought A evolved into concept B branched into two more lines of thought…)
  • owns / owned by
  • works in / works on / works with
  • good idea
  • bad idea / dead end (for those of us who want to keep the bad ideas and warn ourselves not to go that way)
  • :heart:
  • :bulb:

Display

Display the label as small text alongside the arrow, with a selectable CSS class so it can be customized by themes. Default to the same color as the arrow.

Consider also creating a second custom class for each label, containing the name of the label itself, for additional CSS customization by the user/theme.

Ex:

Given a link [[Teach cats how to build flamethrowers@great idea]] generate something like this:

<div class="graph-arc-label graph-arc-labeltext--great-idea">great idea</div>

allowing users to write custom CSS like this:

/* all hail the cat overlords */
.graph-arc-labeltext--great-idea { 
    color: red; 
    background-color: yellow; 
}

so the brilliant idea is more prominent when viewing the graph.

This also helps encourage more focused note taking, since transitions can be clearly and easily established in the link itself.

7 Likes

Hi Dave,

I agree with some things you say, and also the way we can customize items with CSS. (I would love to use something like this to customize nodes in the graph, with things like images).

Regarding the notation, I think it’s too aggressive because it can break compatibility with wikilinks.

So for example:

[[tchtbf@great idea]]

It would be interpreted as ‘tchtbf@great idea’ by some apps and ‘tchtbf’ by others.

I wish markdown had something to embed ‘invisible’ metadata.

I differ with this part:

The ‘Semantic Web’ that is already part of the Web! :wink:

1 Like

Hi @cristian, as someone who was heavily into the Semantic Web work ca 2000-2003 I would agree, if it had actually developed into something useful and widely used. The fact that it did not indicates it was an ineffective concept, thus the web as it exists today has a fundamental lack of this capability.

@davecan , I differ.

Just one example:

When you search for ‘shoes’ in google, you get an info-box with structured data.
This data was gathered processing RDF embedded in the HTML pages.

This is widely used.

However, I agree that it failed as a concept. I believe we cannot represent 100% reality. But that’s another topic, I guess.

Adding my vote here that the externalized triple format proposed by @datum while interesting is absolutely not something I would use. My entire workflow relies on fluidity and I’ve gotten it (in an extremely short time – couple weeks) to a point where when I’m creating and linking notes it feels more like I’m interacting directly with the notes physically rather than working through Obsidian. Obsidian in that sense just melts away a little bit.

Expressing link types directly at the point of link definition is the way to go IMO. Requiring an external note to create the relationships through the triple format is friction that will almost never be used by me, and I would suspect others as well, because it interrupts the flow and forces us to stop thinking about our notes and start thinking about Obsidian again.

The colon-based format seems useful to me, but perhaps it should become a separate delimiter rather than using it after the pipe, since the pipe is already used to separate the file name from the display name which can be autocompleted from the alias front matter. I used this a lot since I prefix my notes with ZK-style UIDs.

Possible syntax alternatives:

  • [[the note:label|link text]]
  • [[the note|link text]]:label
  • [[the note->label|link text]]
  • [[the note|link text]:label]
  • [[the note|link text]->label]
  • [[the note|link text]]->label (risks collision with existing notes, but maybe not a huge deal)

I quite like the -> syntax in the third bullet…

1 Like

@davecan, if you’re referring to my 12/19 post, it wasn’t my idea and I wasn’t supporting the notion. Actually I was explaining why it isn’t a good idea. I finished with:

Personally I don’t see this happening due to the ambiguity created.

I wish markdown had something to embed ‘invisible’ metadata.

At least for reference-style links/images in MultiMarkdown, one can add attributes to links and images in the link reference information, e.g.:

[link]:  http://path.to/link.html "link title" class="attribute1 attribute2"

These attributes won’t show up in a typical Markdown preview but can influence the rendered output, and could be used for semantic purposes.

1 Like

I’d like to vote for a syntax like this:

[[optional link type(s)::LINKID|optional link title]]

Examples (for reasons of simplicity, w/o any link title/alias name after the LINKID):

[[supports::LINKID]]
[[refutes::LINKID]]
[[is confirmed by::LINKID]]

Double-colons as a delimiter for a link type prefix are already used by other tools (e.g. Semantic MediaWiki) so this would ease interoperability.

Also, this syntax travels with the link, and as such can be used inline. And it doesn’t spill outside of the main link delimiters ([[...]]), and would be rather straight forward to parse. In addition, it could also allow to set multiple link types, e.g.:

[[based on::confirms::LINKID]]

Finally, as discussed by @Emile for his Neo4j Graph View plugin, this could even support key/value properties, like:

[[has ingredient::quantity=50g::LINKID]]
6 Likes

The whole advantage of Markdown is that it is human and machine readable.
We can read and understand it easily in Preview mode and Edit mode.

The more complicated we make Markdown in Obsidian, the less readable it is in edit mode.

If we’re going to add link types in Obsidian, I think the answer lies in the YAML header and not in the notes because:

  1. That way we only see metadata when we’re trying to look at metadata
  2. Hides complicated syntax from novice users
  3. It just looks cleaner and easier to read.
5 Likes

I quite like the double-colon syntax. Another place that syntax is used is in Gitlab to distinguish between components in a label.

2 Likes

Fair points @DandyLyons

1 Like

Currently, Remnote had relationship name/connection name / edge label in graph view.

image

like this one in Neo4j.

Use case or problem

As you can see here the data model consists of Nodes and Relationships. And both nodes and relationships will have properties associated with them. And together all of them will make a data model which will give us the better visual understanding of a dataset.

Properties are information associated to nodes. For example, if Wikipedia were one of the nodes, it might be tied to properties such as website, reference material, or words that starts with the letter w, depending on which aspects of Wikipedia are germane to a given database.

Labeled-property graph
A labeled-property graph model is represented by a set of nodes, relationships, properties, and labels. Both nodes of data and their relationships are named and can store properties represented by key/value pairs. Nodes can be labelled to be grouped. The edges representing the relationships have two qualities: they always have a start node and an end node, and are directed;[10] making the graph a directed graph. Relationships can also have properties. This is useful in providing additional metadata and semantics to relationships of the nodes.Direct storage of relationships allows a constant-time traversal.

Hope Obsidian have a way to implement it.

7 Likes