[sc34wg3] Representing hierarchies in CTM

Steve Pepper pepper at ontopia.net
Fri Aug 11 07:30:15 EDT 2006


Hi Murray

| > Could you post a snippet of a topic map that uses the ';' syntax
| > extensively? I think it might help us design a syntax that would 
| > meet the kind of requirements you and others might have in this
| > respect.
| 
| In a nutshell, it's just a semicolon where a colon would normally be:
| 
|    [Fido : Dog]
| 
|    "Fido is an instance of the class "Dog"
| 
| so I have augmented the syntax to permit:
| 
|    [Dog ; Mammal]
| 
|    "Dog is a subclass of the class "Mammal"

I was aware of the actual syntax. What I was after was a longer extract from
a real-life topic map that showed it used in context. I guess what I am
really curious about is whether the semicolon syntax tends to be used in the
context of other assertions being made about the subtype (but in isolation
from other supertype-subtype relationships), or whether you tend to cluster
your supertype-subtype relationships and, if so, what it looks like.

In other words: did you invent this syntax extension (a) "merely" because
your topic map happened to have a lot of class hierarchy and you wanted to
save keystrokes, or (b) because you hit upon a way of making the hierarchy
much easier to eyeball as a whole?

If it's the former (a), then a special delimiter may not be necessary, since
you could _almost_ define your own using the current draft of CTM:

  %assoc subtype ako supertype
  ako tm:supertype-subtype .
  subtype tm:subtype .
  supertype tm:supertype .

  dog ako mammal .
  cat ako mammal .
  mammal ako animal .

OK, so it's two extra keystrokes per association, but it's 200% more
intuitive than the semicolon :-) (I myself would probably opt for
'subtypeOf' rather than 'ako', but that's a matter of taste.) Lars Marius
recently questioned whether we even need the proposed AKO "shortcut" for
supertype-subtype and, given the above, I tend to agree with him.

HOWEVER... if your answer to the question above was (b), we have a different
situation. If it is the case that you have a way of using the semicolon
delimiter to create a more visual impression of your class hierarchy, maybe
we should consider going one step further. (Of course, we should really
consider that anyway). Perhaps we could use indentation to represent a class
hierarchy:

[ 
  animal
    mammal
      canine
        dog
        wolf
      feline
        tiger
        lion
    reptile
      snake
      neo-con
    insect
]

And if we can do that with supertype-subtype, why not also other
"hierarchical" association types (locatedIn, partOf, subtopicOf)? Presumably
the technique -- indentation or whatever -- would remain the same; we would
simply declare the association type and role types using the normal template
mechanism, and then specify what kind of hierarchy we were creating:

  %assoc subtopic subtopicOf topic
  %hierarchy subtopicOf [
    arts
      movies
      television
      music
      ...
    business
      jobs
      real-estate
      investing
      ...
    computers
      internet
      software
      hardware
      ...
  ]

What do other people think? Is this something worth considering?

Steve





More information about the sc34wg3 mailing list