Filesystem Query Language

In Boomla, files are selected. This is in strong contrast with traditional operating systems, where files are opened. In Boomla, you don’t need to open and close files, you just work with them.

You can select one or more files.

 

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

  • Selector: */first()

  • Filters: foo/main:*/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 page is a file if it implements the .Page interface.

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.

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

 

Bucket filter main:

Select files in a given bucket.

Historically, the :1 form was used and bucket names were numbers. Later, we elevated buckets to first class objects and moved to using the main: form that allows using string bucket names.

Examples: /main:*, */main:*, foo/main:*.

Deprecated 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 selectors /, root()

Select the root file of the current filesystem scope. For package filesystems, this means the root file of the package filesystem, not that of the entire website.

The / selector is only treated as the root file selector if it is found at the beginning of a query string. The root() selector may appear anywhere in the query string.

Examples: /, /a, root(), typeChain()/last()/root().

If the file in context has a file type pointing to an app in an installed package, the last example return the root file of the package filesystem. Let’s break it down:

  • 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, often an application contained in a package that was installed.

  • root() will return the root file of that 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.

 

Parent selectors: .., parent()

Select a file’s parent.

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.

 

First selector first()

Returns the first file from the collection.

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

 

Last selector last()

Returns the last file from the collection.

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