[pmwiki-users] hierarchical groups, revisited

Joachim Durchholz jo at durchholz.org
Thu May 25 07:52:17 CDT 2006


Patrick R. Michaud schrieb:
> On Thu, May 25, 2006 at 12:32:38AM +0200, Joachim Durchholz wrote:
>> For links that use slashes, it's far simpler: [[Canine/StBernard]] would 
>> now be a relative link, while [[/Canine/StBernard]] would be an absolute 
>> one.
> 
> Jo's comments on hierarchical groups are very helpful. 
> 
> For (1) completeness in the discussion, (2) the possibility of being
> able to add more details to the HierarchicalGroups page, and (3) to
> preserve my sanity against people who might look at this and say 
> "what's the big deal here, I do want to point out that relative
> links are not "far simpler".

Um - I plead guilty of being imprecise. I meant "far simpler 
syntactically and 'optically'".

 > For example, [[Canine/StBernard]]
> may be a relative link, but the question becomes "relative to what?"

To the page where the link is written.
This should hold even if the page is included from some other group. If 
there's a page /Feline/Manx with a link to [[housecat]], and the page 
/Canine/StBernard (:include:)s ../Feline/Manx, then that [[housecat]] 
link should still refer to /Feline/housecat. (This is actually relevant 
for sidebars. Sometimes I want to make a "master sidebar" that 
(:include:)s sidebars from other groups. The problem is that the links 
in the group-specific sidebars are often relative, and will break when 
included from some other group. Bad.)
Reinterpreting relative links when the page is included or otherwise 
used in some other context is madness. Actually such reinterpretation 
can be useful in some circumstances, but in practice, in the vast 
majority of cases, this is not what's wanted (and almost never what's 
expected, particularly if it happens accidentally).

> Okay, let's start with the [[Canine/StBernard]] example.  Bear with
> me as I set up some background.
> 
> Let's suppose we have hierarchical groups, and that we're in the
> Animal.Canine.Beagle page.  Now then, in that page we have links
> that look like [[Terrier]] and [[Bulldog]].  It's pretty clear that 
> this should link to Terrier and Bulldog in the same group -- i.e., 
> to pages called Animal.Canine.Terrier and Animal.Canine.Bulldog.  
> No problem so far.
> 
> Now then, what about links like [[Terrier/Fox]] and 
> [[Bulldog/Australian]]?  Well, Terrier and Bulldog are in 
> the Animal.Canine group, so it seems like these ought to be 
> links to pages called Animal.Canine.Terrier.Fox and 
> Animal.Canine.Bulldog.Australian.  Still no problem.
> 
> But let's go back to the original example of a "relative link" --
> [[Canine/StBernard]].  In fact, let's just look at a link called
> [[Canine]] from within the Animal.Canine.Beagle page.  If 
> we _strictly_ follow the pattern above, then [[Canine]] within
> the Animal.Canine.Beagle page ought to link to Animal.Canine.Canine.

So the link is wrong. Borrowing from filesystem path syntax, the link to 
the parent category would have to be written as [[..]].

> And [[Canine/StBernard]] looks just like [[Terrier/Fox]] (which is 
> Fox within the Terrier subgroup of the current Animal.Canine group), 
> so that would indicate that [[Canine/StBernard]] is StBernard 
> within the Canine subgroup of the current group, or
> Animal.Canine.Canine.StBernard.  Oops.

Again, the link is wrong. It's using the relative link 
[[Canine/StBernard]] where an absolute link such as 
[[/Canine/StBernard]] was actually meant.

> In other words, we have these pages:
> 
>     Animal
>     Animal.Canine
>     Animal.Canine.Terrier
>     Animal.Canine.Bulldog
> 
> Okay, follow carefully:
>    Q: What's the "home page" for canines?  
>    A: Animal.Canine
> 
>    Q: What group is Animal.Canine in?
>    A: Animal
> 
>    Q: How does one link from the home page for canines (Animal.Canine)
>       to one of the canine pages such as Terrier or Bulldog?

A: [[./Terrier]] and [[./Bulldog]].
(As you say, [[Terrier]] and [[Bulldog]] would be wrong, as these would 
refer to the "sibling pages" Animal.Terrier and Animal.Bulldog.)

The root of the confusion is that the filesystem analogy breaks down at 
this point. In a file system, a directory doesn't double as a file; in 
PmWiki, a group doubles as a page.
Does anybody know how the reiserfs people address the issue? In Reiser4, 
files can double as directories and vice versa; I'd expect them to have 
similar problems. Or maybe they just didn't notice - you don't see this 
kind of problem while you're implementing filesystem semantics, it comes 
up the moment you try to *use* it.

> At this point I'll spare the list (and myself) the tedium
> of going through each of the common responses and the conflicts 
> that result; suffice it to say that I've gone down the various 
> paths many times before.  

OK, I now see that my above synax may be part of the same problem.

However, do make any real progress on the issue, it would be 
*tremendously* helpful if you indeed went through that tedium. That way, 
we can look at the alternatives, maybe even propose one that you 
overlooked, or check whether you one dismissed maybe a bit too quickly.

I'd suggest a format like this:

Absolute link:   <example of an absolute link>
Link to parent:  <example for a link to the parent group page>
Link to sibling: <syntax for a link to a page in the same group>
Link to child:   <syntax for a link to a page in the subgroup>
Pros: <things that are nice about this particular syntax>
Cons: <things that are bad about this particular syntax>

Let me start by rephrasing the proposals that I mentioned before:

Absolute link:   [[/Animal/Canine]]
Link to parent:  [[..]]
Link to sibling: [[Feline]]
Link to child:   [[./Bulldog]]
Pros: Borrows heavily from well-known filesystem syntax.
Cons: The distinction between "link to sibling" and "link to child" 
seems artificial.
Also, the use of dots conflicts with "dot syntax" (where PmWiki simply 
displays the last element of the page's access path).

Absolute link:   [[:Animal.Canine]]
Link to parent:  [[..]]
Link to sibling: [[Feline]]
Link to child:   [[.Bulldog]]
Pros: Very regular. Links that navigate across the hierarchy always 
contain a dot somewhere, purely local links don't.
Cons: The initial dot in "Link to child" is easily overlooked, but 
carries semantic relevance.

Maybe we should collect syntax proposals on the PmWiki/HierarchicalGroups.

> Hope this helps to make it clear that hierarchical groups are
> anything but clear, and that relative page links really are 
> the crux of the problem.

Actually the semantics is easy. What's problematic is finding a syntax 
that has all of these properties:
1) Easily understood (i.e. close to existing syntax),
2) can differentiate between sibling and child links,
3) offers display variants (absolute path vs. just the last component of 
the path vs. path as given in the link), and
4) is backwards compatible with current wikilink syntax.

I don't think that (2) and (4) are compatible. I suspect that any syntax 
that supports both would be too irregular and ugly to live.

(2) is difficult to reconcile with (1), simply because there's no 
precedent in filesystem syntax for this.

Also, display variants should probably be handled differently than 
current wikilink syntax. I find myself constantly mixing up whether it's 
Canine.Bulldog or Canine.Bulldog that would display the group name in 
wikilink syntax. It's another reason why I'm placing (4) under "nice to 
have but not really important".

Note that I have left out the display variants from the scheme above. 
Maybe that should be rectified.

Regards,
Jo




More information about the pmwiki-users mailing list