[sc34wg3] TMCL: Semantics of card-min / card-max in constraints

Lars Heuer heuer at semagia.com
Tue Mar 24 09:55:36 EDT 2009


Hi all,

I stumbled over a few TMQL expressions in the current TMCL draft
and I like to propose to change them *iff* my understanding of 
them is correct. 



Subject Identifier / Subject Locator constraints
================================================

I'd expect that

  person 
    has-subject-identifier(1, INF, ".*").

says that every person must have at least one subject identifier. That
seems to be d'accord to the TMCL constraint definition of the current
draft.

But if I state 

  person 
    has-subject-identifier(1, 1, "http://psi\.mycompany\.com/person/.*")

I'd expect to say, that every person must have one subject identifier
which starts with the the address "http://psi.mycompany.com/person/".

The following topic would satisfy my constraint:

  john isa person;
    <http://psi.mycompany.com/person/John>.
    
The following topic wouldn't satisfy my constraint since it has two
subject identifiers which start with the given address:

  paul isa person;
      <http://psi.mycompany.com/person/Paul>;
      <http://psi.mycompany.com/person/Paul_McCartney>.

Everything seems to be fine so far, but the TMQL expression seems to
count all subject identifiers: The card-min / card-max occurrence
specifies the total number of subject identifiers which seems to be
odd. If I have an instance of person like the following:

  ringo isa person;
    <http://psi.mycompany.com/person/Ringo>;
    <http://psi.previous-company.com/p/Ringo>.

I'd expect that the TMCL constraint is satisfied. But it isn't
according to my understanding of the TMQL expression: The topic has 2
subject identifiers and not all subject identifiers satisfy the
regular expression.

If my topic "ringo" must be rejected by the TMCL validator, I propose to
change the TMQL expression that card-min / card-max checks the count of
subject identifiers which are valid according to the regular expression.

If someone wants to limit the total number of subject identifiers and each
of the subject identifiers must satisfy a regular expression, she can do it
with the following expression:

  person 
    has-subject-identifier(1, 1, "http://psi\.mycompany\.com/person/.*");
    has-subject-identifier(1, 1, ".*").

This definition says: person has exactly one subject identifier which starts
with the address "http://psi.mycompany.com/person/" and that it has 
exactly one subject identifier which is matched by '.*'. 

If both constraints are statisfied, the topic has exactly one subject identifier
and this subject identifier starts with the address 
"http://psi.mycompany.com/person/".


Name / Occcurence constraints
=============================
I have a similar problem with the name / occurrence constraints: If I 
understand the TMQL expression correctly, card-min / card-max define
the total number of occurrences / names with that specified type.

  company
    has-occurrence(website, 1, 1, "http://www\..*").

I'd expect to say: company must have one occurrence which is of
type "website" and its value must start with "http://www." and the
topic may have more website occurrences, I don't care (exists-semantics).

But if I understand the TMQL expression correctly, the following topic 
wouldn't satisfy the constraint since it has two website occurrences:

  semagia isa company;
    website: <http://www.semagia.com/>;
    website: <http://www.semagia.de/>.

To constrain that a topic must have exactly one occurrence / name of 
a given type and that this one and only occurrence / name must satisfy
a regular expression, I'd do the following (similar to the subject-identifier /
subject-locator solution):

  company
    has-occurrence(website, 1, 1, "http://www\..*");
    has-occurrence(website, 1, 1, ".*").
    

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



More information about the sc34wg3 mailing list