Find the Right Files Before You Touch the Model

In a molecular design project, the visible structure is only part of the working document. File nodes may sit alongside other kinds of nodes, and searching by name alone can make it harder to focus on the files you actually need. The file attribute space in SAMSON’s Node Specification Language (NSL) offers a simple way to narrow a query to file nodes and then describe them by name or selection state.

The important first step is the prefix: fi. File attributes are defined in the file space, and expressions using it match only file nodes. That gives your query a clear scope before you add any other criteria.

Start with a name

To find a file node by name, use the short attribute name n followed by a quoted string. The reference gives these examples:

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

The first is an example using a short name string; the second shows a pattern-like value. If you are trying to locate a particular file among many, these expressions give you a practical starting point: keep the fi scope, then adjust the quoted name to the value you want to search for. The reference does not specify additional pattern-matching rules, so avoid assuming behavior such as case sensitivity or how every special character is interpreted.

Use selection state deliberately

File nodes also inherit the selected attribute from the general node space. You can express the two states with:

  • fi.selected
  • not fi.selected

This is useful when your immediate task is to focus on selected file nodes—or, conversely, to consider file nodes that are not selected. The file reference notes that selected has no short name in this space. In other words, use the full attribute name rather than trying to shorten it to s.

Know the selectionFlag spelling

A separate inherited attribute is selectionFlag, abbreviated sf. Its examples are fi.sf false and fi.sf. Both forms are useful to recognize when reading or writing NSL expressions: one states the false value explicitly, while the bare form is the documented example without an explicit value. The reference lists true and false as possible values.

selected and selectionFlag are listed as separate attributes, so keep their names distinct in an expression rather than treating them as alternate spellings. If you are unsure which one fits your task, check the relevant node-level definition before relying on its behavior; this file page points to those inherited definitions.

A small, reliable workflow

  1. Begin with fi so the query is limited to file nodes.
  2. Add a name condition such as fi.n "A" when you know the name to look for.
  3. Use fi.selected or not fi.selected when selection state is part of the task.
  4. Use fi.sf or fi.sf false only when the selection flag is the attribute you intend to check.

That small habit—establishing the node type before narrowing by attributes—can make file-related searches easier to read and less likely to mix file nodes with other parts of a molecular document. For the complete attribute table and inherited-attribute links, see the SAMSON file attributes reference.

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

Comments are closed.