Skip to content

Command reference

Jeffrey Benjamin Brown edited this page Jun 3, 2020 · 11 revisions

This page contains a nearly exhaustive description of commands supported in SmSn-mode. Some experimental or less frequently used commands are omitted.

Graph views

SmSn-mode presents a graph of atoms using tree-like partial views. A number of commands exist for changing the type and parameters of a view: forward or backward with respect to the direction of parent-child relationships, shallow or deep, and public or private.

Change height of view (C-c C-d [n])

This command consumes a number from 1 to 7 (or one of the digits [asdf], representing 1-4) and sets the maximum depth of the view; a depth of 1 includes only the children of the current root atom, whereas a depth of 2 also includes grandchildren, and so on.

To expand the following view to two levels:

+ my big list of things
+ my not-quite-so-big list of things

Type "C-c C-d 2":

+ my big list of things
  * thing 1
  * thing 2
+ my not-quite-so-big list of things
  * thing 3

Set minimum sharability (C-c C-s C-m [n])

Views may be restricted to various levels of @sharability according to a buffer-local minimum. For example, private (0.25) atoms will not be shown in a buffer with a minimum @sharability of 0.5 (personal). Use this command to redefine the minimum sharability, typing [0-4] or [zasdf] for 0.0 through 1.0 after the prompt.

Switch to forward view (C-c C-v f)

Views in SmSn-mode are "forward" by default: the children of an atom in the tree view are its children in the graph. This command switches back to the default view.

Switch to backward view (C-c C-v b)

A "backward" view shows an atom's parents beneath the atom in the tree view, grandparents beneath those, and so on. This command switches to a "backward" view from a forward view.

Switch to read-only view (C-c C-v r)

SmSn-mode view buffers are editable by default. This command allows you to protect a buffer by making it read-only.

Switch to read-write view (C-c C-v e)

This command allows you to make the current view buffer editable (the default setting).

Toggle properties visible (C-c C-v p)

Normally, atom properties are seen only as colors and fonts. This command makes editable properties explicit, appending annotations beneath each atom. For example:

+ Arthur Dent
    @sharability 1
    @weight      0.75
    @alias       http://dbpedia.org/resource/Arthur_Dent

These annotations can be modified and pushed back into the graph to update the atom's properties.

Toggle line wrap (C-c C-v ;)

A convenience function to soft-wrap long lines in views.

Minimize/maximize verbatim blocks (C-c C-v v)

Verbatim blocks are used in SmSn-mode for text spanning multiple lines. While you often want to see that text, it sometimes makes the surrounding atoms harder to find. When you minimize blocks like:

* {{{
This is
a verbatim
block
}}}

They appear like:

* {{{}}}

You may push view buffers with minimized verbatim blocks without losing their content.

Set value truncation length (C-c C-v t)

Long atom values are truncated by default in search views, which cuts down on the size of the buffer and helps make large search views more readable. This command lets you override the default setting. With a setting of 80, displayed values are limited to 80 characters, and terminated with a "[...]" string. With a setting of zero, values are not truncated.

History view (C-c h)

This command displays a list of the last atoms visited.

Navigation and search

These commands are used to retrieve atoms from the graph back-end, and to navigate from atom to atom.

Open tree view (C-c t)

This command creates a new tree view with the atom at point as root. This is the usual way to navigate from atom to atom. All parameters of the current view are applied to the new view.

Open page view (C-c w)

This command opens the document associated with the atom at point. The document can be edited in the buffer and pushed back to the graph with the same command (C-c p) you would use to push a tree view.

Prompt and open tree view (C-c o)

This command prompts for an atom id, then opens a tree view of that atom.

Update atom view (C-c u)

This command refreshes the current atom view from the graph back-end. Any changes made to the view buffer are discarded.

Visit alias in browser (C-c C-t C-a b)

The @alias property is commonly used to link an atom with a Web page. Use this command to visit the page associated with the atom in your system's default Web browser. For example, you can create an atom for the GNU home page using the @alias annotation:

* The GNU Operating System and the Free Software Movement (web page)
                @alias https://www.gnu.org/

After you push the view, you can visit the page by placing point on the atom and typing "C-c C-t C-a b". See also the SmSn Chrome plugin, which creates bookmarks for use in SmSn-mode.

Visit URL in browser (C-c C-t a)

If the value of an atom is a raw URL (as opposed to an atom with a URL as its @alias), this command lets you visit that URL in your system's default browser.

Visit URL at point (C-c C-b)

Provided that there is a URL at point, this command will open it in the system's default browser. The entire value of the atom at point need not be a URL.

Free-text search (C-c s)

One of the simplest way to find atoms is by searching on their values. Semantic Synchrony inherits Neo4j's Lucene query syntax, a reference of which can be found here. For example, to find atoms which mention Albert Einstein, type "Albert Einstein" at the prompt. To find people named Albert, type "Albert*". A list of search results, ordered by a combination of relevance and atom @weight, is provided in a new buffer.

