Re: using TMCL-constraints

"[email protected]" <[email protected]> Wed, 18 May 2011 10:17:31 +0200
Newsgroups gmane.text.xml.xtm.general
Message-ID <[email protected]>
Hi Lars,

I looked at the TMCL template and found another thing that I am surprised about:
Every constraint is a tmdm:subtype of tmcl:constraint, e.g.
"tmcl:subject-identifier-constraint ako tmcl:constraint;
  isa tmcl:topic-type; ..."

But why is every constraint-topic also an explicit instance of tmcl:topic-type - I think this is made implicitly by declaring tmcl:constraint to be a tmcl:topic-type and declaring all further constraints to be a tmdm:subtype of the tmcl:constraint topic?


Best Regards,

Lukas





-----Original Message-----
From: Lars Heuer [mailto:[email protected]] 
Sent: Dienstag, 17. Mai 2011 14:35
To: [email protected]
Cc: topicmapmail-Zo64W7twoUFWk0Htik3J/[email protected]
Subject: Re: [topicmapmail] using TMCL-constraints

Hi Lukas,

[...]
> Does the 2nd statement create a new instance of tmcl:topic-name-constraint
> (cc) or uses it the first one (c) and creates just a new association of the
> type tmcl:constrained-statement with the roles [player: ns:last-name,
> instance-of: tmcl:constrained] and [player:c, instance-of: tmcl:constraint]?

As Hannes has stated correctly, a new constraint is created. Some
background info: You can see this very easily in the TMCL's template
definitions [1].

If they state

   ?c isa tmcl:whatever-constraint

?c creates always a new topic since ?c is a CTM (named) wildcard [2].

So, if you write x has-name(ns:last-name, 1, 1) the template

    def has-name($tt, $nt, $min, $max)
        [...]
    end

is executed behind the scenes (where $tt is automatically bound to
the context topic).


[1] <http://www.isotopicmaps.org/tmcl/tmcl.html#tmcl-templates>
[2] <http://www.isotopicmaps.org/ctm/ctm.html#named-wildcard>

Best regards,
Lars
-- 
Semagia 
<http://www.semagia.com>

<http://www.topicmaps.de/mailinglist/> German Topic Maps mailing list
<http://tinytim.sourceforge.net/> Open Source Topic Maps engine
<http://mappa.semagia.com/> Mappa - Python Topic Maps engine