Find the Right Files Without Losing Track of Your Selection

In a molecular modeling project, it is easy to lose time looking for a particular file—or to apply a search to the wrong kind of object. SAMSON’s Node Specification Language (NSL) provides a focused way to describe file nodes using their names and selection-related attributes. The key is to start in the right attribute space: fi.

Limit the search to file nodes

The file attribute space matches only file nodes. That makes it a useful starting point when your goal is to work with files rather than other nodes in a document. In NSL, the full attribute-space name is file, and its short name is fi. The examples below use that short form.

Search by name

To specify a file name, use the name attribute, or its short name, n. Values are written as strings in quotes. For example:

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

These examples show the two forms together: the file-node prefix and a quoted name value. The documentation includes both name and n; using the short form keeps an expression compact, while the full attribute name may be easier to recognize when you are learning or revisiting a query.

When a search does not behave as expected, check the basics first: does the expression begin with fi, is the attribute spelled correctly, and is the name value enclosed in quotes? Those small checks can help distinguish a query-format issue from a problem locating the file in a project.

Check selection-related attributes

File nodes also inherit the selected and selectionFlag attributes from the node attribute space. You can test selected directly, or negate it:

  • fi.selected
  • not fi.selected

For file nodes, selected does not have the short name s. That is a useful detail to remember if you have seen a shortened form elsewhere: the file reference lists the full attribute name here.

For selectionFlag, the short name is sf. The reference shows both a value-specific expression and an expression without an explicit value:

  • fi.sf false
  • fi.sf

The possible values listed for both selection-related attributes are true and false. Keeping the two attributes distinct in your query is helpful: the reference treats selected and selectionFlag as separate names, even though both are inherited from the node attribute space.

A quick query checklist

  1. Use fi when you want to match file nodes.
  2. Use fi.n or fi.name for a name condition, with the value in quotes.
  3. Use fi.selected or not fi.selected to express the selected-state condition shown in the reference.
  4. Use fi.sf for the selectionFlag attribute, optionally specifying true or false.

This compact set of attributes can make file-focused searches easier to read and check—especially when a project contains many different kinds of nodes. For the full attribute reference, see the SAMSON file attributes documentation.

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

Comments are closed.