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:
 File paths
 URLs
 XPath
 JSON paths
 Apache ZooKeeper Paths
 Swift Paths (Server/Container/Psuedofolder/Object)
 Globs
The defintion whch follows provides all the the expected functionality on paths
Definition Path Schema:
 a set of absolute paths
 a set of relative paths
 and are disjoint
 a monoid
 is the called
pathjoin
operation  faithfully acts on and also on from the right
 we denote the identity (For filesysystem/URL paths this is
.
)
 is the called
 an operator, called the
parentdir
operation In filesystem/URL paths this is often similar to applying the Relative path
..
, but with some exceptions. For example
parentdir(.)=.
./..
(See below).
 For example
 In filesystem/URL paths this is often similar to applying the Relative path
 an operator, called the
basename
operation 
 That is to say,
pathjoin(parentdir(x), basename(x)) == x
 That is to say,

 and we call such elements roots
 – a root
 is the only root in
 There exist at least one root in
 In unix filesystems, this is
/
 In windows, this is each drive name
C:
,D:
etc, and a global//
for names pipes and UNC paths  For URLs this is the domain name.
 In unix filesystems, this is
 The monoid is generated by the set .
 We will call this set of generators , or the minimal relative path components.
Derived Operations:
From this we can define additional operations:
 that finds the root of the path.
 for which we know exists for some
 As we know from above the root of an elememnt of is an element of
 and the root of an elememnt of is
 : for mapping from a path, to a finite sequence of path from the path to the root
 is given by:
 if otherwise not defined.
 if then the final element is a root of , and all others in
 if then the final element is the root of (), and all elements are in
 for
 The series of of over the operation is equal to
 is given by:
Resolving a Path to the object
Finally we have an the operation that turns a absolute path () 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).
 Call this operation – to evaluate the path
 for a the set of indexed objects (filesystem, document etc)
 For , that is to say is a function.
 Depending on implementation, this may be 1 enitity, or many
 One might call Path schema with paths which always eval to one or zero entities MonoPath Schemas
 eg URL, POSIX / NT File System paths
 one might call Path schema with paths that can eval to any nymber of entities MultiPaths Schemas
 eg XPATH or Glob
 One might call Path schema with paths which always eval to one or zero entities MonoPath Schemas
 On the cardinality of
 for being the number of entities given by – the cardinality of the set

 or its (perhaps more interesting) contrapositive: