Can Logseq do relations like in Notion?

Can Logseq do block and page relations like page relations in Notion?

The reason I’m asking for this is because when I want to say that block A is related to block B, I have to copy and paste the block reference of block A to block B. Now that’s fine, but the problem is that it’s one-way:


or

Ideally:

I tried “relation:: (block ID), (block ID), (page ID)” and it can somewhat work with one block. When I make a query, I have to search the block ID, which can still work though it’s a bit of a hassle. The real problem is that I realized Logseq can’t have multiple values in one property?

pictures:

So do you know a way to make this work?

edit: I found a way but it’s redundant

https://www.reddit.com/r/logseq/comments/1e9co3f/comment/ledm5rr/

u/tempnew from Reddit suggested to me this solution, but two blocks as values of a property is treated as one value


Welcome. It is not clear to me what you are trying to achieve. Logseq supports bidirectional links, with or without properties. What do you mean “one-way”? What would you expect to see? How do you plan to use it? Could you share a real-life example?

Basically I want to say that a block is related to another block. I don’t want to embed one block under another block or put the block reference inside the other block because what happens is the way it shows its bidirectional relatedness is “one-way” (the first two images of my post).

The way it ends up meaning to me is that the block is inside or under the other block. I want it to mean to me that the block is just simply related to the other block, that they’re equal in level (the third image of my post).

I want them to look the same (the last image in my post, I actually might just do it this way it’s just a bit redundant because of the linked references).

I’m actually almost satisfied except for this one thing:

  • Block A
    relation:: ((block ID)), ((block ID))

The “((block ID)), ((block ID))” above is treated as one value (the images in my first reply to my post). Is there a way to make each block ID one value? Like how, “relation:: [[Page]], [[Page]]” works?

Thanks!

Consider using an advanced query like this one:

#+BEGIN_QUERY
{:query [:find (pull ?b [*])
   :in $ ?uuid
   :where
     [?b :block/properties-text-values ?props]
     [(get ?props :relation) ?rels]
     [(clojure.string/includes? ?rels ?uuid)]
 ]
 :inputs ["669.....-....-....-....-............"]
}
#+END_QUERY
  • Replace the dots with the actual block uuid.
  • As more relations are added, its performance will drop, unless more filters get applied.
1 Like

Wouldn’t you want that relationship to be defined in natural language using a 3rd block?
Something like this perhaps:


At least to me it sounds like you’re trying to define something between two blocks and not necessarily something in one block or the other.

6 Likes

This is a great alternative. Thank you