Advanced Queries: Creating a Resonance Calendar from queries

I’ve been switching things everything from Notion but still having trouble getting a few “list” type databases to work to emulate the functionality. A while back I stole an idea from Ali Abdaal on a Resonance Calendar. In Notion, this is a database where records are linked ti pages etc.
How I use Notion as a Resonance Calendar - YouTube for everything you read, blog posts, watch etc. You get the idea… The idea being a processing stack for helping you apply what you’re absorbing and incorporating it. it’s worked well.

In Logseq, I am trying to build a query to effectively grab everything with tagged res or with tags for movie, book, post, course, etc etc and then have it displayed in a tabular format with specific fields in the frontmatter (so for instance have I “processed” this entry) and then returned as a numbered list in reverse start date format.

So end goal arriving like this:

State Name Type Rating Start End Creator
1. :white_check_mark: DeFi Orientation #Course **** [[Aug 29th. 2021]] [[Aug 30th, 2021]] Nat Eliasson
2. :white_medium_square: Doom Patrol S01 #Series [[Aug 27th, 2021]] HBO
3. :white_medium_square: Molecular Biology of the Cell 5th Ed #Book [[Aug 26th, 2021]] Alberts et al
4. :white_check_mark: The Double Helix #Book *** [[Aug 18th, 2021]] [[Aug 25th, 2021]] James Watson
5.

Where of course the tags or #links in the page or frontmatter allow it to be derived (I’m also hoping to use this same technique to show subcategories like my books read etc.

Is there any way to currently pull this off in Logseq? I’ve tried a few different throws at this but not being a datomic expert nor clojure dev nor the internal structure of pages and tags etc in logseq had me mostly thrashing on this one.

thanks for any help on this or getting it a bit closer.

Also, if there is a way I should restructure my pages for note taking (which currently are sectioned and just use the hashtags – not tags: xxx – like yaml front matter at the start of the doc) to make this easier on myself, do let me know.

thanks!
Daryl.

3 Likes

Something like this would work:

query-properties:: [:page :type :title :rating :tags]
query-table:: true
#+BEGIN_QUERY
{:title [:h2 "Resonance list 4 - final version"]
:query [
:find (pull ?page [*])
:where
    [?page :page/properties ?props]

    [(get ?props :type) ?type]	
    [(contains? #{"movie" "article" "book"} ?type)]

    [?page :page/name ?name]
    (not [(missing? $ ?page :page/name)])

    (not [?page :block/tags [:block/name "terrible"]])

    (not 
        [?page :page/properties ?props]  
        [(get ?props :rating) ?rating] 
        [(contains? #{ #{"1/10"} #{"2/10"} } ?rating)]
    )			  
]}
#+END_QUERY

It would find all pages like:

<page title>
type:: movie / article / book
tags:: [[terrible]] - this would have the page ignored
tags:: [[cats]] [[dogs]] - this would show up
rating:: [[7/10]] - notice the [[ and ]] !!!! 1s and 2s are ignored
# Here starts the actual page/description
4 Likes

Wow… this is amazing? How did you figure this out? Thank you!!

I am going to try this out with 0.37 tonight and see how it goes. Will report back since it seems not to be picking up properties listed as type::. Once you see it done it makes much more sense (I had never seen the

query-properties:: [:page :type :title :rating :tags]
query-table:: true

thing before.

Daryl

This pretty works great, actually. Thank you so much for answering the question. Now I am just trying to add in the start and end dates for things (not hard) but then trying to figure out how to make it sort by the Start date (in the tables, if you try the sort if just goes alphabetically, not date aware).

Also, one final tweak: Can you think of anyway to make it also list out the tale as a numbered list? So, in other words, it would prepend a column with the number of the item that it is listing? (my clojure-fu is weak), but that would be amazing.

This also helped me puzzle out another equally tricky thing I was trying to get to work for my little PRM/CRM system.

thanks ever so much!
Daryl