
Author: lgiessmann Date: Fri Jun 5 06:42:59 2009 New Revision: 33 Log: client ajax: added the basic handling for roleplayer-constraints and associationrole-constraints Modified: trunk/docs/xtm_json.txt trunk/src/ajax/javascripts/datamodel.js trunk/src/ajax/javascripts/tmcl_tools.js trunk/src/json/json_tmcl.lisp trunk/src/unit_tests/poems.xtm Modified: trunk/docs/xtm_json.txt ============================================================================== --- trunk/docs/xtm_json.txt (original) +++ trunk/docs/xtm_json.txt Fri Jun 5 06:42:59 2009 @@ -341,7 +341,7 @@ //+----------------------------------------------------------------------------- { "players" : [ [ "topic-psi-1", "topic-psi-2", "..." ], [ "topic-2-psi-1", "..."], <...> ] - "roleTypes" : [ [ "topic-psi-1", "topic-psi-2", "..." ], [ "subtype-psi-1", "..." ], <...> ], + "roleType" : [ [ "topic-psi-1", "topic-psi-2", "..." ], [ "subtype-psi-1", "..." ], <...> ], "cardMin" : "unsigned integer in string representation", "cardMax" : "unsigned integer in string representation or the string MAX_INT" } @@ -356,10 +356,10 @@ //+ The values cardMin and cardMax defines the cardinality of otherRoleType. //+----------------------------------------------------------------------------- { - "playerType" : [ "topic-psi-1", "topic-psi-2", "..." ], - "roleType" : [ "topic-psi-1", "topic-psi-2", "..." ], - "otherRoleType" : [ "topic-psi-1", "topic-psi-2", "..." ], - "otherPlayerType" : [ "topic-psi-1", "topic-psi-2", "..." ], + "players" : [ [ "topic-psi-1", "topic-psi-2", "..." ], [ "topic-2-psi-1", "..."], <...> ] ], + "roleType" : [ [ "topic-psi-1", "topic-psi-2", "..." ], [ "subtype-psi-1", "..." ], <...> ], + "otherPlayers" : [ "topic-psi-1", "topic-psi-2", "..." ], [ "topic-2-psi-1", "..."], <...> ] ], + "otherRoleType" : [ "topic-psi-1", "topic-psi-2", "..." ], [ "subtype-psi-1", "..." ], <...> ], "cardMin" : "unsigned integer in string representation", "cardMax" : "unsigned integer in string representation or the string MAX_INT" } Modified: trunk/src/ajax/javascripts/datamodel.js ============================================================================== --- trunk/src/ajax/javascripts/datamodel.js (original) +++ trunk/src/ajax/javascripts/datamodel.js Fri Jun 5 06:42:59 2009 @@ -1276,11 +1276,12 @@ // --- representation of a role element. -var RoleC = Class.create(ContainerC, {"initialize" : function($super, itemIdentities, roleTypes, rolePlayers, owner, min, max){ +var RoleC = Class.create(ContainerC, {"initialize" : function($super, itemIdentities, roleTypes, rolePlayers, owner, removeFunction, addFunction){ $super(); if(!owner.__frames__) owner.__frames__ = new Array(); if(!roleTypes || roleTypes.length === 0) throw "From RoleC(): roleTypes must be set!"; - if(!rolePlayers || rolePlayers.length === 0) throw "From RoleC(): rolePalyers must be set"; + if(!rolePlayers || rolePlayers.length === 0) throw "From RoleC(): rolePlayers must be set"; + if(!removeFunction || !addFunction) throw "From RoleC(): removeFunction and addFunction must be set!"; owner.__frames__.push(this); this.__frame__.writeAttribute({"class" : CLASSES.roleFrame()}); this.__table__ = new Element("table", {"class" : CLASSES.roleFrame()}); @@ -1291,16 +1292,25 @@ try{ // --- control row + itemIdentity makeControlRow(this, 3, itemIdentities); // make control row have to be changed to a separate control row for roles - checkRemoveAddButtons(owner, 1, max); - setRemoveAddHandler(this, owner, 1, max, function(){ - return new RoleC(null, roleTypes, rolePlayers, owner, min, max); - }); + checkRemoveAddButtons(owner, 1, -1); + setRemoveAddHandler(this, owner, 1, -1, function(){ /*do nothing*/ }); + // --- resets the add and remove handlers + var cTd = this.__table__.select("tr." + CLASSES.itemIdentityFrame())[0].select("td." + CLASSES.controlColumn())[0].select("span." + CLASSES.clickable()); + var removeButton = cTd[1]; + var addButton = cTd[2]; + removeButton.show(); + addButton.show(); + removeButton.stopObserving(); + addButton.stopObserving(); + removeButton.observe("click", removeFunction); + addButton.observe("click", addFunction); // --- type var types = this.__roleTypes__.flatten(); this.__type__ = new Object(); var tr = newRow(CLASSES.typeFrame(), "Type", new SelectrowC(types, this.__type__, 1, 1).getFrame()); this.__table__.insert({"bottom" : tr}); + // TODO: implement a onTypeChangeHandler // --- player var players = this.__rolePlayers__.flatten(); @@ -1312,6 +1322,67 @@ alert("From RoleC(): " + err); } }, + "addPlayer" : function(player){ + if(!player || player.length === 0) return; + var selected = this.__player__.__frames__[0].getContent(); + var select = this.__player__.__frames__[0].getFrame().select("select")[0]; + select.update(""); + if(this.__rolePlayers__){ + var j = 0; + for(var i = 0; i !== player.length; ++i){ + j = 0; + for( ; j !== this.__rolePlayers__.length; ++j){ + if(this.__rolePlayers__[j].indexOf(player[i]) !== -1) break; + } + if(j !== this.__rolePlayers__.length){ + this.__rolePlayers__[j] = player; + alert("test"); + break; + } + } + if(j === this.__rolePlayers__.length)this.__rolePlayers__.push(player); + } + else { + this.__rolePlayers__ = new Array(player); + } + for(var i = 0; i !== this.__rolePlayers__.length; ++i){ + for(var j = 0; j !== this.__rolePlayers__[i].length; ++j){ + var opt = new Element("option", {"value" : this.__rolePlayers__[i][j]}).update(this.__rolePlayers__[i][j]); + if(this.__rolePlayers__[i][j] !== selected){ + select.insert({"bottom" : opt}); + } + else { + select.insert({"top" : opt}); + } + } + } + }, + "removePlayer" : function(player){ + if(!player || player.length === 0 || !this.__rolePlayers__ || this.__rolePlayers__.length === 0) return; + var selected = this.__player__.__frames__[0].getContent(); + var select = this.__player__.__frames__[0].getFrame().select("select")[0]; + select.update(""); + var j = 0; + for(var i = 0; i !== player.length; ++i){ + j = 0; + for( ; j !== this.__rolePlayers__.length; ++j){ + if(this.__rolePlayers__[j].indexOf(player[i]) !== -1) break; + } + if(j !== this.__rolePlayers__.length) break; + } + this.__rolePlayers__ = this.__rolePlayers__.slice(0, j).concat(this.__rolePlayers__.slice(j + 1, this.__rolePlayers__.length)); + for(var i = 0; i !== this.__rolePlayers__.length; ++i){ + for(var j = 0; j !== this.__rolePlayers__[i].length; ++j){ + var opt = new Element("option", {"value" : this.__rolePlayers__[i][j]}).update(this.__rolePlayers__[i][j]); + if(this.__rolePlayers__[i][j] !== selected){ + select.insert({"bottom" : opt}); + } + else { + select.insert({"top" : opt}); + } + } + } + }, "getType" : function(){ return this.__type__.__frames__[0].getContent(); }, @@ -1345,32 +1416,170 @@ // --- contains all roles of an association -var RoleContainerC = Class.create(ContainerC, {"initialize" : function($super, contents, roleConstraints, playerConstraints, otherRoleConstraints){ +var RoleContainerC = Class.create(ContainerC, {"initialize" : function($super, contents, associationRoleConstraints, rolePlayerConstraints, otherRoleConstraints){ $super(); this.__frame__.writeAttribute({"class" : CLASSES.roleContainer()}); - this.__container__ = new Object(); + this.__arContainer__ = new Object(); + this.__orContainer__ = new Object(); + + /* + + *associationrole-constraints: A association role constraint defines how many and of what type the roles in associations of given a type must be. + *min: card-min indicating the minimum number of times the role can appear in the association + *max: card-max indicating the maximum number of times the role can appear in the association + *roleplayer-constraints: A role player constraint defines a way to constrain the type of allowed role players of a given role with a given type + in an association of a given type. + *min: card-min indicating the minimum number of times a topic can play the role with the given type in the given + association of the given type + *max: card-max indicating the maximum number of times a topic can play the role with the given type in the given + association of the given type + *otherrole-constraints: A other role constraint defines a way to constrain the allowed type of role player given the existence of another role + player type in an association. + *min: card-min indicating the minimum number of times the other role can occur + *max: card-max indicating the maximum number of times the other role can occur + + +algorithmus: +OK *alle rollen aus associationroleconstraints erstellen in einem __arContainer__ +OK *überprüfen, ob die kardinalitäten der roleplayer mit den kardinalitäten der associationrole übereinstimmen +OK *card-min rp < card-min ar -> fehler +OK *card-max rp > card-max ar -> fehler +OK *card-min rp > card-max ar -> fehler +OK *card-max rp < card-min ar -> fehler +OK *zu allen gefundenen roles vorhandene roleplayer-constraints suchen +OK *alle roleplayer sammeln und an eine leere option anhängen, anschließend in RoleC anhängen +*__orContainer__ für otherrole-constraints initialisieren +*handler hinzufügen + */ + try{ - if((!contents || contents.length === 0) && roleConstraints && playerConstraints){ - for(var i = 0; playerConstraints && i !== playerConstraints.length; ++i){ - //new RoleC(new Array("itemIdentity " + i), playerConstraints[i].roleTypes, playerConstraints[i].players, this.__container__, 1, 4); - //this.__error__.insert({"before" : this.__container__.__frames__[i].getFrame()}); - } + if((!contents || contents.length === 0) && associationRoleConstraints){ + this.resetValues(associationRoleConstraints, rolePlayerConstraints, otherRoleConstraints); } else { // TODO: check already existing contents and order them to the corresponding fields } - - - } catch(err){ alert("From RoleContainerC(): " + err); } }, - "resetValues" : function(roleConstraints, playerConstraints, otherRoleConstraints){ + "resetValues" : function(associationRoleConstraints, rolePlayerConstraints, otherRoleConstraints){ + this.__associationRoleConstraints__ = associationRoleConstraints; + this.__rolePlayerConstraints__ = rolePlayerConstraints; + this.__otherRoleConstraints__ = otherRoleConstraints; + + try{ + for(var i = 0; this.__arContainer__.__frames__ && i !== this.__arContainer__.__frames__.length; ++i){ + this.__arContainer__.__frames__[i].remove(); + } + this.__arContainer__ = new Object(); + } + catch(err){ + this.__arContainer__ = new Object(); + } + try{ + for(var i = 0; this.__orContainer__.__frames__ && i !== this.__orContainer__.__frames__.length; ++i){ + this.__orContainer__.__frames__[i].remove(); + } + this.__orContainer__ = new Object(); + } + catch(err){ + this.__orContainer__ = new Object(); + } + + + // --- creates all roles from existing associationroleconstraints and roleplayerConstraints + // TODO: insert existing contents to the corresponding constraints + for(var i = 0; this.__associationRoleConstraints__ && i !== this.__associationRoleConstraints__.length; ++i){ + var arc = this.__associationRoleConstraints__[i]; + var foundRpcs = getRolePlayerConstraintsForRole(arc.roleType, this.__rolePlayerConstraints__); + this.__makeRolesFromARC__(arc, foundRpcs); + } + }, + "__makeRolesFromARC__" : function(associationRoleConstraint, rolePlayerConstraints){ + if(!associationRoleConstraint || !rolePlayerConstraints || rolePlayerConstraints.length === 0) return; + checkCardinalitiesARC_RPC(associationRoleConstraint, rolePlayerConstraints); + + // --- creates all roles with all needed players + var rolesCreated = 0; + var allAvailablePlayers = extractPlayersOfConstraints(rolePlayerConstraints); + var roleType = associationRoleConstraint.roleType; + var roleMin = associationRoleConstraint.cardMin; + for(var i = 0; i !== rolePlayerConstraints.length; ++i){ + var playerMin = rolePlayerConstraints[i].cardMin; + var currentAvailablePlayers = rolePlayerConstraints[i].players; + var cleanedPlayers = cleanPlayers(allAvailablePlayers, currentAvailablePlayers); + for(var j = playerMin; j < currentAvailablePlayers.length; ++j){ + cleanedPlayers.push(currentAvailablePlayers[j]); + } + if(currentAvailablePlayers.length < playerMin) throw "From __makeRolesFromARC__(): not enough players(=" + currentAvailablePlayers.length + ") to reach card-min(=" + playerMin + ") of roletype\"" + roleType.flatten()[0] + "\"!"; + for(var j = 0; j !== playerMin; ++j){ + var removeFunction = function(event){ alert("removeFunction"); }; + var addFunction = function(event){ alert("addFunction"); }; + var selectedPlayer = currentAvailablePlayers[j]; + var _players = cleanedPlayers; + _players.unshift(selectedPlayer); + var role = new RoleC(null, roleType, _players, this.__arContainer__, removeFunction, addFunction); + this.__setRoleChangePlayerHandler__(role); + this.__error__.insert({"before" : role.getFrame()}); + ++rolesCreated; + } + } + + // --- creates all further needed roles with players that owns a card-max > existing players + while(rolesCreated < roleMin){ + var currentlyCreated = 0; + for(var i= 0; i !== rolePlayerConstraints.length; ++i){ + // existing roles --> all roles that owns a player which is selected of those listed in the roleplayer-constraint + var existingRoles = this.getExistingRoles(roleType, rolePlayerConstraints[i].players, this.__arContainer__.__frames__); + var availablePlayers = rolePlayerConstraints[i].players; + if(existingRoles.length < rolePlayerConstraints[i].cardMax && availablePlayers.length > existingRoles.length){ + var currentAvailablePlayers = rolePlayerConstraints[i].players; + var cleanedPlayers = cleanPlayers(allAvailablePlayers, currentAvailablePlayers); + + // --- adds players that are not selected yet + for(var j = 0; j !== currentAvailablePlayers.length; ++j){ + if(this.getExistingRoles(roleType, currentAvailablePlayers[j], this.__arContainer__.__frames__).length === 0){ + cleanedPlayers.push(currentAvailablePlayers[j]); + } + } + + // --- removes the player which will be seleted by the new created role of all other select-elements + for(var j = 0; j !== this.__arContainer__.__frames__.length; ++j){ + this.__arContainer__.__frames__[j].removePlayer(cleanedPlayers[0]); + } + + var role = new RoleC(null, roleType, cleanedPlayers, this.__arContainer__, removeFunction, addFunction); + this.__setRoleChangePlayerHandler__(role); + this.__error__.insert({"before" : role.getFrame()}); + ++rolesCreated; + ++currentlyCreated; + } + } + if(currentlyCreated === 0) throw "Not enough players to create all needed roles of the type \"" + roleType.flatten()[0] + "\"!"; + } + }, + "__makeRolesFromORC__" : function(roleType, player){ + + }, + "getExistingRoles" : function(roleType, players, roles){ + var rolesFound = new Array(); + if(!roles || roles.length === 0) return rolesFound; - // TODO: implement + var allTypes = roleType && roleType.length !== 0 ? roleType.flatten() : new Array(); + var allPlayers = players && players.length !== 0 ? players.flatten() : new Array(); + for(var i = 0; i !== roles.length; ++i){ + if(allTypes.indexOf(roles[i].getType()) !== -1 && allPlayers.indexOf(roles[i].getPlayer()) !== -1) rolesFound.push(roles[i]); + } + + return rolesFound; + }, + "__setRoleChangePlayerHandler__" : function(role){ + var select = role.__table__.select("tr." + CLASSES.playerFrame())[0].select("td." + CLASSES.content())[0].select("select")[0]; + select.observe("change", function(event){ alert("changed!"); }); + }, "getContent" : function(){ // TODO: implement @@ -1380,9 +1589,6 @@ }, "isValid" : function(){ // TODO: implement - }, - "isUsed" : function(){ - // TODO: implement }}); Modified: trunk/src/ajax/javascripts/tmcl_tools.js ============================================================================== --- trunk/src/ajax/javascripts/tmcl_tools.js (original) +++ trunk/src/ajax/javascripts/tmcl_tools.js Fri Jun 5 06:42:59 2009 @@ -63,4 +63,140 @@ if(foundContents < min || foundContents > max) return false; } return true; +} + + +// --- Returns an array of rolePlayerConstraints belonging to the given type in roleType. +// --- roleType is of the form [["psi-1", "psi-2", "..."], ["sub-psi-1", "..."], <...>] +function getRolePlayerConstraintsForRole(roleType, rolePlayerConstraints){ + if(!roleType || roleType.length === 0 || !rolePlayerConstraints || rolePlayerConstraints.length === 0) return new Array(); + + var foundConstraints = new Array(); + var allRoleTypes = roleType.flatten(); + for(var i = 0; i !== rolePlayerConstraints.length; ++i){ + var allCRoleTypes = rolePlayerConstraints[i].roleType.flatten(); + for(var j = 0; j !== allRoleTypes.length; ++j){ + if(allCRoleTypes.indexOf(allRoleTypes[j]) !== -1){ + foundConstraints.push(rolePlayerConstraints[i]); + break; + } + } + } + return foundConstraints; +} + + +// --- Returns an array of otherRoleConstraints belonging to the given roleType and players. +// --- roleType is of the form [["psi-1", "psi-2", "..."], ["sub-psi-1", "..."], <...>] +// --- players is of the form [["t1-psi-1", "t1-psi-2", "..."], ["t2-psi-1", "..."], <...>] +function getOtherRoleConstraintsForRole(roleType, players, otherRoleConstraints){ + if(!roleType || roleType.length === 0 || !players || players.length === 0 || !otherRoleConstraints || otherRoleConstraints.length === 0) return new Array(); + + var foundConstraints = new Array(); + var allRoleTypes = roleType.flatten(); + var allPlayers = players.flatten(); + for(var i = 0; i !== otherRoleConstraints.length; ++i){ + var roleTypeMatches = false; + var allCRoleTypes = otherRoleConstraints[i].roleType.flatten(); + for(var j = 0; j !== allPlayers.length; ++j){ + if(allCRoleTypes.indexOf(allRoleTypes[j]) !== -1){ + var allCPlayers = otherRoleConstraints[i].players.flatten(); + for(var k = 0; k !== allPlayers.length; ++k){ + if(allCPlayers.indexOf(allPlayers[k]) !== -1){ + foundConstraints.push(otherRoleConstraints[i]); + break; + } + } + break; + } + } + } + return foundConstraints; +} + + +// --- Returns the sum of all cardMin values of all rolePlayerConstraints. +function getRolePlayerMinForRole(anyRoleConstraints){ + if(!anyRoleConstraints || anyRoleConstraints === 0) return 0; + var min = 0; + for(var i = 0; i !== anyRoleConstraints.length; ++i){ + min += parseInt(anyRoleConstraints[i].cardMin); + } + return min; +} + + +// --- Returns the sum of all cardMax values of all rolePlayerConstraints. +function getRolePlayerMaxForRole(anyRoleConstraints){ + if(!anyRoleConstraints || anyRoleConstraints === 0) return 0; + var max = 0; + for(var i = 0; i !== anyRoleConstraints.length; ++i){ + if(anyRoleConstraints[i].cardMax === "MAX_INT") return "*"; + else max += parseInt(anyRoleConstraints[i].cardMax); + } + return max; +} + + +// --- checks the cardinalities of all rolePlayerconstraints depending on a +// --- given associationRoleConstraint +function checkCardinalitiesARC_RPC(associationRoleConstraint, rolePlayerConstraints){ + if(!associationRoleConstraint) throw "From checkCardinalitiesARC(): associationRoleConstraint is not set!"; + if(!rolePlayerConstraints || rolePlayerConstraints.length === 0) throw "From checkCardinalitiesARC(): rolePlayerConstraints is not set!"; + var arMin = parseInt(associationRoleConstraint.cardMin); + var arMax = associationRoleConstraint.cardMax === "MAX_INT" ? "*" : parseInt(associationRoleConstraint.cardMax); + var rpcs = getRolePlayerConstraintsForRole(associationRoleConstraint.roleType, rolePlayerConstraints); + var rpMin = getRolePlayerMinForRole(rpcs); + var rpMax = getRolePlayerMaxForRole(rpcs); + var type = associationRoleConstraint.roleType.flatten()[0]; + + if(rpMax !== "*" && rpMax < arMin) throw "Not enough players available for roletype \"" + type + "\" (rpMax=" + rpMax + ", arMin=" + arMin + ")"; + if(arMax !== "*" && rpMin > arMax) throw "Too much players for the roletype \"" + type + "\" (rpMin=" + rpMin + ", arMax=" + arMax + ")"; + /* + if(rpMin < arMin) throw "sum of card-min(=" + rpMin + ") of all roleplayer-constraints < card-min(=" + arMin + ") of associationrole-constraint for the role \"" + type + "\"! not enough players"; + if(arMax !== "*" && (rpMax === "*" || rpMax > arMax)) throw "sum of card-max(=" + rpMax + ") of all roleplayer-constraints > card-max(=" + arMax + ") of associationrole-constraint for the role \"" + type + "\"! too much players" + if(arMax !== "*" && rpMin > arMax) throw "sum of card-min(=" + rpMin + ") of all roleplayer-constraints > card-max(=" + arMax + ") of associationrole-constraint for the role \"" + type + "\"! too much players"; + if(rpMax !== "*" && rpMax < arMin) throw "sum of card-max(=" + rpMax + ") of all roleplayer-constraints > card-min(=" + arMin + ") of associationrole-constraint for the role \"" + type + "\"! not enough players"; + */ +} + + +// --- Returns all listed players of a constraint of the type +// --- roleplayer-constraint or otherrole-constraint and returns them +// --- as an array. +function extractPlayersOfConstraints(anyConstraints){ + var players = new Array(); + if(!anyConstraints || anyConstraints.length === 0) return players; + + for(var i = 0; i !== anyConstraints.length; ++i){ + for(var j = 0; j !== anyConstraints[i].players.length; ++j){ + players.push(anyConstraints[i].players[j]) + } + } + + return players; +} + + +// --- Returns an array of players where the players from playersToClean will +// --- be deleted from allPlayers. +function cleanPlayers(allPlayers, playersToClean){ + var cleanedPlayers = new Array(); + if(!allPlayers) return cleanedPlayers; + if(!playersToClean) return allPlayers; + + for(var i = 0; i !== allPlayers.length; ++i){ + var toDel = false; + for(var j = 0; j !== allPlayers[i].length; ++j){ + for(var k = 0; k !== playersToClean.length; ++k){ + if(playersToClean[k].indexOf(allPlayers[i][j]) !== -1){ + toDel = true; + break; + } + } + if(toDel === true) break; + } + if(toDel === false) cleanedPlayers.push(allPlayers[i]); + } + return cleanedPlayers; } \ No newline at end of file Modified: trunk/src/json/json_tmcl.lisp ============================================================================== --- trunk/src/json/json_tmcl.lisp (original) +++ trunk/src/json/json_tmcl.lisp Fri Jun 5 06:42:59 2009 @@ -192,7 +192,7 @@ (topics-to-json-list (list-instances (getf involved-topic-tupple :player) topictype topictype-constraint)))) (json-role - (concatenate 'string "\"roleTypes\":" + (concatenate 'string "\"roleType\":" (topics-to-json-list (getf (list-subtypes (getf involved-topic-tupple :role) roletype roletype-constraint) :subtypes)))) (json-otherplayer @@ -291,7 +291,7 @@ (topics-to-json-list (list-instances (getf role-player-tupple :player) topictype topictype-constraint)))) (json-role - (concatenate 'string "\"roleTypes\":" + (concatenate 'string "\"roleType\":" (topics-to-json-list (getf (list-subtypes (getf role-player-tupple :role) roletype roletype-constraint) :subtypes)))) (card-min Modified: trunk/src/unit_tests/poems.xtm ============================================================================== --- trunk/src/unit_tests/poems.xtm (original) +++ trunk/src/unit_tests/poems.xtm Fri Jun 5 06:42:59 2009 @@ -1,5 +1,57 @@ <?xml version="1.0" encoding="UTF-8"?> <tm:topicMap version="2.0" xmlns:tm="http://www.topicmaps.org/xtm/"> + <!-- test: defines some scopse constraints for associations of the type "born-in" --> + <tm:topic id="scoped-born-in-constraint-1"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/scoped-born-in-constraint-1"/> + <tm:instanceOf><tm:topicRef href="#associationtypescope-constraint"/></tm:instanceOf> + <tm:occurrence> + <tm:type><tm:topicRef href="#card-min"/></tm:type> + <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> + </tm:occurrence> + <tm:occurrence> + <tm:type><tm:topicRef href="#card-max"/></tm:type> + <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">2</tm:resourceData> + </tm:occurrence> + </tm:topic> + + <tm:association> + <tm:type><tm:topicRef href="#applies-to"/></tm:type> + <tm:role> + <tm:type><tm:topicRef href="#constraint-role"/></tm:type> + <tm:topicRef href="#scoped-born-in-constraint-1"/> + </tm:role> + <tm:role> + <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> + <tm:topicRef href="#written-by"/> + </tm:role> + </tm:association> + + <tm:association> + <tm:type><tm:topicRef href="#applies-to"/></tm:type> + <tm:role> + <tm:type><tm:topicRef href="#constraint-role"/></tm:type> + <tm:topicRef href="#scoped-born-in-constraint-1"/> + </tm:role> + <tm:role> + <tm:type><tm:topicRef href="#scopetype-role"/></tm:type> + <tm:topicRef href="#en"/> + </tm:role> + </tm:association> + + <tm:association> + <tm:type><tm:topicRef href="#applies-to"/></tm:type> + <tm:role> + <tm:type><tm:topicRef href="#constraint-role"/></tm:type> + <tm:topicRef href="#scoped-born-in-constraint-1"/> + </tm:role> + <tm:role> + <tm:type><tm:topicRef href="#scopetype-role"/></tm:type> + <tm:topicRef href="#de"/> + </tm:role> + </tm:association> + <!-- end test --> + + <!-- ===================================================================== --> <!-- === TMCL meta-model topics ========================================== --> <!-- ===================================================================== --> @@ -1566,6 +1618,46 @@ </tm:role> </tm:association> + + <!-- a subtype of poem-content with another datatype as the original type --> + <tm:topic id="sub-poem-content"> + <tm:subjectIdentifier href="http://some.where/base-psis/sub-poem-content"/> + </tm:topic> + + <tm:association> + <tm:type><tm:topicRef href="#supertype-subtype"/></tm:type> + <tm:role> + <tm:type><tm:topicRef href="#subtype"/></tm:type> + <tm:topicRef href="#sub-poem-content"/> + </tm:role> + <tm:role> + <tm:type><tm:topicRef href="#supertype"/></tm:type> + <tm:topicRef href="#poem-content"/> + </tm:role> + </tm:association> + + <tm:topic id="sub-poem-content-occurrence-datatype-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/sub-poem-content-occurrence-datatype-constraint"/> + <tm:instanceOf><tm:topicRef href="#occurrencedatatype-constraint"/></tm:instanceOf> + <tm:occurrence> + <tm:type><tm:topicRef href="#datatype"/></tm:type> + <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">http://www.w3.org/2001/XMLSchema#float</tm:resourceData> + </tm:occurrence> + </tm:topic> + + <tm:association> + <tm:type><tm:topicRef href="#applies-to"/></tm:type> + <tm:role> + <tm:type><tm:topicRef href="#constraint-role"/></tm:type> + <tm:topicRef href="#sub-poem-content-occurrence-datatype-constraint"/> + </tm:role> + <tm:role> + <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type> + <tm:topicRef href="#sub-poem-content"/> + </tm:role> + </tm:association> + + <!-- the poem-content-occurrence can only appear once per topictype, so all topic with this occurrence type must have different occurrence-values --> @@ -1732,10 +1824,10 @@ of type author and another role of type written which owns a player of type poem --> - <!-- the writer role has to appear exactly once in an association of type + <!-- the written role has to appear exactly once in an association of type written-by --> - <tm:topic id="written-by-writer-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/written-by-writer-role-constraint"/> + <tm:topic id="written-role-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/written-role-constraint"/> <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type><tm:topicRef href="#card-min"/></tm:type> @@ -1751,7 +1843,7 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-writer-role-constraint"/> + <tm:topicRef href="#written-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> @@ -1763,17 +1855,17 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-writer-role-constraint"/> + <tm:topicRef href="#written-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#writer"/> + <tm:topicRef href="#written"/> </tm:role> </tm:association> - <!-- the writer role owns a player of the type author --> - <tm:topic id="written-by-writer-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/written-by-writer-role-player-constraint"/> + <!-- the written role owns a player of the type poem --> + <tm:topic id="written-role-player-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/written-role-player-constraint"/> <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type><tm:topicRef href="#card-min"/></tm:type> @@ -1789,11 +1881,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-writer-role-player-constraint"/> + <tm:topicRef href="#written-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#author"/> + <tm:topicRef href="#poem"/> </tm:role> </tm:association> @@ -1801,7 +1893,7 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-writer-role-player-constraint"/> + <tm:topicRef href="#written-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> @@ -1813,26 +1905,32 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-writer-role-player-constraint"/> + <tm:topicRef href="#written-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#writer"/> + <tm:topicRef href="#written"/> </tm:role> </tm:association> - <!-- the written role has to appear exactly once in an association of type - written-by --> - <tm:topic id="written-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/written-role-constraint"/> - <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> + <!-- otherrole-constraint: + If there is a role of the type written with a player of the type poem + there must be another role of the type writer with a player of the + type author. --> + <tm:topic id="written-by-otherrole-constraint-for-written"> + <tm:subjectIdentifier href="http://some.where/contraint-psis/written-by-otherrole-constraint-for-written"/> + <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> + <tm:type> + <tm:topicRef href="#card-min"/> + </tm:type> <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> </tm:occurrence> <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> + <tm:type> + <tm:topicRef href="#card-max"/> + </tm:type> <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> </tm:occurrence> </tm:topic> @@ -1841,7 +1939,7 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-role-constraint"/> + <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> @@ -1853,7 +1951,7 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-role-constraint"/> + <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> @@ -1861,25 +1959,11 @@ </tm:role> </tm:association> - <!-- the written role owns a player of the type poem --> - <tm:topic id="written-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/written-role-player-constraint"/> - <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - <tm:association> <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-role-player-constraint"/> + <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#topictype-role"/></tm:type> @@ -1891,11 +1975,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-role-player-constraint"/> + <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> </tm:role> <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#written-by"/> + <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> + <tm:topicRef href="#writer"/> </tm:role> </tm:association> @@ -1903,38 +1987,29 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-role-player-constraint"/> + <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> </tm:role> <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#written"/> + <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> + <tm:topicRef href="#author"/> </tm:role> </tm:association> + <!-- born-in associations have to have one role of the type writer with a + player of the type author. The other role is of type place with the + player of the type region. --> + <!-- place associationrole-constraint --> - <!-- otherrole-constraint: - If there is a role of the type written with a player of the type poem - there must be another role of the type writer with a player of the - type author. - In contrast if there is a role of the type writer with a player of the - type author there must be a role of the type written with a player of - the type poem. - So for this case there are two otherrole-constraints which handle this - both cases. --> - - <tm:topic id="written-by-otherrole-constraint-for-writer"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/written-by-otherrole-constraint-for-writer"/> - <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> + <!-- writer associationrole-constraint --> + <tm:topic id="born-in-writer-role-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-writer-role-constraint"/> + <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-min"/> - </tm:type> + <tm:type><tm:topicRef href="#card-min"/></tm:type> <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> </tm:occurrence> <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-max"/> - </tm:type> + <tm:type><tm:topicRef href="#card-max"/></tm:type> <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> </tm:occurrence> </tm:topic> @@ -1943,11 +2018,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-writer"/> + <tm:topicRef href="#born-in-writer-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#written-by"/> + <tm:topicRef href="#born-in"/> </tm:role> </tm:association> @@ -1955,7 +2030,7 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-writer"/> + <tm:topicRef href="#born-in-writer-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> @@ -1963,11 +2038,25 @@ </tm:role> </tm:association> + <!-- place-role roleplayer-constraint --> + <tm:topic id="born-in-writer-role-player-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-writer-role-player-constraint"/> + <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> + <tm:occurrence> + <tm:type><tm:topicRef href="#card-min"/></tm:type> + <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> + </tm:occurrence> + <tm:occurrence> + <tm:type><tm:topicRef href="#card-max"/></tm:type> + <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> + </tm:occurrence> + </tm:topic> + <tm:association> <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-writer"/> + <tm:topicRef href="#born-in-writer-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#topictype-role"/></tm:type> @@ -1979,11 +2068,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-writer"/> + <tm:topicRef href="#born-in-writer-role-player-constraint"/> </tm:role> <tm:role> - <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> - <tm:topicRef href="#written"/> + <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> + <tm:topicRef href="#born-in"/> </tm:role> </tm:association> @@ -1991,16 +2080,20 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-writer"/> + <tm:topicRef href="#born-in-writer-role-player-constraint"/> </tm:role> <tm:role> - <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> - <tm:topicRef href="#poem"/> + <tm:type><tm:topicRef href="#roletype-role"/></tm:type> + <tm:topicRef href="#writer"/> </tm:role> </tm:association> - <tm:topic id="written-by-otherrole-constraint-for-written"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/written-by-otherrole-constraint-for-written"/> + <!-- otherplayer-constraints: + A "born-in" association must have exactly one writer-role with a + player of the type author and one place-role with a player of the + type city. --> + <tm:topic id="born-in-otherrole-constraint-for-writer"> + <tm:subjectIdentifier href="http://some.where/contraint-psis/born-in-otherrole-constraint-for-writer"/> <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type> @@ -2020,11 +2113,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> + <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#written-by"/> + <tm:topicRef href="#born-in"/> </tm:role> </tm:association> @@ -2032,11 +2125,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> + <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#written"/> + <tm:topicRef href="#writer"/> </tm:role> </tm:association> @@ -2044,11 +2137,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> + <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#poem"/> + <tm:topicRef href="#author"/> </tm:role> </tm:association> @@ -2056,11 +2149,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> + <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> - <tm:topicRef href="#writer"/> + <tm:topicRef href="#place"/> </tm:role> </tm:association> @@ -2068,20 +2161,21 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#written-by-otherrole-constraint-for-written"/> + <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> - <tm:topicRef href="#author"/> + <tm:topicRef href="#region"/> </tm:role> </tm:association> - <!-- born-in associations have to have one role of the type writer with a - player of the type author. The other role is of type place with the - player of the type city. --> + + <!-- located-in associations have to have one role of the type container with + a player of the type country. The other role is of type containee with + a player of the type city. --> <!-- place associationrole-constraint --> - <tm:topic id="born-in-place-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-place-role-constraint"/> + <tm:topic id="located-in-container-role-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-container-role-constraint"/> <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type><tm:topicRef href="#card-min"/></tm:type> @@ -2097,11 +2191,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-place-role-constraint"/> + <tm:topicRef href="#located-in-container-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> + <tm:topicRef href="#located-in"/> </tm:role> </tm:association> @@ -2109,17 +2203,17 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-place-role-constraint"/> + <tm:topicRef href="#located-in-container-role-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#place"/> + <tm:topicRef href="#container"/> </tm:role> </tm:association> <!-- place-role roleplayer-constraint --> - <tm:topic id="born-in-place-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-place-role-player-constraint"/> + <tm:topic id="located-in-container-role-player-constraint"> + <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-container-role-player-constraint"/> <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type><tm:topicRef href="#card-min"/></tm:type> @@ -2135,11 +2229,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-place-role-player-constraint"/> + <tm:topicRef href="#located-in-container-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#region"/> + <tm:topicRef href="#country"/> </tm:role> </tm:association> @@ -2147,11 +2241,11 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-place-role-player-constraint"/> + <tm:topicRef href="#located-in-container-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> + <tm:topicRef href="#located-in"/> </tm:role> </tm:association> @@ -2159,446 +2253,22 @@ <tm:type><tm:topicRef href="#applies-to"/></tm:type> <tm:role> <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-place-role-player-constraint"/> + <tm:topicRef href="#located-in-container-role-player-constraint"/> </tm:role> <tm:role> <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#place"/> + <tm:topicRef href="#container"/> </tm:role> </tm:association> - <!-- writer associationrole-constraint --> - <tm:topic id="born-in-writer-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-writer-role-constraint"/> - <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-writer-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-writer-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#writer"/> - </tm:role> - </tm:association> - - <!-- place-role roleplayer-constraint --> - <tm:topic id="born-in-writer-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/born-in-writer-role-player-constraint"/> - <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-writer-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#author"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-writer-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-writer-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#writer"/> - </tm:role> - </tm:association> - - <!-- otherplayer-constraints: - A "born-in" association must have exactly one writer-role with a - player of the type author and one place-role with a player of the - type city. --> - <tm:topic id="born-in-otherrole-constraint-for-writer"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/born-in-otherrole-constraint-for-writer"/> - <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-min"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-max"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#writer"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#author"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> - <tm:topicRef href="#place"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> - <tm:topicRef href="#region"/> - </tm:role> - </tm:association> - - <tm:topic id="born-in-otherrole-constraint-for-place"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/born-in-otherrole-constraint-for-place"/> - <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-min"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-max"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-place"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-place"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#place"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-place"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#region"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-place"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> - <tm:topicRef href="#writer"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#born-in-otherrole-constraint-for-place"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> - <tm:topicRef href="#author"/> - </tm:role> - </tm:association> - - <!-- located-in associations have to have one role of the type container with - a player of the type country. The other role is of type containee with - a player of the type city. --> - <!-- place associationrole-constraint --> - <tm:topic id="located-in-container-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-container-role-constraint"/> - <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-container-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#located-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-container-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#container"/> - </tm:role> - </tm:association> - - <!-- place-role roleplayer-constraint --> - <tm:topic id="located-in-container-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-container-role-player-constraint"/> - <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-container-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#region"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-container-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#located-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-container-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#container"/> - </tm:role> - </tm:association> - - <!-- writer associationrole-constraint --> - <tm:topic id="located-in-containee-role-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-containee-role-constraint"/> - <tm:instanceOf><tm:topicRef href="#associationrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-containee-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#located-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-containee-role-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#containee"/> - </tm:role> - </tm:association> - - <!-- place-role roleplayer-constraint --> - <tm:topic id="located-in-containee-role-player-constraint"> - <tm:subjectIdentifier href="http://some.where/constraint-psis/located-in-containee-role-player-constraint"/> - <tm:instanceOf><tm:topicRef href="#roleplayer-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-min"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type><tm:topicRef href="#card-max"/></tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-containee-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#region"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-containee-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#located-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-containee-role-player-constraint"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#containee"/> - </tm:role> - </tm:association> - - <!-- otherplayer-constraints: - A "born-in" association must have exactly one writer-role with a - player of the type author and one place-role with a player of the - type city. --> - <tm:topic id="located-in-otherrole-constraint-for-container"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/located-in-otherrole-constraint-for-container"/> - <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> + + <!-- otherplayer-constraints: + A "located-in" association must have exactly one container-role with a + player of the type country and one containee-role with a player of the + type region. --> + <tm:topic id="located-in-otherrole-constraint-for-container"> + <tm:subjectIdentifier href="http://some.where/contraint-psis/located-in-otherrole-constraint-for-container"/> + <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> <tm:occurrence> <tm:type> <tm:topicRef href="#card-min"/> @@ -2673,82 +2343,6 @@ </tm:role> </tm:association> - <tm:topic id="located-in-otherrole-constraint-for-containee"> - <tm:subjectIdentifier href="http://some.where/contraint-psis/located-in-otherrole-constraint-for-containee"/> - <tm:instanceOf><tm:topicRef href="#otherrole-constraint"/></tm:instanceOf> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-min"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - <tm:occurrence> - <tm:type> - <tm:topicRef href="#card-max"/> - </tm:type> - <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">1</tm:resourceData> - </tm:occurrence> - </tm:topic> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-otherrole-constraint-for-containee"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#associationtype-role"/></tm:type> - <tm:topicRef href="#born-in"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-otherrole-constraint-for-containee"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#roletype-role"/></tm:type> - <tm:topicRef href="#containee"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-otherrole-constraint-for-containee"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#topictype-role"/></tm:type> - <tm:topicRef href="#region"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-otherrole-constraint-for-containee"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type> - <tm:topicRef href="#container"/> - </tm:role> - </tm:association> - - <tm:association> - <tm:type><tm:topicRef href="#applies-to"/></tm:type> - <tm:role> - <tm:type><tm:topicRef href="#constraint-role"/></tm:type> - <tm:topicRef href="#located-in-otherrole-constraint-for-containee"/> - </tm:role> - <tm:role> - <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type> - <tm:topicRef href="#country"/> - </tm:role> - </tm:association> <!-- ===================================================================== --> <!-- === the "user's" topic map ========================================== -->