An Algebraic Structure For Path Schema (Take 1)


Note I have written a much improved version of this. See the new post.

This post comes from a longish discussion with Fengyang Wang (@TotalVerb), on the JuliaLang Gitter. Its pretty cool stuff.

In general a path can be described as a a heirachical index. It is defined here independent of the object (filesystem, document etc) being indexed. The precise implementation of the algebric structure differs, depending on the Path types in question, eg Filesystem vs URL, vs XPATH.

This defintion is generally applicable to paths, such as:

The defintion whch follows provides all the the expected functionality on paths

Definition Path Schema:

Derived Operations:

From this we can define additional operations:

Resolving a Path to the object

Finally we have an the operation that turns a absolute path (\(x\in A\)) into a entity, or a set of entities. These operations are less clear, as at this level objects must be considered – the data store (the indexed set) must be accessed to resolve. And issues like synlinks, hardlinks etc start to matter (To use examples POSIX filepaths).