One thing that‘s lacking in the current set of Topic Maps standards is defined identifiers for the Topic Maps constructs, like subject, topic, association, etc. The TMDM doesn‘t really need this for its own purposes, but it does mean that there are some semantics that aren‘t described as fully as they could be. There are also other standards (TMCL and TMQL) which could make use of such identifiers (with additional semantics). NotationHow to define the identifiers is dead easy, but how would we define the semantics? In this blog entry I use a rather ad-hoc solution: a set of tolog update statements which add to the topic map the information that is implied by these topic map constructs. The syntax is INSERT ... FROM ... where the first part contains an LTM template using variables whose values are defined by the tolog query in the FROM. This syntax is not defined anywhere, and not necessarily beautiful, but it gets the job done. You can (informally) interpret this in several ways:
I‘ll use the PSI prefix tm: here, but I won‘t define what it stands for, since these PSIs don‘t actually exist. I‘m just trying out ideas here, not defining anything for real. Identifiers and semanticstm:subjectThe term "subject" is defined very clearly in the standard as being absolutely anything at all. This is clearly a class, and it‘s equally clear that there isn‘t anything that isn‘t an instance of this class (including tm:subject itself). INSERT [$topic : tm:subject] FROM topic($topic) In other words, every topic is an instance of tm:subject. INSERT tmdm:supertype-subtype(tm:subject : tmdm:supertype, $type : tmdm:subtype) FROM instance-of($type, tmdm:type) In other words, every type is a subtype of tm:subject. tm:topicThis is an interesting term, because none of the topics in the topic map actually represent topics. This may sound like it‘s wrong, but stop for a moment to consider the following: [lmg : person = "Lars Marius Garshol"] Clearly, lmg is a subject (because everything is). But is lmg a topic? Yes. But lmg does not represent a topic; it represents a person, and persons are not topics. So does topic have any semantics? Well, in a sense it does: every topic is a topic map construct. But we will specify this when we get to that term. tm:topic-map-constructThis is the common supertype for topics, associations, and all the other constructs that can appear in a topic map. The semantics are easily defined as given below. [tm:topic-map-construct = "Topic map construct"] tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:topic : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:association : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:association-role : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:occurrence : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:topic-name : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:topic-map : tm:subtype) tmdm:supertype-subtype(tm:topic-map-construct : tm:supertype, tm:variant-name : tm:subtype) Subtypes of tm:topic-map-constructThere is not really a whole lot unsaid about these from the formal point of view, so we say no more here. tm:typeThis term doesn‘t actually exist, but we need it for the semantics defined above, so we define it. The definition can easily be done in LTM alone. [tm:type = "Type"] tmdm:supertype-subtype(tm:type : tm:supertype, tm:topic-type : tm:subtype) tmdm:supertype-subtype(tm:type : tm:supertype, tm:association-type : tm:subtype) tmdm:supertype-subtype(tm:type : tm:supertype, tm:association-role-type : tm:subtype) tmdm:supertype-subtype(tm:type : tm:supertype, tm:occurrence-type : tm:subtype) tmdm:supertype-subtype(tm:type : tm:supertype, tm:name-type : tm:subtype) Given this definition, we also know what it means to be a type. Once we‘ve defined the semantics of the subtypes we should be OK. There is one more thing, though. Anything that is a supertype or subtype of something else must itself be a type. We specify this formally as follows. INSERT [$type : tm:type] FROM { tmdm:supertype-subtype($type : tmdm:supertype, $stype : tmdm:subtype) | tmdm:supertype-subtype($stype : tmdm:supertype, $type : tmdm:subtype) } tm:topic-typeA topic type is something that‘s either declared to be a topic type (by this being stated explicitly), or that‘s used as a topic type. The former case needs no handling, and the latter is handled below. INSERT [$type : tm:topic-type] FROM instance-of($instance, $type) tm:association-typeThe same logic goes for association types, so we provide similar semantics: INSERT [$type : tm:association-type] FROM type($assoc, $type), association($assoc) tm:association-role-typeSame here. INSERT [$type : tm:association-role-type] FROM type($ar, $type), association-role($assoc, $type) tm:occurrence-typeINSERT [$type : tm:occurrence-type] FROM type($occ, $type), occurrence($occ, $type) tm:name-typeINSERT [$type : tm:name-type] FROM type($name, $type), topic-name($name, $type) tm:information-resourceNow this is an interesting term, since it allows us to spell out one part of the meaning of the subject locator construct, which is that any topic which has a subject locator must necessarily represent an information resource. INSERT [$res : tm:information-resource] FROM subject-locator($res, $uri) tm:statementThis is another interesting term. Every association, topic name, variant, and occurrence is a statement in Topic Maps. [tm:statement = "Statement"] tmdm:supertype-subtype(tm:statement : tm:supertype, tm:association : tm:subtype) tmdm:supertype-subtype(tm:statement : tm:supertype, tm:occurrence : tm:subtype) tmdm:supertype-subtype(tm:statement : tm:supertype, tm:topic-name : tm:subtype) tmdm:supertype-subtype(tm:statement : tm:supertype, tm:variant-name : tm:subtype) tm:supertype-subtypeThe semantics that need to be defined here are only the transitivity of this association type, which are easily defined: subtype-of($SUP, $SUB) :- { tmdm:supertype-subtype($SUP : tm:supertype, $SUB : tm:subtype) | tmdm:supertype-subtype($SUP : tm:supertype, $MID : tm:subtype), subtype-of($MID, $SUB) }. INSERT tmdm:supertype-subtype($SUPER : tm:supertype, $SUB : tm:subtype) FROM subtype-of($SUPER, $SUB) tm:type-instanceThe type-instance relationship is trivial, once the above is taken care of. /* using subtype-of from above */ INSERT [$instance : $supertype] FROM direct-instance-of($instance, $type), subtype-of($supertype, $type) |
|