A clearer view: using NSL to find presentation nodes

Molecular scenes can become difficult to inspect when many presentation nodes are involved. A useful first step is to describe the display-related nodes you want to find, rather than relying on names or visual inspection alone. SAMSON’s Node Specification Language (NSL) provides a small set of presentation attributes for doing this.

This guide focuses on the practical question: Which presentation nodes should my expression match? The attributes documented here can help you check names, visibility-related values, and selection-related values. They are defined in the presentation attribute space, whose short name is pr. Expressions using this space match only presentation nodes.

Start with the kind of information you need

If you are looking for a presentation node by name, use name (short name n). The documented examples are:

  • pr.n "A"
  • pr.n "L*"

Names are written as strings in quotes. The second example shows a name expression containing an asterisk, but this reference page does not explain the matching rules for that character. If the exact behavior matters for your workflow, check the broader NSL documentation before depending on it.

To check whether a presentation node is selected, the page gives pr.selected and not pr.selected. The selected attribute is inherited from the node attribute space, and unlike the node version it has no short name in the presentation space. Using the full attribute name makes the expression explicit.

Keep visibility attributes distinct

The reference lists three visibility-related attributes: hidden, visibilityFlag, and visible. Their examples include:

  • pr.h and not pr.h for hidden
  • pr.vf and pr.vf false for visibilityFlag
  • pr.v and not pr.v for visible

These names are similar, but the documentation lists them as separate attributes. Avoid treating them as interchangeable based on their wording alone. In particular, this page identifies each as inherited from the node attribute space, but does not explain the detailed relationship among their values. When you need a specific interpretation, consult the corresponding node attribute definitions.

Use short names when they help

Several attributes have shorter forms: hidden can be written as h, name as n, selectionFlag as sf, visibilityFlag as vf, and visible as v. For example, pr.sf false checks the selection flag with an explicit false value, while pr.sf is the documented shorthand example without a value.

Short forms make expressions compact, but full names can be easier to read when you revisit a query later or share it with a colleague. A practical habit is to begin with the full attribute name while drafting, then shorten it only if compact expressions are useful to you.

A quick checklist before using an expression

  • Use the pr prefix when you intend to match presentation nodes.
  • Put name strings in quotes, as in pr.n "A".
  • Use not in the documented negative examples, such as not pr.v.
  • Choose the exact attribute you mean: visible, hidden, and visibilityFlag are separately listed.
  • For inherited attributes, consult the node reference if you need their detailed definitions.

This makes presentation attributes useful as a focused vocabulary for describing the nodes you want to inspect, without assuming that similarly named properties mean the same thing. For the complete attribute list and links to each inherited definition, see the Presentation attributes reference.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.