Search on atom at point (C-c C-t s)

A convenience function which searches on the value of the atom at point. This is useful for identifying duplicate topics.

Acronym search (C-c a)

Atoms with name-like values are indexed not only on the complete value, but also on the first letters of each word. This command searches on these "acronyms" using Lucene syntax. For example, a search on "ae" will retrieve Albert Einstein. A search on "ae*" will retrieve Albert Einstein as well as the atom named "Albert Einstein's family".

Shortcut search (C-c x)

The @shortcut property is used to store user-defined shortcuts for atoms. These are typically set using the Ripple client, but may be set in SmSn-mode using an annotation, e.g.

* my slideshow on the Great Collapsing Hrung disaster
  @shortcut gch

This command allows you to search for the atom with a given shortcut.

Editing

Semantic Synchrony uses a lens system for editing graphs; its tree views may be edited as text in SmSn-mode's buffers, and are then mapped back to vertices and edges in the graph database. There are view-level and atom-level edit operations.

New view (C-c n)

Possibly the first command you will need. This command creates a new atom and opens an (empty) view of that atom. You can then add children to the atom. You should only need to use C-c n once per graph.

Push view (C-c p)

This command pushes the current atom view to the graph back-end. A difference is computed between the current state of the view and a corresponding view on the back-end, then the difference is applied, updating the graph to match the view. This is the usual way to edit a knowledge base through SmSn-mode.

Setting properties

The four properties which influence an atom's appearance (color, weight, and font style) in a SmSn-mode view are @weight, @sharability, @priority, @alias. All but the last of these can be set on the atom at point with the following shortcuts.

Set an atom's weight (C-c C-t C-w [n])

Atoms with higher @weight appear darker in views, and are ranked higher in search results. At the prompt, type [1-4] or [asdf] for a weight of 0.25 through 1.0. Atoms cannot have a weight of 0.0.

Set an atom's sharability (C-c C-t C-s [n])

Atoms are colored according to @sharability: red for private (0.25), amber for personal (0.5), green for public (0.75), and blue for universal (1.0). Atoms may be included or included in a view on the basis of their @sharability. At the prompt, type [1-4] or [asdf] for a weight of 0.25 through 1.0. Atoms cannot have a sharability of 0.0.

Set an atom's priority C-c C-t C-p [n])

Atoms with nonzero @priority are underlined in views, with a stronger underline for higher priority levels. At the prompt, type [0-4] or [zasdf] for a priority of 0.0 through 1.0. Choosing a priority of 0.0 removes the @priority attribute altogether, as 0.0 is the default.

Inserting properties

These commands insert a property annotation into the current buffer, after the line at point. When the resulting view is pushed, the atom on that line is updated accordingly. While this has the same effect as a set-property command, it gives you the option of copy-and-pasting the annotation to update many atoms at once.

Insert weight (C-c C-a C-w [n])

This command prompts for a weight value ([1-4] or [asdf] for 0.25 through 1.0) and appends a corresponding property annotation to set the weight of an atom.

For example, typing "C-c C-a C-w 3" results in an annotation like:

* my big list of things
    @weight 0.75

Insert source (C-c C-a C-s [n])

This command prompts for a source value, as determined by your smsn.yaml file, and appends a corresponding property annotation to set the sharability of an atom.

For example, if your smsn.yaml file reads, in relevant part:

sources:
  -
    location: ~/my-graph/vcs/private
    name: private
    code: a
    color: 0xcc0000
  -
    location: ~/my-graph/vcs/personal
    name: personal
    code: s
    color: 0xcccc00

then, typing "C-c C-a C-s a" adds an annotation like the second line of the following:

* my big list of things
    @source private

These @source properties determine where your graph will be saved; see the "Export VCS" command for details.

Insert priority (C-c C-a C-p [n])

This command prompts for a priority value ([0-4] or [zasdf] for 0.0 through 1.0) and appends a corresponding property annotation to set the priority of an atom.

For example, typing "C-c C-a C-s 2" results in an annotation like:

* my big list of things
    @priority 0.5

Graph I/O

Importing data

Semantic Synchrony data normally resides in a Neo4j graph database, and gradually changes over time as you interact with it through SmSn-mode. For bulk import of data, the following commands are provided.

Import VCS (C-c C-r c)

[Caveat! This is Jeff writing what he remembers from a couple years ago; it is untested.)

This reads a graph from a set of folders intended to be controlled via some VCS like Git or Subversion. Suppose your smsn.yaml file reads, in relevant part:

sources:
    location: ~/my-graph/vcs/observatorio
    name: personal
    code: e
    color: 0xcc00cc
  -
    location: ~/my-graph/vcs/universal
    name: public
    code: u
    color: 0x0000ff

