Knowledge graph queries

putting some data to query in example relationships

this query below is not working in published logseq, so here’s a photo of how it looks in my local version of logseq

Query contents:

#+BEGIN_QUERY
{
:title [:h2 "informs ->"]
:query [
    :find (pull ?p [*])
    :in $ ?current-page ?relationship-page-name
    :where
        ;; find all blocks that mention this page
        (page-ref ?referring-blocks ?current-page)
        
        ;; filter for `[[relationship]] ->` child blocks
        [?child :block/parent ?referring-blocks]
        (block-content ?child "->")
        (page-ref ?child ?relationship-page-name)
        
        ;; find pages referenced
        [?b :block/parent ?child]
        [?b :block/refs ?p]
]
:inputs [:current-page, "relationship/informs"]
}
#+END_QUERY

query-table:: false
#+BEGIN_QUERY
{
:title [:h2 “informs ->”]
:query [
:find (pull ?p [*])
:in $ ?current-page ?relationship-page-name
:where
;; find all blocks that mention this page
(page-ref ?referring-blocks ?current-page)

    ;; filter for `[[relationship]] ->` child blocks
    [?child :block/parent ?referring-blocks]
    (block-content ?child "->")
    (page-ref ?child ?relationship-page-name)
    
    ;; find pages referenced
    [?b :block/parent ?child]
    [?b :block/refs ?p]

]
:inputs [:current-page, “relationship/informs”]
}
#+END_QUERY