Find the Right File Nodes Without Losing Track of Selection State

In a molecular modeling project, the hard part is not always finding a molecule—it can be keeping track of which file nodes you mean. A document may contain several files, and a name-based search can be easier to reason about than repeatedly inspecting the project tree. SAMSON’s Node Specification Language (NSL) provides a small set of file attributes that can help you describe those nodes.

Start with the file attribute space

File attributes live in the file attribute space, abbreviated fi. That scope matters: expressions using fi match file nodes, rather than every kind of node in the document. If your search is specifically about files, this gives you a clear starting point.

Use names to narrow your search

The inherited name attribute has the short name n. Its values are written as strings in quotes. The documentation gives these examples:

  • fi.n "A"
  • fi.n "L*"

These examples show how to express a name-based condition. When building your own expression, keep the string in quotation marks and use the name you see in your document. If you use a pattern such as "L*", check the results in your SAMSON setup rather than assuming what the pattern matches; the file-attribute reference lists the example, but does not define wildcard behavior on this page.

This approach is useful when a project contains multiple file nodes and you need to focus on one by its name. It also makes the criterion visible: instead of relying only on memory or a manual search, you can see the attribute and value that describe the target.

Check selection state explicitly

File nodes inherit the selected attribute, but this attribute does not have the short name s in the file attribute space. The documented forms are fi.selected and not fi.selected. The first expresses a condition on selected file nodes; the second expresses the opposite condition.

That distinction can help when you are reviewing a document and want to reason about selection state directly. For example, if the intended file is not currently selected, not fi.selected describes that state without depending on a name. Conversely, when you need to consider selected file nodes, use fi.selected.

Use selection flags when that is the property you mean

The selectionFlag attribute is also inherited from the node attribute space. Its short name is sf, and the reference shows both fi.sf and fi.sf false. It accepts true and false.

selected and selectionFlag are listed as separate attributes, so do not treat their names as interchangeable. Choose the one that matches the state you want to describe, and use the examples in the reference as a syntax guide.

A simple troubleshooting routine

  1. Confirm that the target is a file node; the fi space is for file nodes only.
  2. Try a name condition using fi.n and a quoted string.
  3. If selection matters, test fi.selected or not fi.selected separately.
  4. If you mean the selection flag specifically, use fi.sf or provide true or false.

Checking one condition at a time makes it easier to spot whether the issue is the target node, its name, or its selection state. The file attribute space is intentionally focused: it provides a compact way to describe file nodes using inherited node properties.

For the complete attribute reference and additional context, see the SAMSON file attributes documentation.

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

Comments are closed.