Bug #868

Consider use case that it should be possible to constrain exactly which language (theme) topics can be used in a scope.

Added by Graham Moore over 2 years ago. Updated over 2 years ago.

Status:Closed Start date:2009-07-01
Priority:Normal Due date:
Assignee:Graham Moore % Done:

0%

Category:-
Target version:-

Description

How can you specify in tmcl that only specific topics (not just of a given type) can be used in a scope context.

History

Updated by Lars Marius Garshol over 2 years ago

For example, how can you say

Every place must have one description in the scope of English, one in German, one in Dutch, 
and one in French.

as opposed to the only thing expressible now, which is

Every place must have exactly four descriptions. Every description must have a scope containing
exactly one language.

The latter allows you to have four English descriptions, for example.

In general, the problem seems to be (1) that scope is not included in the matching in the topic-occurrence constraint, and (2) that scope matching happens only by type, and never by instance.

Updated by Lars Marius Garshol over 2 years ago

Possibility: scope-required-constraint

def requires-scope($tt, $st, $t, $min, $max)
?c isa tmcl:scope-required-constraint;
tmcl:card-min: $min;
tmcl:card-max: $max.

tmcl:constrained-topic-type(tmcl:constrains : ?c, tmcl:constrained : $tt)
tmcl:constrained-statement(tmcl:constrains : ?c, tmcl:constrained : $st)
tmcl:required-scope(tmcl:constrains : ?c, tmcl:constrained : $t)
end

The semantics of this constraint is that for every instance of $tt
there must exist the required number of statements of type $st with
the given instance topic $t in their scopes.

Unfortunately, this does not quite work, because although one could
then say:

place isa tmcl:topic-type;
requires-scope(description, english, 1, 1);
requires-scope(description, german, 1, 1);
requires-scope(description, french, 1, 1);
requires-scope(description, dutch, 1, 1).

it would still be possible to do something stupid like:

oslo isa place;
description: Foo @english german french dutch.

The interaction with has-statement is perhaps also not so pretty. Need
to consider this further, but no time right now.

Updated by Lars Marius Garshol over 2 years ago

Actually, scope-required-constraint may be sufficient to solve this, in combination with:

description has-scope(language, 1, 1).

This would make it impossible to mess up the scopes. All that remains is to require the right cardinality on description and so on.

Need to do up an example schema to see whether this would actually look reasonable when used in practice.

Updated by Lars Marius Garshol over 2 years ago

  • Status changed from New to Assigned

The Seattle meeting considered this, and concluded that scope-required-constraint is the solution, and that it must include the topic type.

Updated by Lars Marius Garshol over 2 years ago

  • Status changed from Assigned to Closed

Now added scope-required-constraint to the spec.

Also available in: Atom PDF