Labels can be easy to overlook in a busy molecular scene. Before recreating one or changing the wrong object, narrow your search to label nodes and check the attributes that describe their name, visibility, and selection state. SAMSON’s Node Specification Language (NSL) provides a compact way to express those checks.
The key is to be precise about which property you are asking about. “Find a label named A,” “find hidden labels,” and “find labels that are not visible” are different queries. Treating them as separate questions makes label searches easier to read and troubleshoot.
Start by targeting labels
Label attributes live in the label attribute space, whose short name is la. That space matches only label nodes. In practice, putting la at the start of an expression makes its scope clear: you are checking a label attribute, rather than asking about a similarly named property on another kind of node.
Search by name
The name attribute accepts strings in quotes. For example, the documented expressions la.n "A" and la.n "L*" show how to write a name-based label query. The short form of name is n, so la.n is equivalent to spelling out the attribute name in the label namespace.
When building a query, keep the string quoted. If the result is not what you expect, first verify that the expression targets la.n and that the name string is written as intended. The reference lists these expressions as examples; it does not define additional matching rules for the characters in a string.
Check hidden and visible separately
To look for labels whose hidden attribute is true, use la.h. To check for the opposite value, use not la.h. The long attribute name is hidden, and its short name is h.
There is also a visible attribute, abbreviated v. The expressions la.v and not la.v let you query labels by that attribute’s true or false value. This distinction is useful when diagnosing a label that does not appear as expected: check the hidden and visible attributes as separate properties instead of assuming they are interchangeable.
The reference also lists visibilityFlag, abbreviated vf, with examples la.vf false and la.vf. Because visibilityFlag and visible are separate attributes, keep their names distinct in a query. The page identifies both as inherited node attributes; it does not describe their underlying behavior, so avoid inferring more from the names alone.
Selection is another separate check
Labels inherit the selected attribute, which can be queried with la.selected or not la.selected. Unlike the node form, the label form has no short name s. Labels also have the inherited selectionFlag attribute, abbreviated sf; the documented examples are la.sf false and la.sf.
These are two different attributes. If your task is to find labels that are selected, query la.selected; if you specifically need the selection flag, use la.sf. Being explicit avoids a common source of confusion: similar-looking state names are not necessarily the same query.
A simple troubleshooting sequence
-
Target the label attribute space with the
laprefix. -
If you know the label’s name, check it with
la.n "A", replacing the example string with the name you want to search for. -
Check hidden state with
la.hornot la.h, then check visibility withla.vornot la.v. -
If selection matters, query
la.selectedseparately fromla.sf.
This sequence turns a vague “where did my label go?” moment into a set of specific checks. It also makes expressions easier for teammates to review: each one names the object type and the property being tested.
For the complete attribute list and inherited-property references, see the SAMSON label attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