In that case, when you run this command, it will read all nodes from the "public" folder and give them the property "public", and do similarly from the "universal" folder, giving them the property "universal".

Import GraphML (C-c C-r g)

This command will import to the current graph a knowledge previously exported in the GraphML format (see below). Normally, you will only import one GraphML file into a fresh graph.

Import Freeplane XML (C-c C-r f)

For those migrating to SmSn-mode from Freeplane, this command is your friend. You may specify a single file, or a directory of files to import. These are translated to the Semantic Synchrony data model and added to the current graph.

Exporting data

Several commands are available for exporting your knowledge base -- or slices of your knowledge base -- in various formats.

Export VCS (C-c C-w c)

This writes your graph to a set of folders intended to be controlled via some VCS like Git or Subversion. Suppose your smsn.yaml file reads, in relevant part:

sources:
    location: ~/my-graph/vcs/observatorio
    name: personal
    code: e
    color: 0xcc00cc
  -
    location: ~/my-graph/vcs/universal
    name: public
    code: u
    color: 0x0000ff

In that case, when you run this command, it will write all your vertices with a property source value of "public" to the public folder, and all your vertices with a property source value of "private" to the private folder. (The codes "e" and "u" are used to set the property; see the "insert source" command.

Export GraphML (C-c C-w g)

A Semantic Synchrony knowledge base is a TinkerPop-compatible property graph which can be exported in the GraphML format. This can be used as a way to save and back up your data, or import it into another application.

You can export either your entire graph or a more public slice of your graph by first setting the minimum @sharability of your buffer. You can tell which atoms will be exported based on the color of the file name prompt that will appear. For example, if the prompt is red, all atoms and their relationships will be exported. If the prompt is amber, private information (i.e. with a @sharability of 0.25 or less) will be excluded from the exported graph, and so on.

Export edges (C-c C-w e)

This command creates a tab-separated file listing all abstract edges in the knowledge base, where an edge is a parent-child relationship. This is an adjacency list in which sibling order is preserved.

Export vertices (C-c C-w v)

This command creates a tab-separated file listing all atom vertices in the graph, along with a selection of their properties and other metadata (@created, @__id, @weight, @sharability, classification and in/out scores, @value, and @alias`).

Export LaTeX (C-c C-w l)

A special feature for those in academia. Write your PhD thesis in SmSn-mode and export it in LaTeX! It has been done.

Global graph operations

These commands are used to manage the graph from the top down.

Find isolated atoms (C-c C-i f)

This command finds all atoms with no connections to other atoms, displaying them in a buffer.

Remove isolated atoms (C-c C-i r)

This command removes from the graph all atoms with no connections to other atoms, i.e. all atoms retrieved with "find isolated atoms" (C-c C-i f).

Find duplicate atoms (C-c d)

This command finds all atoms with identical values, and displays them in a buffer. For example, two distinct atoms with the value "John Doe" should be retrieved.

Find root atoms (C-c c-f)

This command finds all atoms with no parents. It may be used to discover components of the graph which are not well connected.

Miscellaneous commands

Insert current date (C-c C-a d)

This command inserts the current local date in a yyyy-MM-dd format, e.g.

2016-11-22

Insert time (C-c C-a t)

This command inserts the current local time in a hh:mm format, e.g.

10:35

Insert current time, with seconds (C-c C-a s)

This command inserts the current local time in a hh:mm:ss format, e.g.

10:35:23

Copy atom's value to clipboard (C-c v)

This command copies the value of an atom to the system clipboard (as opposed to the Emacs kill ring).

Copy atom reference to clipboard (C-c r)

This command will copy a reference for the atom at point to the system clipboard (e.g. "* :SBZFumn:"). This reference can be pasted into another view.

Copy root reference to clipboard (C-c .)

This command will copy a reference for the root of the current view to the system clipboard. See also C-c r.

Get atom info (C-c C-t i)

This command displays a selection of properties of the atom at point.

Kill other buffers (C-x C-k o)

Closes all Emacs buffers other than the current one.

Toggle move/edit submode (C-c m)

Enter or exit the move/edit submode, which provides efficient commands for line-by-line navigation and editing.

User-defined commands

Don't feel that you are limited to the commands on this page; by examining the SmSn-mode source code, you can define new commands which serve specific needs. These can be defined just as easily in your Emacs init file as in the source files themselves. The example init file contains a number of key bindings like this one, which searches Wikipedia based on the title of a note:

(define-key smsn-mode-map (kbd "C-c C-t C-b w")   (smsn-search-in-browser
  "Wikipedia" "http://en.wikipedia.org/w/index.php?title=Special%3ASearch&search="))

You can follow the same pattern to add your own bindings.

Clone this wiki locally