References in a property

I have a Project template that looks like this:

status::
tags:: 
progress:: 
timeframe:: 
links:: 
deadline:: 
area:: 
client::
people-involved::
archived:: false
type:: Project

The people-involved property would contain a list of people like this:

people-involved:: [[Person A]], [[Person B]], [[Person C]]

These people use a Person template that looks like this:

tags::  
links::
last_interaction::
position::
email::
phone::
phone_2::
LinkedIn::
Twitter::
website::
cover::
company::
worked_with_at::
reference::
archived:: false
type:: Person

In the above, Persons A, B, and C will have a Linked Reference to whatever we name the project page.

Is there a way to use an advanced query and say:

Get the values stored in people-involved on the current page and display those pages.

OR

Show every type:: Person that has a linked reference to the current page.

1 Like

I don’t understand the exact question:

  • Querying references in a property is generally done like this:
    [?b :block/properties ?props]
    [(get ?props :people-involved) ?names]
    [(contains? ?names ?name)]
    [?p :block/original-name ?name]
    
    • This acquires the pages ?p which are values of property people-involved::
  • Likewise, pages ?p of persons that reference ?current page are generally acquired like this:
    [?p :block/properties ?props]
    [(get ?props :type) ?type]
    [(= ?type "Person")]
    [?b :block/page ?p]
    [?b :block/refs ?current]
    
  • But what do you mean by “display those pages”?
    • list their names
      • They are already listed in the specific property.
        • And hovering on each name pops-up the respective page.
    • embed them
      • Maybe you want a macro that turns the names into embeddings?
    • other

I’m trying to make a generic query I can add to my template so whenever someone is added to people-involved, they’re added to a table.

Here’s an idea of how I’d want it to look:

  • Try this:
    #+BEGIN_QUERY
    {:title [:h3 "People Involved"]
     :inputs [:current-page]
     :query [:find (pull ?p [*])
       :in $ ?current-name
       :where
         [?current-page :block/name ?current-name]
         [?current-page :block/properties ?props]
         [(get ?props :people-involved) ?names]
         [?p :block/original-name ?name]
         [(contains? ?names ?name)]
     ]
    }
    #+END_QUERY
    
  • However, for this kind of relationship, instead of properties consider using natural phrases in the journal.
    • e.g. [[Person A]] #joined [[Some Project]]

Thank you!

I’m curious what advantage using [[Person A]] #joined [[Some Project]] over properties would be when using a query.

  • The query doesn’t care.
    • It can be made to filter either scenario.
  • The potential advantages are:
    • less dilemmas
      • e.g. no need to decide between people-involved and projects-involved
    • adding more info at once
      • e.g. [[Person A]] #joined [[Some Project]] for #testing [[Product B]]
    • documenting the event of someone joining
      • Maintaining the context at the time of joining.
        • e.g. what was the reasoning for joining
        • that helps tremendously human memory
      • Many people participate in a project, but some may be older than others.
      • Can answer whether a person was part of a project when something happened.
      • Can remove a person without losing the information of past participation.
        • Simply adding a later note like [[Person A]] #left [[Some Project]]
          • Of course that asks for smarter queries, but nothing crazy.
    • easier both to maintain and scale
      • Adding the above info in properties can make the templates both heavy and complicated.
    • working inside the journal
      • Both pages of the project and the person don’t need to be updated, not even visited.
        • No need for switching pages during adding notes.
      • Limited to 24 hours, journals are lighter to work with than other pages.
        • No fear of accidentally editing existing info.
2 Likes