Boomla filesystem query language

In Boomla, files are selected. You can select one ore more files. This is in contrast with a traditional OS, where files are opened. In Boomla, you don’t need to open and close files, you just work with them. (The same way you don’t need to open a <div> in the DOM, you just select it.)

Selecting one or more files

To select a single file, use its path.

Examples:

  • //example.com/foo/bar
  • /foo/bar
  • foo/bar
  • ..

To find multiple files, you can use a path with wildcards. You can also throw in some selectors and filters.

Selectors perform a certain function on the context collection. Take, for example, */first(). * is a filter for returning all the children of a given file. first() is a selector to keep only the first of those.

Filters are used to select 0 or more children of a file.

Note that only a single selector may be present between slashes (/), but you can use multiple filters.

Examples:

  • Selectors: */first()
  • Filters: foo/*:c:1/bar

Filters

Name filter name

Select a file by its name.

Examples: name, a/b/c.

Wildcard filter *

Select a file by pattern matching its name.

Examples: ali*, a/*, a/*/*.

Page filter :p

Only match files that are pages. A file is a page its type chain contains a file named .Page.

Examples: :p, a/:p, a/:p/:p

Content filter :c

Only match files that are contents. A file is a content if it implements the .Inline interface, that is, an .Inline file exists on its type chain.

Examples: :c, a/:c, a/:c/:c

Bucket filter :1

Select all files in a given bucket.

Examples: /:1, */:1, foo/*:1.

Selectors

Website root file selector //example.com

Select the root file of any website. Must be at the beginning of a query string. Note that access control may prevent you from selecting remote websites.

Examples: //example.com, //example.com/, //example.com/foo.

Root file selector /

Select the root file of the context filesystem. Must be at the beginning of a query string.

Note that for imported filesystems, this means the root file of the imported filesystem, not the outer one.

Examples: /, /a.

Parent selector ..

Select a file’s parent at parse time.

Note that the .. parent selector is resolved before the query is evaluated, while the parent() selector is resolved at evaluation time. Thus, parent()/.. is not equivalent to ../parent().

foo/parent()/.. is simplified to foo before it is evaluated.
foo/../parent() is simplified to parent() before it is evaluated.

Examples: .., ../../a.

File type selector type()

Follow the file’s type reference.

Examples: type(), a/type()/b.

File typeChain selector typeChain()

Return all the files along the file’s type chain, including self.

Examples: typeChain(), a/typeChain()/b.

Root selector root()

Selects the root file of the context. Note that for imported filesystems, this means the root file of the imported filesystem, not the outer one.

Example: root(), typeChain()/last()/root().

Let’s dig into typeChain()/last()/root():

  • For a given file, typeChain() returns a collection of all files we encounter when following the file’s type chain.
  • last() returns the last file of the collection, typically, an application contained in a package that was installed (imported).
  • root() will return the root file of that imported package, for example /sys/packages/example.com.
  • You should be able to visit this file in your browser, as it normally contains the package documentation.

The latter example will return the root file of the imported filesystem

Parent selector parent()

Select a file’s parent at evaluation time.

Note that the parent() selector is resolved at evaluation time, not at parse time. Thus, parent()/.. is not equivalent to ../parent().

foo/parent()/.. is simplified to foo before it is evaluated.
foo/../parent() is simplified to parent() before it is evaluated.

Examples: parent(), type()/parent().

First selector first()

Returns the first file from the collection. May also be called on a file.

Examples: first(), */first().

Last selector last()

Returns the last file from the collection. May also be called on a file

Examples: last(), */last().