| Description |
The first PSI below designates the full array of constraints to be
honored by WORDS for aspects
defined in that language. The others designate individual constraints as now
planned.
Because WORDS uses similar mechansisms to declare constraints on any aspect, it is convenient below to generalize how we speak of their effect. So we talk here about each constaint as logically limiting the "value(s)" for some open set of [description aspect value(s)] n-tples held in topic map memory. In fact, such n-tples will actually exhibit one of these more concrete storage patterns: The descriptions and values constrained are therefore implicit in the type of aspect being discussed. The details of each constraint, meanwhile, depend on the explicit declaration of this same type.So in the WORDS model, the constraints and typing for each aspect are very tightly bound. Constraints are essentially conceived as facets of declared data types; and aspects as typed variables in which data values may be stored within any description. This paradigm is widely used (with variations) in many other programming languages. Note: These specs guide R&D on future software releases. If you would prefer to see changes in what they declare, this would be an excellent time to say so. |
|---|---|
| Publisher | Lexikos Corporation |
| Creator | Dan Corwin |
| Language | http://www.topicmaps.org/xtm/1.0/language.xtm#en |
| Version | 2003/12/06 |
| Status | Pre-release draft for comment |
| Date Published | 2003/10/02 |
| Constraint | http://www.lexikos.com/psi/words/constraint/#0 |
| Cardinality | http://www.lexikos.com/psi/words/constraint/#1 |
| *...minCardinality | http://www.lexikos.com/psi/words/constraint/#11 |
| *...maxCardinality | http://www.lexikos.com/psi/words/constraint/#12 |
| *...fixedCardinality | http://www.lexikos.com/psi/words/constraint/#13 |
| Update Policy | http://www.lexikos.com/psi/words/constraint/#2 |
| *...onlyAuthor | http://www.lexikos.com/psi/words/constraint/#21 |
| *...onlyAdmin | http://www.lexikos.com/psi/words/constraint/#22 |
| *...onlyLicensed | http://www.lexikos.com/psi/words/constraint/#23 |
| *...fromConstraints | http://www.lexikos.com/psi/words/constraint/#20 |
| Domain | http://www.lexikos.com/psi/words/constraint/#3 |
| Range | http://www.lexikos.com/psi/words/constraint/#4 |
| *...general String | http://www.lexikos.com/psi/words/constraint/#41 |
| *...a kind of URI | http://www.lexikos.com/psi/words/constraint/#42 |
| *...an Integer | http://www.lexikos.com/psi/words/constraint/#43 |
| *...a TimeStamp | http://www.lexikos.com/psi/words/constraint/#44 |
| *...a Topic Name | http://www.lexikos.com/psi/words/constraint/#45 |
| *...PSI-set ID(s) | http://www.lexikos.com/psi/words/constraint/#46 |
| *...-(others TBD)- | http://www.lexikos.com/psi/words/constraint/#40 |
| Property Predicate | http://www.lexikos.com/psi/words/constraint/#5 |
| *...patternAssertion | http://www.lexikos.com/psi/words/constraint/#51 |
| *...inListingAssertion | http://www.lexikos.com/psi/words/constraint/#52 |
| *...-(others TBD)- | http://www.lexikos.com/psi/words/constraint/#50 |
| Topical Predicate | http://www.lexikos.com/psi/words/constraint/#6 |
| *...instanceAssertion | http://www.lexikos.com/psi/words/constraint/#61 |
| *...subClassAssertion | http://www.lexikos.com/psi/words/constraint/#62 |
| *...rolePlayViaWords | http://www.lexikos.com/psi/words/constraint/#63 |
| *...-(others TBD)- | http://www.lexikos.com/psi/words/constraint/#60 |
Each constraint logically limits the value(s) of an aspect if and only if the aspect topic itself explicitly declares that the ASSERTION applies. Such a declaration is made by including the constraint model within the aspect topic as an occurrence which is itself typed by the appropriate PSI defined below.
The PSIs for Cardinality, Update Policy, Domain and Range are special cases, attached in a very compact and direct way by their semi-immutable inclusion in each aspect type by the (ontology) author who defines it. This acts as a basic declaration on the aspect's nature and expected usage, in much the same way that a programmer assigns a dataype to each variable. See each subsection for details and defaults.
Property Predicate and Topical Predicate PSIs let explicit, optional ASSERTIONS be declared for an aspect type. They are more complex to define, partly because each one now requires some constraint language in which to express the ASSERTION, plus integration of all executables required to test it.
Hopefully, a standard TMCL will soon reduce this chaos. Initially, WORDS limits it by supporting only aspect type strings (a pretty good 80-20 stopgap), and allowing (a few, basic) predicates as experimental.
If multiple values are declared, WORDS will permit use of ONLY plural-signature API methods for setting values of the aspect. Otherwise, it allows ONLY single-value signatures (the default for unconstrained aspects).
The last case also works as a default for aspects never declared, which have no constraints imposed. For them, all changes are deemed legal. Under onlyLicensed, any attempted updates of them would fail (as being unanticipated). A global setting for WORDS run-time code (TBDL) can make any of the above the default policy.
E.g., each aspect that applies only to living things should cite the defined code for organism. Multiple thing types, separated by spaces, are allowed as an answer.
Lots of String types could mean lots of coding work here. Reusing published regular expressions (e.g., for XSD), should help. For many simple WORDS applications, they should be ample.
To let TM applications validate Strings in more detail, using arbitrary logic, WORDS defines PSI-based predicates of a fairly broad type, which can be functionally adjusted by the String ASSERT passed as lead argument to a method with the signature above.
This design pattern is general, and seeks to let each application assemble the procedural constraints it needs to validate any Property value. Any WORDS validator would first check its format by using the PSI and logic for Range, then check for any ASSERTS listed after other PSIs in its Constraints property, and test them using the related method, with a signature like that above. Such a call might return: .
For any particular RoleType, WORDS syntax can similarly support basic types of ASSERTS. Each related predicate takes such character Strings as the lead argument to a PSI-labeled method with the signature above. The specific predicates WORDS initially defines are wide open by design:
Each ASSERT has procedural support, which can be as general as its designers desire. For security reasons, open scripts should not be supported, but PSI names and related arguments for scripts can be safely used in ASSERT Strings. Indeed, such a string can even start with the name of a scripting language other than WORDS, which can be called as described under Constraint.
Such extensions should let each aspect author register within a core TM any ASSERT scripts supported by his application's chosen language(s), then rely on those scripts and ASSERTs to ensure that mutations to (copies of) the original TM remain reasonably valid.