Select the group, not just the contents: a practical guide to node-group queries

When a molecular scene contains many objects, a selection can be confusing: did you match the node group itself, or something else in the scene? In SAMSON’s Node Specification Language (NSL), the nodeGroup attribute space gives you a way to express that distinction directly. It is useful when you want a query to target node group nodes rather than relying on a broad node-level query and hoping it describes the right objects.

Start by naming the target type

Use the ng short name to refer to the node-group attribute space. Its scope is specific: ng matches only node group nodes. That makes the prefix a helpful first check when writing or reviewing a query. If your intent is “find groups,” begin with ng, rather than assuming that a general node query has the same target.

For example, the documentation shows these name expressions:

  • ng.n "A"
  • ng.n "L*"

Here, n is the short name for name, and the name value is written in quotation marks. The second expression is an example provided by the reference; check the NSL name-matching rules if you need to know exactly how a particular pattern is interpreted.

Use the selection attribute you mean

Node groups inherit selection-related attributes from the general node attribute space. The reference lists both selected and selectionFlag. They are separate attribute names, so make the choice deliberately instead of treating them as interchangeable.

To query the selected state, the documented forms include ng.selected and not ng.selected. These are useful starting points when you want to distinguish groups that are selected from groups that are not selected. The attribute selected has no short name in the node-group space; in particular, do not assume that the node-level short name s is available for it here.

For selectionFlag, use the short name sf. The examples include ng.sf and ng.sf false. Keeping the attribute name visible in your query notes can make it easier for collaborators to understand which selection-related property you intended to test.

A quick query-writing checklist

  1. Confirm the object type. Use ng when the target is a node group.
  2. Choose the attribute. Use n for a name query, selected for the selected attribute, or sf for selectionFlag.
  3. Keep values in the documented form. Names are shown as quoted strings; Boolean values are true or false.
  4. Read the full expression before reusing it. A short prefix or attribute change can alter what a query targets, so retain the node-group prefix when adapting an example.

These small checks help prevent a common source of friction in scene organization: using a valid-looking expression that describes a different kind of node or a different selection attribute than intended. The node-group reference is a concise place to verify the available attributes and examples. Read the original node-group attributes documentation to learn more.

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

Comments are closed.