Mapping topic map schemas to schema level predicates
I am playing with Prolog implementation of TMSchema
now...
I try to understand relationships between different
TMCL levels.
Firstly, I use schema
terms to represent schema. It looks something like this:
schema::topic(musician,
[
....baseName(fullName,
....[
........cardMin(1),
........cardMax(1)
....]),
....internalOccurrence(age,
....[
........cardMin(1),
........cardMax(1),
........dataType("xsd:nonNegativeInteger")
....]),
....externalOccurrence(webPage,
....[
........cardMin(1),
........cardMax(1),
........match(".\.com")
....]),
....playRole(who,born-in,
....[
........cardMin(1),
........cardMax(1),
........otherRole(where,
........[
............cardMin(1),
............cardMax(1),
.............allPlayersFrom([location])
........])
....])
]).
Of
course, it is possible to have several schemas for the same
type-topic.
I translate these schemas
to schema level predicates.
It looks
something like
this:
constraint::every(musician,
baseName(fullName),relevant)
constraint::every(musician,
baseName(fullName),cardMin(1))
constraint::every(musician,
baseName(fullName),cardMax(1))
constraint::every(musician,internalOccurrence(age),relevant))
constraint::every(musician,internalOccurrence(age),cardMin(1))
constraint::every(musician,internalOccurrence(age),cardMax(1))
constraint::every(musician,internalOccurrence(age),dataType("xsd:nonNegativeInteger"))
...
constraint::every(musician,playRole(who,born_in),
relevant)
constraint::every(musician,playRole(who,born_in),
cardMin(1))
constraint::every(musician,playRole(who,born_in),
cardMax(1))
constraint::every(musician,otherRole(who,born_in,where),
relevant)
constraint::every(musician,otherRole(who,born_in,where),
cardMin(1))
constraint::every(musician,otherRole(who,born_in,where),
cardMax(1))
constraint::every(musician,otherRole(who,born_in,where),allPlayersFrom([location]))
Each constraint should also have some
metadata, of course, to keep track of information
origin.
It is easy to merge these
schema predicates. They also have very good
introspection.
We also can formally
specify validation meaning for each of
them.
For example (using
pseudocode),
validate(constraint::every(TypeTopic,
playsRole(Role,A), cardMin(N))):-
every
X in X : TypeTopic satisfies
atLeast
N Y satisfies
association(Y,A),playsRole(X,Role,Y).
Posted: Sat
- May 22, 2004 at 02:35 PM