Find the note that’s hiding in plain sight: filtering notes with NSL

When a molecular scene contains many annotations, the challenge is not always adding another note—it’s finding the right one. A note may be hidden, have an unexpected name, or differ in its selection or visibility state. Node Specification Language (NSL) provides a compact way to describe which note nodes you want to match, so you can inspect them without relying only on a visual search.

This guide focuses on the note attribute space, whose short name is nt. It matches only note nodes. That boundary is useful: an expression beginning with nt is specifically about notes, rather than every kind of node in the scene.

Start with the state you want to inspect

If you’re trying to locate notes that are not currently visible, the documented expression is not nt.v. To match visible notes, use nt.v. These short expressions can help turn a vague visual task—“Which notes are currently visible?”—into a clear query.

The same pattern applies to the inherited hidden attribute: nt.h matches notes with the hidden attribute set to true, while not nt.h matches notes for which it is false. Visibility and hidden are separate attributes in the reference, so choose the one that corresponds to the question you are asking rather than assuming they are interchangeable.

Use names to narrow the search

When you know a note’s name, the name attribute can help narrow your matches. For example, nt.n "A" is a documented expression using the short name n. The reference also gives nt.n "L*" as an example. Quotation marks matter: NSL expects strings in quotes for this attribute.

A practical approach is to begin with a simple state query, then add a name condition when you need to focus on a particular note or naming pattern. This keeps the expression readable and makes it easier to see what you are asking NSL to match.

Don’t confuse selection with selection flags

Notes inherit both selected and selectionFlag. The reference lists examples for each: nt.selected and not nt.selected for selected state, and nt.sf or nt.sf false for the selection flag. One detail that can save a moment of trial and error: selected has no short name in the note attribute space. Use the full form, nt.selected.

Likewise, visibilityFlag has the short name vf, and its examples are nt.vf and nt.vf false. The reference distinguishes this flag from the visible attribute, abbreviated v. If an expression is not matching what you expect, check which attribute you intended to query and whether you used its correct short name.

A small checklist for note searches

  • Use the nt prefix when your target is a note node.
  • Use nt.n with a quoted string when narrowing by name.
  • Use nt.v or not nt.v to express a visible-state query.
  • Use nt.selected for selected state; it does not have a note-space short name.
  • Keep hidden, visible, selectionFlag, and visibilityFlag distinct when writing a query.

These expressions are small, but they make note-focused searches more deliberate: describe the node type first, then the property that matters. For the complete attribute reference and inheritance details, see the SAMSON note attributes documentation.

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

Comments are closed.