Different ways to structure data

Yes definitely! There is a :block/marker attribute. We can say it has to have a value of “TODO”.
Here’s a complete query to try. It includes a recursive search and assumes the query is on the same page as the index. Though we can change inputs to any lower-case page name.

#+BEGIN_QUERY
{:title "Index query"
 :query [:find (pull ?b [*])
  :in $ ?page %
  :where
     [?h :block/name ?page]
     [?i :block/content "Index"]
     (get-children ?i ?child)
     [?child :block/marker "TODO"]
     [?child :block/refs ?p]
     (not [?p :block/name "todo"]) ;TODO is also a page reference
     [?b :block/refs ?p]
     [(!= ?b ?child)] ;it's not the index itself
 ]
 :rules [
   [(get-children ?i ?child)
     [?child :block/parent ?i]
   ]
   [(get-children ?i ?child)
     [?b :block/parent ?i]
     (get-children ?b ?child)
   ]
 ]
 :inputs [:query-page]
}
#+END_QUERY

8 Likes

@Siferiax

Truly amazing, this should be spread as widely as possible both for its usefulness and to showcase the power of Logseq. I hope @Ed_Nico will mention this in Logseq Times.

7 Likes

To circle back on this thread, I have been experimenting and testing other tools out there to see how they tackle this problem and I have found remnote to provide the best and most intuitive method for structuring knowledge in a graph. Remnote also supports offline graphs for privacy which is a great win.

With remnote, everything is based on indentation and nesting a block or a rem. A rem in remnote is essentially a page in Logseq. Now there are 2 unique characteristics of Rem’s that are distinctly different from Logseq.

  • First: When a rem gets added inside of another rem, the parent rem become a folder.
  • Second: Rem’s and their contents are rendered inline, so everything is one big giant outliner list. So there is no need to go into a page to see its contents (yes Logseq has embeds, but that’s a manual process and they are not very aesthetic).

Folders are automatically assigned to the left sidebar to make it easy for access:


(The items with arrows are folders, those without are rem pages)

As I had mentioned before, everything in Remnote is one big giant list. So if I go into my JavaScript folder I can see everything under that folder, including sub-folders, rem pages, the contents in those rem pages, etc.

Also there is a distinct different in how hashtags behave in Remnote vs Logseq: They are intended to group content like a hashtag should, which allows grouping rem’s, folder’s, and blocks by hashtags. The process of creating hashtags in Rem are also different from creating a page reference, which servers the purpose of distiguishing their differences. Where Logseq hashtags are the same as a page-reference, they are created in the same fashion with the addition of the “#” character, the only difference is their appearance. Functionality wise, they are the same as a page-reference.

As I mentioned before, Folders and Rems can contain their own hashtags to group content. So going back to my previous example of JavaScript and folders, I can add two hashtags for “Programming” and “OOP” to that folder as well as another folder I have for Python. Now when I go to my OOP hashtag page, I can see my data grouped by that hashtag, and the ability to expand those blocks to see all the content inside the folders, sub-folders, rem’s, blocks, etc…

This to me is exactly what I have been wanting to achieve with Logseq and solves my biggest challenge. This could be acomplished in Logseq by assigning blocks a type property, and assign them values to distinguish the block as a folder or page, but the challenge I have found is that overtime, and in these examples I have been showing, Logseq becomes slow and laggy as you build out these structures. Also, there’s not anything unique in the database, so there’s no special views like what you get with remnote, its just a dirty hack to give is a “visual” touch. Hopefully the dev’s see this and gain some inspiration from Remnote to make some improvements in Logseq.

2 Likes

Did this get picked up by the powers-that-be?

I experience this during my trial-use of Logseq, as well.

Yeah. Same.

I am considering this as well.

Some insights in my own journey on this topic:

I’ve opted to fully go bottom up with some tricks and considerations. I’m still exploring this in terms of adding new notes and organizing existing ones.
But maybe it gives some ideas.

2 Likes

You’re totally right! We’ll foget things as time goes by.
File structure is just a simple MUST feature. If Logseq doesn’t like it, disable it by default(so all files just stay in flat strucutre) and leave it to users who want it.

1 Like

Incredible discussion!
Very valuable to inexperienced users like me, so thanks to everyone who shared their knowledge.
I was struggling with this issue as well and simply thought I just don’t know how to use this tool properly, but now I know people with far more experience and knowledge than me are struggling as well.

3 Likes

2 posts were split to a new topic: Query based on MOC-Page

after all this long discussion, full of knowledge… I’d say… K.I.S.S.
Other advanced Logseq users, even capable of writing advanced queries, they have shown after years of using it, that the simpler the better.

1 Like