Can LogSeq glossaries and abbreviation directories

Hello

I need to maintain several glossaries (e.g. drinking water, wastewater, sewage treatment plants, …) and abbreviation directories (e.g. wastewater, sewage treatment plants, wastewater treatment, …). For historical reasons, the glossaries and lists of abbreviations are stored in individual Word tables. Due to the similar subject matter, the entries in the various tables overlap considerably. If a change is required, changes have to be made in many/almost all tables. I would like to simplify my work and create a single list/table from the various tables, from which I can create the glossaries and abbreviation directories. I would like to use LogSeq for this, but I don’t know how. Please give me some tips.

I could imagine creating a LogSeq page for each entry. These could look like this, for example:

Example 1: number 1

tags:: waste water, sewage treatment plants

- Abbreviation:** Nu01
- **Name:** Number 01
- Description:**
	- here is a long Text
	- an there Text

Example 2: number 2

tags:: drinking water, waste water

- Abbreviation:** Nu02
- **Name:** Number 02
- Description:**
	- here is a long Text
	- an there Text

Example 3: number 3

tags:: drinking water, waste water, sewage treatment plants

- Abbreviation:** Nu03
- **Name:** Number 03
- Description:**
	- here is a long Text
	- an there Text

List of abbreviations Drinking water:

abbr. designation
nr2 number 2
nr3 number 3

List of abbreviations Waste water:

abbr. designation
nr1 number 1
nr2 number 2
nr3 number 3

List of abbreviations for sewage treatment plants:

abbr. designation
nr1 number 1
nr3 number 3

Glossaries Drinking water:

abbr. designation description
nr2 number 2 number 2
nr3 number 3 number 3

Glossary Waste water:

abbr. designation description
nr1 number 1 number 1
nr2 number 2 number 2

Glossary Wastewater treatment plants:

abbr. Name Description
nr1 number 1 number 1
nr3 number 3 number 3

Although I am not 100% sure about the detailed representation.

  • Your case sounds fitting for Logseq.
    • For sure better than plain tables.
  • Your analysis so far looks like a good beginning.
    • Don’t think of the representation as a single thing.
      • Such systems typically utilize multiple representations at the same time.
        • But without repetitions in the underlying data.
    • Don’t expect to get it right on first effort.
      • Initially move to Logseq only a few entries (but as representative as possible) and experiment with both the structure and the queries.
        • If you want the results in tables, consider moving the source information into properties (one per column).

@mentaloid thanks for the quick reply
I am not committed to the presentation in a table. This was just the previous, familiar representation.
When editing, tables are much bulkier than normal/plain text. I could also imagine a different display. But I have no idea what this could look like.
Please explain the statement “source information into properties (one per column)” in more detail. Unfortunately, I do not understand the statement.

Addendum on the use of tables:
So far, I have tried to write the tags that I wrote to the pages in the example above to the individual rows of a table.
Either I made a mistake with the syntax or it doesn’t work.

  • Hovering on a reference in the table (currently for 1 second), the respective page pops-up for normal editing.
  • Could also Shift + click a reference to open it in the right sidebar.
    • Although it is more meaningful to:
      • have the table itself in the right sidebar
      • then plain click the reference

If you want a table with columns abbr | designation | description , when entering the entries should use properties abbr:: , designation:: and description:: .

  • like you already do with built-in property tags::

If you expect detailed help, should provide a detailed description of your effort.

I don’t know if this will be accurate or useful - I’m just learning logseq. You might try using chatGPT or Google Bard by entering a prompt like “how do you use logseq glossaries?” I got answers from both but have not had time to study them.

Maybe a better prompt would be “case studies and examples of logseq glossary pages”

A lot would depend on how recently the AI service has been updated. And my prompt suggestion may not be that great - I’m an AI newbie and a logseq newbie.

thanks @ mentaloid for the help. I’ve been trying to get to grips with the properties for quite a while over the last few days. I also spent a long time on the Internet. But Logseq still overwhelms me as a beginner.

During my search I found this page:

I have created the following page based on this:

- languages
-
- ## [[Erlang]]
  type:: programming_lang
  creator:: [[Joe Armstrong]]
  description:: Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability.
-
- ## [[Clojure]]
  type:: programming_lang
  creator:: [[Rich Hickey]]
  description:: Clojure is a dialect of Lisp, and shares with Lisp the code-as-data philosophy and a powerful macro system.

The query found there:

- #+BEGIN_QUERY
  {:title [:h2 "Programming languages list"]
   :query [:find (pull ?b [*])
           :where
           [?b :block/properties ?p]
           [(get ?p "type") ?t]
           [(= "programming_lang" ?t)]]
   :view (fn [result]
           (when (seq result)
             (let [blocks (flatten result)]
               [:div.table-wrapper
                [:table.table-auto
                 [:thead
                  [:tr
                   [:th {:width "20%"} "Name"]
                   [:th {:width "20%"} "Creator"]
                   [:th {:width "60%"} "Description"]]]
                 [:tbody
                  (for [{:block/keys [title properties]} blocks]
                    [:tr
                     [:td (second (:url (second (first title))))]
                     [:td (get properties "creator")]
                     [:td (get properties "description")]])]]])))
   }
  #+END_QUERY

