Relations / crosslink section between pages for people

I want to use Logseq to document meetings and other things with people. Therefore I link to people, where each person has a page. On said page I want also to include a section / block where connections of this person are listed / linked. The only relation is: person A knows person B, C,… so far so good. Now when I create the page for person B I need to enter the same information in that block of the page for person B: person B knows person A and more.
On the page of person B I do not want to enter in the same location, that person B knows person A, as I have to enter the same info twice. What is the best workflow for this?

This is easy with two people but multiple its difficult. if A knows B, C, D but B only A and D and D knows C and A
Is it possible to use a block on each persons page and under this list all related people pages. If another person page (B) has the current person (A) under its block, automatically add person B to persons A under the connections block. I’m also open if queries work somehow.
I don’t want to use the related links on the bottom, as there would events, meetings, etc. be located from links of other pages, and the connections/links to other people would get lost.

Welcome.

  • Simple acquaintance is considered a soft association.
    • Soft associations are typically indicated with tags in journal entries.
      • e.g. [[Person A]] talked to me about a [[meeting]] with [[Person B]] and [[Person C]]. #acquaintance
  • For a person’s acquaintances to be automatically:
    • listed in his/her page, could use a query
      • e.g. for a given person to find all other persons that participate in the same blocks with tag #acquaintance
    • added from other pages, scripting is needed
      • e.g. a custom macro could compare the results of a query like the above with the existing data in the page and add the missing ones

I don’t want to keep track of these soft associations on all other pages.
I create a page per person and on that person’s page I have a segment / block connections under which I manually link all persons they know.
Let’s say A knows B, I would put on page A: [[B]]. So I see that person A knows person B.
Currently I also have to add on page B: [[A]] under the section/block connections.
I know these appear under linked references on the bottom of the page but I want the connections under all under one block.
Is this possible?
Would I need a separate page to keep track of all pairs or people they know?

  • You don’t need a separate page. That mention was about the best workflow. There are:
    • good reasons to involve other pages, but sounds like you have a very specific workflow in mind
    • chances that you will reconsider down the road, but that’s it, Logseq will work anyway
  • As about how, the options are those mentioned:
    • Listing through a query.
      • That is you put the query in the block of your choice, and the list appears right there. This list:
        • will be independent from the linked references at the bottom
          • that will contain repetitions
        • will not mix with the manual links
        • could contain either:
          • all links (relevant to the current page’s person), thus:
            • supporting proper sorting
            • looking better if moving the manual links near the bottom, to keep all repetitions there
          • all links except those already present in the current page’s body, thus:
            • avoiding repetitions in the page’s body (still present in linked references)
            • making full sorting impossible, so better fitting short lists
    • Automatic addition through scripting, that:
      • avoids the above dilemma
      • prevents all repetitions
      • needs more work, as it essentially implements something beyond Logseq’s existing features

I’m struggling with queries, I cannot get it working :frowning:
Could you support me?

Everyone does.

We can try.

  • Just make sure to:
    • read at least the basics about queries
    • get yourself familiar with some other questions on queries, by searching here in the forum
    • share your current progress
      • preferably with some actual blocks that we can test ourselves
      • guesswork is not very motivating
  • As a bonus, be willing to help someone else when the time comes.
    • In other words, this is a community, not a support center.

I’ve set it up like this:

  • person pages [[A]] and [[B]]
  • connection page [[connection]]

on the connection page I type a block for each connection pair, e.g. [[A]] [[B]]

I’ve tried queries on page [[A]] like this:
{{query (any (linked (page “connections”) (not (page this())) ) )}} → no result
{{query (any (linked (page “connections”) (not (page [[A]])) ) )}} → no result
{{query (any (backlink (page “connections”) (regex (.[[[this]]].) )) (not (page this())) )}}
and advanced queries like:
#+BEGIN_QUERY
{:title “People connected to this person”
:query [:find (pull ?other-person-page [:block/title])
:in $ ?person-page
:where
[?connection-page :block/multi-ref-pages ?person-page]
[?connection-page :block/multi-ref-pages ?other-person-page]
[(not= ?person-page ?other-person-page)]]
:inputs [:current-page-id]}
#+END_QUERY

Either I get all results or none. I struggle with removing the link/reference to the own current page. On page [[A]] it should not display [[A]] [[B]] but only [[B]]. On page B it should only display [[A]]. I also have problems with using something like “currentpage” so I won’t need to adjust the query to each sites name.

  • Seems that most of the issues are about invalid syntax and non-existing fields:
    • :block/title doesn’t exist
    • :block/multi-ref-pages doesn’t exist
      • what exists is :block/refs
    • :current-page-id doesn’t exist
      • it would be nice if it existed
      • what exists is :current-page which uses a name instead of an id
    • not= ... doesn’t exist
      • what exists is (not ...)
  • Here are some good readings to check for:
  • And here is an improved version of your advanced query:
    #+BEGIN_QUERY
    {:title "People connected to this person"
     :query [:find (pull ?other-person-page [*])
     :in $ ?person-page-name
     :where
       [?connections-page :block/name "connections"] ; in page named connections
       [?connection :block/parent ?connections-page] ; find any of its blocks that
       [?person-page :block/name ?person-page-name]  ; the page of the current person
       [?connection :block/refs ?person-page]        ; is referred by
       [?connection :block/refs ?other-person-page]  ; and they also refer to another page (to be listed)
       (not [(= ?person-page ?other-person-page)])   ; different than the current one
     ]
     :inputs [:current-page]
    }
    #+END_QUERY
    

I’m coming back to that working query because I tried to adjust it to look through all pages (or at least all journal pages) instead of just looking through the page with the name “connections”.
Instead of
[?connections-page :block/name "connections"] I tried it with
[?connections-page :block/page ?page ] but the results are not correct and I cannot explain where they are coming from.

I’ve tried a workaround by making a query on the “connections” site which just lists all blocks, but it seems the query above is not able to look through results of other queries on the target pages.

:query [:find (pull ?b [*])
         :where 
[?b :block/page ?p]]

Is this query I’m looking for even possible?

Try replacing this line:

[?connections-page :block/name "connections"] ; in page named connections

…with either:

  • [?connections-page :block/journal-day] ; in any journal page
    
  • [?connections-page :block/name] ; in any named page
    
1 Like