does not work either on the page with the information for the programming languages or on a separate page. I don’t know why.

Such phrases don’t provide any useful information. Should be specific on what happens. Anyway, you are trying to do a lot at once, also using very old code. If any step fails, the whole thing may fail. Should instead begin from something working, then gradually adjust it, checking on every step that it still works, until reaching the desired result.

  • Here is something that works to begin with:
    #+BEGIN_QUERY
    {:title [:h2 "Programming languages list"]
     :query [:find ?n ?c ?d
         :where
             [?b :block/properties ?p]
             [(get ?p :creator) ?c]
             [(get ?p :description) ?d]
             [(get ?p :type) ?t]
    
             [(= "programming_lang" ?t)]
    
             [?b :block/refs ?ref]
             [?ref :block/name ?n]
             [?ref :block/original-name ?o]
    
             (not [(contains? #{"type" "creator" "description"} ?n)])
             (not [(contains? ?c ?o)])
     ]
     :view (fn [result]
       [:div.table-wrapper
         [:table.table-auto
           [:thead
             [:tr
               [:th {:width "20%"} "Name"]
               [:th {:width "20%"} "Creator"]
               [:th {:width "60%"} "Description"]
             ]
           ]
           [:tbody
             (for [ [name creator description] (partition 3 result) ]
               [:tr
                 [:td [:a {:href (str "#/page/" name   )} name   ] ]
                 [:td [:a {:href (str "#/page/" creator)} creator] ]
                 [:td description]
               ]
             )
           ]
         ]
       ]
     )
    }
    #+END_QUERY
    
  • This is the output:
  • Depending on the actual needs, this could get simplified. But given that this is the example, rather than your actual goal, I save any improvements for later.

Sorry mentaloid, for the inadequate description. The many possibilities of LogSeq overwhelm me in my search for a suitable solution for the list of abbreviations and the glossary.

Perhaps I should describe again what data I have and what my goal is.

I currently have about 15 different Word tables. They all come from the areas of drinking water, waste water and sewage treatment plants. For each of the (technical) areas there are one or more tables which form the list of abbreviations and which are the glossary. Unfortunately, the separation is not very stringent. All tables contain a (German) technical term. In addition to the technical term, depending on the use of the table as a list of abbreviations or glossary, further data such as the descriptions of the technical term, sometimes with pictures or sketches, the corresponding abbreviations and an English translation and sometimes the French translation are included. The tables also have a uniform structure. The content clearly overlaps. Much of it occurs several times.

I had the idea of creating a common table/database. The list of abbreviations and the glossary for each of the areas of drinking water, waste water and sewage treatment plants could then be derived from this table using tags.

The data table could look like this:

Abbr Name Description (possibly with image) English French Area
Nu01 Number 01 long text with image Nu01eng Nu01fr waste water, sewage treatment plants
Nu02 Number 02 long text with picture Nu02eng Nu02fr drinking water, waste wate
Nu03 Number 03 long text with picture Nu03eng Nu03fr drinking water, waste water, sewage treatment plants

I wanted to derive the following individual tables from this entire table

List of abbreviations Drinking water:

abbr. designation
nr2 number 2
nr3 number 3

List of abbreviations Waste water:

abbr. designation
nr1 number 1
nr2 number 2
nr3 number 3

List of abbreviations for sewage treatment plants:

abbr. designation
nr1 number 1
nr3 number 3

Glossaries Drinking water:

abbr. designation description English French
nr2 number 2 number 2 nr2eng nr2fr
nr3 number 3 number 3 nr3eng nr3fr

Glossary Waste water:

abbr. designation description English French
nr1 number 1 number 1 nr1eng nr1fr
nr2 number 2 number 2 nr2eng nr2fr

Glossary Wastewater treatment plants:

abbr. Name Description English French
nr1 number 1 number 1 nr1eng nr1fr
nr3 number 3 number 3 nr3eng nr3fr

I found editing tables time-consuming. Your suggestion for using Properties seemed very good to me.

I haven’t used Properties yet. My experience with queries is also very limited. So I searched the internet and experimented with the results of the search in LogSeq. This led to my immature question. As I said, sorry.

I still have to try and test a lot to be able to ask better questions in the future.

My attempts with Microsoft Copilot were not very successful with regard to LogSeq. Microsoft Copilot always referred me to the classic menu bar. I have never seen this in any version of LogSeq.

Perhaps other language models are better.

If you provide your data with properties like this:

…then you can get results like these:



…by using queries like these:

#+BEGIN_QUERY
{:title [:h2 "All data"]
 :query [:find ?abbr ?name ?descr ?eng ?fr ?area
  :keys abbr name descr eng fr area
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     (or
       [(get ?p :eng) ?eng]
       (and
         (not [(get ?p :eng) ?eng])
         [(str "-") ?eng]
       )
     )
     (or
       [(get ?p :fr) ?fr]
       (and
         (not [(get ?p :fr) ?fr])
         [(str "-") ?fr]
       )
     )
     [(get ?p :descr) ?descr]
     [(get ?p :area) ?area]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th {:width "12%"} [:strong [:font {:size "4"} "Abbr"]]]
           [:th {:width "12%"} [:strong [:font {:size "4"} "Name"]]]
           [:th [:strong [:font {:size "4"} "Description"]]]
           [:th {:width "12%"} [:strong [:font {:size "4"} "English"]]]
           [:th {:width "12%"} [:strong [:font {:size "4"} "French"]]]
           [:th {:width "20%"} [:strong [:font {:size "4"} "Area"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
             [:td (get res :descr)]
             [:td (get res :eng)]
             [:td (get res :fr)]
             [:td (get res :area)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Abbreviations Drinking water"]
 :query [:find ?abbr ?name
   :keys abbr name
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "drinking water")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong [:font {:size "4"} "Abbr."]]]
           [:th [:strong [:font {:size "4"} "Designation"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Abbreviations Waste water"]
 :query [:find ?abbr ?name
   :keys abbr name
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "waste water")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong [:font {:size "4"} "Abbr."]]]
           [:th [:strong [:font {:size "4"} "Designation"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Abbreviations sewage treatment plants"]
 :query [:find ?abbr ?name
   :keys abbr name
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "sewage treatment plants")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong [:font {:size "4"} "Abbr."]]]
           [:th [:strong [:font {:size "4"} "Designation"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Glossary Drinking water"]
 :query [:find ?abbr ?name ?descr ?eng ?fr
   :keys abbr name descr eng fr
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     (or
       [(get ?p :eng) ?eng]
       (and
         (not [(get ?p :eng) ?eng])
         [(str "-") ?eng]
       )
     )
     (or
       [(get ?p :fr) ?fr]
       (and
         (not [(get ?p :fr) ?fr])
         [(str "-") ?fr]
       )
     )
     [(get ?p :descr) ?descr]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "drinking water")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong {:width "12%"} [:font {:size "4"} "Abbr."]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "Designation"]]]
           [:th [:strong [:font {:size "4"} "Description"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "English"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "French"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
             [:td (get res :descr)]
             [:td (get res :eng)]
             [:td (get res :fr)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Glossary Waste water"]
 :query [:find ?abbr ?name ?descr ?eng ?fr
   :keys abbr name descr eng fr
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     (or
       [(get ?p :eng) ?eng]
       (and
         (not [(get ?p :eng) ?eng])
         [(str "-") ?eng]
       )
     )
     (or
       [(get ?p :fr) ?fr]
       (and
         (not [(get ?p :fr) ?fr])
         [(str "-") ?fr]
       )
     )
     [(get ?p :descr) ?descr]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "waste water")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong {:width "12%"} [:font {:size "4"} "Abbr."]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "Designation"]]]
           [:th [:strong [:font {:size "4"} "Description"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "English"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "French"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
             [:td (get res :descr)]
             [:td (get res :eng)]
             [:td (get res :fr)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY

#+BEGIN_QUERY
{:title [:h2 "Glossary Wastewater treatment plants"]
 :query [:find ?abbr ?name ?descr ?eng ?fr
   :keys abbr name descr eng fr
   :where
     [?b :block/properties ?p]
     [(get ?p :abbr) ?abbr]
     [(get ?p :name) ?name]
     (or
       [(get ?p :eng) ?eng]
       (and
         (not [(get ?p :eng) ?eng])
         [(str "-") ?eng]
       )
     )
     (or
       [(get ?p :fr) ?fr]
       (and
         (not [(get ?p :fr) ?fr])
         [(str "-") ?fr]
       )
     )
     [(get ?p :descr) ?descr]
     [(get ?p :area) ?area]
     [(clojure.string/includes? ?area "sewage treatment plants")]
 ]
 :result-transform (fn [result] (sort-by (fn [res] (get res :abbr)) result))
 :view (fn [result]
   [:div.table-wrapper
     [:table.table-auto
       [:thead
         [:tr
           [:th [:strong {:width "12%"} [:font {:size "4"} "Abbr."]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "Designation"]]]
           [:th [:strong [:font {:size "4"} "Description"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "English"]]]
           [:th [:strong {:width "12%"} [:font {:size "4"} "French"]]]
         ]
       ]
       [:tbody
         (for [res result]
           [:tr
             [:td (get res :abbr)]
             [:td (get res :name)]
             [:td (get res :descr)]
             [:td (get res :eng)]
             [:td (get res :fr)]
           ]
         )
       ]
     ]
   ]
 )
}
#+END_QUERY