[isidorus-cvs] r31 - in trunk: docs src/ajax src/ajax/css src/ajax/javascripts src/json src/rest_interface src/unit_tests
Lukas Giessmann
lgiessmann at common-lisp.net
Tue May 19 09:23:26 UTC 2009
Author: lgiessmann
Date: Tue May 19 05:23:26 2009
New Revision: 31
Log:
fixed some problems in the json-tmcl module and started to implement the ajax-client
Added:
trunk/src/ajax/css/frame.css (contents, props changed)
- copied, changed from r26, /trunk/src/ajax/css/home.css
trunk/src/ajax/javascripts/create.js
trunk/src/ajax/javascripts/datamodel.js
trunk/src/ajax/javascripts/edit.js
trunk/src/ajax/javascripts/requests.js (contents, props changed)
trunk/src/ajax/javascripts/search.js
trunk/src/ajax/javascripts/tmcl_tools.js
Removed:
trunk/src/ajax/css/home.css
trunk/src/ajax/javascripts/edit_topic.js
trunk/src/ajax/javascripts/make_fragment_node.js
Modified:
trunk/docs/xtm_json.txt
trunk/src/ajax/css/main.css
trunk/src/ajax/css/navi.css
trunk/src/ajax/isidorus.html
trunk/src/ajax/javascripts/constants.js
trunk/src/ajax/javascripts/home.js
trunk/src/ajax/javascripts/navi.js
trunk/src/json/json_tmcl.lisp
trunk/src/json/json_tmcl_validation.lisp
trunk/src/rest_interface/set-up-json-interface.lisp
trunk/src/unit_tests/poems.xtm
Modified: trunk/docs/xtm_json.txt
==============================================================================
--- trunk/docs/xtm_json.txt (original)
+++ trunk/docs/xtm_json.txt Tue May 19 05:23:26 2009
@@ -186,7 +186,10 @@
//+ This message constains a list of topics represented as a list of topic
//+ psis which are exclusive instances for the owner.
//+-----------------------------------------------------------------------------
-[ [ "topic-1-psi-1", "topic-2-psi-2", "..." ], [ "topic-2-psi", "..." ], <...> ]
+{
+ "owner" : ["psi-1", "..."],
+ "exclusives" : [ [ "topic-1-psi-1", "topic-2-psi-2", "..." ], [ "topic-2-psi", "..." ], <...> ]
+}
//+-----------------------------------------------------------------------------
@@ -234,14 +237,14 @@
//+ The scopeConstraint-Object contains a list of all available scopes of
//+ for an association/name/occurrence element - this depends where this
//+ json-onbject is contained.
-//+ The member availableScopeTypes contains a list of topics in psi-list
-//+ representation which can be used as scope.
+//+ The member availableScopeTypes contains a list of lists of topics in
+//+ form of psi-lists.
//+ cardMin defines the minimum number of all scopes of the parent element
//+ (association/name/occurrence).
//+ cardMax defines the maximum number of all scopes of the parent element.
//+-----------------------------------------------------------------------------
{
- "scopeTypes" : [ [ "topic-1-psi-1", "topic-1-psi-2", "..." ], [ "topic-2-psi-1", "..." ] <...> ],
+ "scopeTypes" : [ [ [ "psi-1-1", "psi-1-2", "..." ], [ "subtype-psi-1", "..." ], <...> ], [ "psi-2-1" "..."], <...> ],
"cardMin" : "unsigned integer in string representation",
"cardMax" : "unsigend integer in string representation or the string MAX_INT"
}
@@ -255,7 +258,7 @@
//+-----------------------------------------------------------------------------
{
"nametypescopes" : [ {
- "nametype" : [psi-1, psi-2, "..." ],
+ "nameType" : [psi-1, psi-2, "..." ],
"scopeConstraints" : [ <scopeConstraints> ]
},
<...>
Copied: trunk/src/ajax/css/frame.css (from r26, /trunk/src/ajax/css/home.css)
==============================================================================
--- /trunk/src/ajax/css/home.css (original)
+++ trunk/src/ajax/css/frame.css Tue May 19 05:23:26 2009
@@ -9,36 +9,19 @@
/* in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt. */
/*----------------------------------------------------------------------------*/
-
-.topicSummaryTd {
- width: 40px;
- border: solid 1px gray;
-}
-
-#topicTable {
- width: 80%;
- border: solid 1px gray;
- margin-left: auto;
- margin-right: auto;
- margin-top: 10px;
- margin-bottom: 10px;
-}
-
-th {
- color: red;
- border: solid 1px gray;
+ul.fragmentFrame {
+ list-style-type: none;
}
-ul.topicTable {
- list-style: none;
+caption {
+ font-size: 1.5em;
+ font-weight: bold;
}
-div.naviTopicTable {
- width: 80%;
- margin-left: auto;
- margin-right: auto;
+td.controlColumn {
+ background-color: #eaeaee;
}
-select.topicTable {
- margin-left: 20px;
+tr.showHiddenRows {
+ background-color: #eaeaee;
}
\ No newline at end of file
Modified: trunk/src/ajax/css/main.css
==============================================================================
--- trunk/src/ajax/css/main.css (original)
+++ trunk/src/ajax/css/main.css Tue May 19 05:23:26 2009
@@ -10,42 +10,31 @@
/*----------------------------------------------------------------------------*/
-.clickable{
- cursor: pointer;
- padding-left: 5px;
- padding-right: 5px;
-}
-
-.clickable:hover{
- text-decoration: underline;
-}
-
-.clickable:active{
- color: red;
-}
-
-.headerRow {
- background-color: #EEEEFF;
-}
-
-
-.topicHeaderRow {
- background-color: #CCE5FF;
+body {
+ width: 1024px;
+ margin-left: auto;
+ margin-right: auto;
}
-.topicStubsHeaderRow {
- background-color: #CCE5FF;
+#subPage {
+ color: #333377;
+ min-height: 800px;
+ border-left: 1px solid #d1d1d3;
+ border-right: 1px solid #d1d1d3;
+ border-bottom: 1px solid #d1d1d3;
+ margin-top: -21px;
}
-.associationsHeaderRow {
- background-color: #CCE5FF;
+h1 {
+ margin-left: 10px;
+ padding-top: 20px;
}
-.tmIdsHeaderRow {
- background-color: #CCE5FF;
+.clickable {
+ cursor: pointer;
}
-.frame{
- border: 1px outset black;
- margin: 5px;
-}
+.errorMessage {
+ color: red;
+ font-size: 0.85em;
+}
\ No newline at end of file
Modified: trunk/src/ajax/css/navi.css
==============================================================================
--- trunk/src/ajax/css/navi.css (original)
+++ trunk/src/ajax/css/navi.css Tue May 19 05:23:26 2009
@@ -11,11 +11,55 @@
#navi {
- border: solid 1px;
- margin-top: 10px;
- margin-bottom: 10px;
+ background-color: #aebae3;
+ width: 1022px;
+ margin-left: auto;
+ margin-right: auto;
+ padding-top: 10px;
+ padding-bottom: 5px;
+ border-left: 1px solid #d1d1d3;
+ border-top: 1px solid #d1d1d3;
+ border-right: 1px solid #d1d1d3;
}
-.naviElem {
- background-color: silver;
-}
\ No newline at end of file
+#navi > span {
+ color: #fbfcff;
+ cursor: pointer;
+ border-left: 1px solid #aebae3;
+ border-top: 1px solid #aebae3;
+ border-right: 1px solid #aebae3;
+ padding-left: 3px;
+ padding-right: 3px;
+ padding-top: 3px;
+ padding-bottom: 5px;
+ font-weight: bold;
+}
+
+#navi > span:first-child {
+ border-left: none;
+}
+
+#navi > span:first-child:hover {
+ border-left: none;
+}
+
+#navi > span:hover {
+ color: #333377;
+ background-color: #fbfcff;
+ border-left: 1px solid #d1d1d3;
+ border-top: 1px solid #d1d1d3;
+ border-right: 1px solid #d1d1d3;
+}
+
+#navi > .isActive {
+ color: #333377;
+ background-color: #fbfcff;
+ border-left: 1px solid #d1d1d3;
+ border-top: 1px solid #d1d1d3;
+ border-right: 1px solid #d1d1d3;
+}
+
+#navi > .isActive:hover {
+ color: #333377;
+ background-color: #fbfcff;
+}
Modified: trunk/src/ajax/isidorus.html
==============================================================================
--- trunk/src/ajax/isidorus.html (original)
+++ trunk/src/ajax/isidorus.html Tue May 19 05:23:26 2009
@@ -18,7 +18,7 @@
<!-- includes all necessary css-files -->
<link rel="stylesheet" type="text/css" href="css/main.css"/>
- <link rel="stylesheet" type="text/css" href="css/home.css"/>
+ <link rel="stylesheet" type="text/css" href="css/frame.css"/>
<link rel="stylesheet" type="text/css" href="css/navi.css"/>
<!-- error handling for javascript code -->
@@ -45,21 +45,25 @@
<!-- includes own javascript files -->
<script language="JavaScript" type="text/javascript" src="javascripts/constants.js"></script>
- <script language="JavaScript" type="text/javascript" src="javascripts/make_fragment_node.js"></script>
- <script language="JavaScript" type="text/javascript" src="javascripts/edit_topic.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/tmcl_tools.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/requests.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/datamodel.js"></script>
<script language="JavaScript" type="text/javascript" src="javascripts/home.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/search.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/edit.js"></script>
+ <script language="JavaScript" type="text/javascript" src="javascripts/create.js"></script>
<script language="JavaScript" type="text/javascript" src="javascripts/navi.js"></script>
</head>
<body>
<div id="page">
<div id="navi">
- <span id="home" class="naviElem clickable">home</span>
- <span id="searchTopic" class="naviElem clickable">search topic</span>
- <span id="editTopic" class="naviElem clickable">edit topic</span>
- <span id="createTopic" class="naviElem clickable">create topic</span>
+ <span id="home" class="isActive">Home</span>
+ <span id="searchTopic" class="clickableButton">Search Topics</span>
+ <span id="editTopic" class="clickableButton">Edit Topics</span>
+ <span id="createTopic" class="clickableButton">Create Topics</span>
</div>
- <div id="content" style="border: red solid 1px;">
+ <div id="subPage">
</div>
</div>
</body>
Modified: trunk/src/ajax/javascripts/constants.js
==============================================================================
--- trunk/src/ajax/javascripts/constants.js (original)
+++ trunk/src/ajax/javascripts/constants.js Tue May 19 05:23:26 2009
@@ -10,116 +10,86 @@
//+-----------------------------------------------------------------------------
-var TIMEOUT = 5000; // const TIMEOUT = 5000 --> "const" doesn't work under IE
+// --- Some constants fot the http connections via the XMLHttpRequest-Object
+var TIMEOUT = 10000; // const TIMEOUT = 10000 --> "const" doesn't work under IE
var HOST_PREF = "http://localhost:8000/";
var GET_PREFIX = HOST_PREF + "json/get/";
+var GET_STUB_PREFIX = HOST_PREF + "json/topicstubs/";
+var TMCL_TYPE_URL = HOST_PREF + "json/tmcl/type/";
+var TMCL_INSTANCE_URL = HOST_PREF + "json/tmcl/instance/";
var COMMIT_URL = HOST_PREF + "json/commit/";
var ALL_PSIS_URL = HOST_PREF + "json/psis/";
+var TYPE_PSIS_URL = HOST_PREF + "json/tmcl/types/";
var OWN_URL = HOST_PREF + "isidorus";
var SUMMARY_URL = HOST_PREF + "json/summary"
-// --- a kind of enum for the the different pages with an attribute and a value
-var PAGES = {"home" : "home", "search" : "searchTopic", "edit" : "editTopic", "create" : "createTopic"};
-// --- contains most css classes used in this project
-var CLASSES = {"__addBtnHeader" : "addButton",
- "__associationFrame" : "associationFrame",
- "__associationsFrame" : "assocaitionsFrame",
- "__associationsHeader" : "associationsHeaderRow",
- "__button" : "clickable",
- "__fragmentFrame" : "fragmentFrame",
- "__frame" : "frame",
- "__header" : "headerRow",
- "__headerTitle" : "title",
- "__hideBtnHeader" : "hideButton",
- "__inAssociationFrame" : "inAssociationFrame",
- "__inNameFrame" : "inNameFrame",
- "__inOccurrenceFrame" : "inOccurrenceFrame",
- "__inRoleFrame" : "inRoleFrame",
- "__instanceOfFrame" : "instanceOf",
- "__inTopicFrame" : "inTopicFrame",
- "__inTopicStubFrame" : "inTopicStubFrame",
- "__inVariantFrame" : "inVariantFrame",
- "__itemIdentityFrame" : "itemIdentity",
- "__listFrame" : "listFrame",
- "__nameFrame" : "nameFrame",
- "__namesFrame" : "namesFrame",
- "__occurrenceFrame" : "occurrenceFrame",
- "__occurrencesFrame" : "occurrencesFrame",
- "__playerFrame" : "playerFrame",
- "__removeBtnHeader" : "removeButton",
- "__removeBtnRow" : "rowDel",
- "__resourceFrame" : "resourceFrame",
- "__roleFrame" : "roleFrame",
- "__rolesFrame" : "roleFrame",
- "__row" : "row",
- "__scopeFrame" : "scopeFrame",
- "__subjectIdentifierFrame" : "subjectIdentifier",
- "__subjectLocatorFrame" : "subjectLocator",
- "__textareaRow" : "rowTextArea",
- "__textRow" : "rowTextfield",
- "__tmIdsFrame" : "tmIdsFrame",
- "__tmIdsHeader" : "tmIdsHeaderRow",
- "__topicFrame" : "topicFrame",
- "__topicHeader" : "topicHeaderRow",
- "__topicIdFrame" : "topicId",
- "__topicStubFrame" : "topicStubFrame",
- "__topicStubsHeader" : "topicStubsHeaderRow",
- "__topicStubsFrame" : "topicStubsFrame",
- "__typeFrame" : "typeFrame",
- "__valueFrame" : "valueFrame",
- "__variantFrame" : "variantFrame",
- "__variantHeader" : "variantHeaderRow",
- "__variantsFrame" : "variantsFrame",
-
- "addBtnHeader" : function(){ return this.__button + " " + this.__addBtnHeader; },
- "associationFrame" : function(){ return this.__frame + " " + this.__associationFrame; },
- "associationsFrame" : function(){ return this.__frame + " " + this.__associationsFrame; },
- "associationsHeader" : function(){ return this.__associationsHeader; },
- "button" : function(){ this.__button; },
- "fragmentFrame" : function(){ return this.__frame + " " + this.__fragmentFrame; },
- "frame" : function(){ return this.__frame; },
- "header" : function(){ return this.__header; },
- "headerTitle" : function(){ return this.__headerTitle; },
- "hideBtnHeader" : function(){ return this.__button + " " + this.__hideBtnHeader; },
- "inAssociationFrame" : function(){ return this.__inAssociationFrame; },
- "inNameFrame" : function(){ return this.__inNameFrame; },
- "inOccurrenceFrame" : function(){ return this.__inOccurrenceFrame; },
- "inRoleFrame" : function(){ return this.__inRoleFrame; },
- "instanceOfFrame" : function(){ return this.__instanceOfFrame; },
- "inTopicFrame" : function(){ return this.__inTopicFrame; },
- "inTopicStubFrame" : function(){ return this.__inTopicStubFrame; },
- "inVariantFrame" : function(){ return this.__inVariantFrame; },
- "itemIdentityFrame" : function(){ return this.__itemIdentityFrame; },
- "listFrame" : function(){ return this.__frame + " " + this.__listFrame; },
- "nameFrame" : function(){ return this.__frame + " " + this.__nameFrame; },
- "namesFrame" : function(){ return this.__frame + " " + this.__namesFrame; },
- "occurrenceFrame" : function(){ return this.__frame + " " + this.__occurrenceFrame; },
- "occurrencesFrame" : function(){ return this.__frame + " " + this.__occurrencesFrame; },
- "playerFrame" : function(){ return this.__playerFrame; },
- "removeBtnHeader" : function(){ return this.__button + " " + this.__removeBtnHeader; },
- "removeBtnRow" : function(){ return this.__button + " " + this.__removeBtnRow; },
- "roleFrame" : function(){ return this.__frame + " " + this.__roleFrame; },
- "rolesFrame" : function(){ return this.__frame + " " + this.__rolesFrame; },
- "row" : function(){ return this.__row; },
- "scopeFrame" : function(){ return this.__scopeFrame; },
- "resourceFrame" : function(){ return this.__frame + " " + this.__resourceFrame; },
- "subjectIdentifierFrame" : function(){ return this.__subjectIdentifierFrame; },
- "subjectLocatorFrame" : function(){ return this.__subjectLocatorFrame; },
- "textareaRow" : function(){ return this.__textareaRow; },
- "textRow" : function(){ return this.__textRow; },
- "tmIdsFrame" : function(){ return this.__frame + " " + this.__tmIdsFrame; },
- "tmIdsHeader" : function(){ return this.__tmIdsHeader; },
- "topicFrame" : function(){ return this.__frame + " " + this.__topicFrame; },
- "topicHeader" : function(){ return this.__topicHeader; },
- "topicIdFrame" : function(){ return this.__topicIdFrame; },
- "topicStubFrame" : function(){ return this.__frame + " " + this.__topicStubFrame; },
- "topicStubsHeader" : function(){ return this.__topicStubsHeader; },
- "topicStubsFrame" : function(){ return this.__frame + " " + this.__topicStubsFrame; },
- "typeFrame" : function(){ return this.__typeFrame; },
- "valueFrame" : function(){ return this.__valueFrame; },
- "variantFrame" : function(){ return this.__frame + " " + this.__variantFrame; },
- "variantHeader" : function(){ return this.__variantHeader; },
- "variantsFrame" : function(){ return this.__frame + " " + this.__variantsFrame; }
+// --- A kind of enum for the the different pages with an attribute and a value
+var PAGES = {"home" : "home", "search" : "searchTopic", "edit" : "editTopic", "create" : "createTopic", "current" : ""};
+
+var ANY_URI = "http://www.w3.org/2001/XMLSchema#anyURI";
+var STRING = "http://www.w3.org/2001/XMLSchema#string";
+
+// --- Contains most css classes used in this project
+// --- There should be called only the function to be sure to don't override
+// --- the original values.
+var CLASSES = {"__divPage__" : "page",
+ "__divSubPage__" : "subPage",
+ "__divContent__" : "content",
+ "__divTextrowWithRemoveButton__" : "textrowWithRemoveButton",
+ "__divTextrowWithoutRemoveButton__" : "textrowWithoutRemoveButton",
+ "__divSelectrowWithRemoveButton__" : "selectrowWithRemoveButton",
+ "__divSelectrowWithoutRemoveButton__" : "selectrowWithoutRemoveButton",
+ "__spanClickable__" : "clickable",
+ "__notVisible__" : "notvisible",
+ "__divError__" : "errorMessage",
+ "__ulFragmentFrame__" : "fragmentFrame",
+ "__tableTopicFrame__" : "topicFrame",
+ "__trTopicIdFrame__" : "topicIdFrame",
+ "__tdContent__" : "content",
+ "__tdDescription__" : "description",
+ "__divInstanceOfFrame__" : "instanceOfFrame",
+ "__divItemIdentityFrame__" : "itemIdentityFrame",
+ "__divSubjectLocatorFrame__" : "subjectLocatorFrame",
+ "__divSubjectIdentifierFrame__" : "subjectIdentifierFrame",
+ "__divNameContainer__" : "nameContainer",
+ "__divNameFrame__" : "nameFrame",
+ "__trControlColumn__" : "controlColumn",
+ "__trShowHiddenRows__" : "showHiddenRows",
+ "__trTypeFrame__" : "typeFrame",
+ "__divScopeFrame__" : "scopeFrame",
+ "__divValueFrame__" : "valueFrame",
+ "__divVariantFrame__" : "variantFrame",
+ "__divVariantContainer__" : "variantContainer",
+ "__divDatatypeFrame__" : "datatypeFrame",
+
+ "page" : function(){ return this.__divPage__; },
+ "subPage" : function(){ return this.__divSubPage__; },
+ "content" : function(){ return this.__divContent__; },
+ "textrowWithRemoveButton" : function(){ return this.__divTextrowWithRemoveButton__; },
+ "textrowWithoutRemoveButton" : function(){ return this.__divTextrowWithoutRemoveButton__; },
+ "selectrowWithRemoveButton" : function(){ return this.__divSelectrowWithRemoveButton__; },
+ "selectrowWithoutRemoveButton" : function(){ return this.__divSelectrowWithoutRemoveButton__; },
+ "clickable" : function(){ return this.__spanClickable__; },
+ "notVisible" : function(){ return this.__notVisible__; },
+ "error" : function(){ return this.__divError__; }, "fragmentFrame" : function(){ return this.__ulFragmentFrame__; },
+ "topicFrame" : function(){ return this.__tableTopicFrame__; },
+ "topicIdFrame" : function(){ return this.__trTopicIdFrame__; },
+ "content" : function(){ return this.__tdContent__; },
+ "description" : function(){ return this.__tdDescription__; },
+ "instanceOfFrame" : function(){ return this.__divInstanceOfFrame__; },
+ "itemIdentityFrame" : function(){ return this.__divItemIdentityFrame__; },
+ "subjectLocatorFrame" : function(){ return this.__divSubjectLocatorFrame__; },
+ "subjectIdentifierFrame" : function(){ return this.__divSubjectIdentifierFrame__; },
+ "nameContainer" : function(){ return this.__divNameContainer__; },
+ "nameFrame" : function(){ return this.__divNameFrame__; },
+ "controlColumn" : function(){ return this.__trControlColumn__; },
+ "showHiddenRows" : function(){ return this.__trShowHiddenRows__; },
+ "typeFrame" : function(){ return this.__trTypeFrame__; },
+ "scopeFrame" : function(){ return this.__divScopeFrame__; },
+ "valueFrame" : function(){ return this.__divValueFrame__; },
+ "variantFrame" : function(){ return this.__divVariantFrame__; },
+ "variantContainer" : function(){ return this.__divVariantContainer__; },
+ "datatypeFrame" : function(){ return this.__divDatatypeFrame__; }
};
\ No newline at end of file
Added: trunk/src/ajax/javascripts/create.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/create.js Tue May 19 05:23:26 2009
@@ -0,0 +1,63 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+
+function makeCreate(psi)
+{
+ var content = new Element("div", {"class" : CLASSES.content()});
+ var header = new Element("h1").update("Create a Topic");
+ content.insert(header, {"position" : "bottom"});
+ $(CLASSES.subPage()).insert(content, {"position" : "bottom"});
+
+ try{
+ var fragmentFrame = new Element("ul", {"class" : CLASSES.fragmentFrame()});
+ content.insert({"bottom" : fragmentFrame});
+ var liTopicSelect = new Element("li", {"class" : CLASSES.instanceOfFrame()});
+ fragmentFrame.insert({"bottom" : liTopicSelect});
+
+
+ function makeInstanceOfFrame(context){
+ function makeFragment(psis, constraints){
+ var items = $$("li." + CLASSES.topicFrame());
+ for(var i = 0; i != items.length; ++i){
+ items[i].remove();
+ }
+
+ var topic = new TopicC(null, (constraints ? constraints.topicConstraints : null));
+ context.insert({"after" : new Element("li", {"class" : CLASSES.topicFrame()}).update(topic.getFrame())});
+ }
+
+ function onSuccessHandler(xhr){
+ var json = null;
+ try{
+ json = xhr.responseText.evalJSON();
+ }
+ catch(innerErr){
+ alert("Got bad JSON data from " + xhr.request.url + "\n\n" + innerErr);
+ }
+ var instanceOf = null;
+ try{
+ instanceOf = new InstanceOfC(json.flatten().sort(), makeFragment);
+ context.insert({"bottom" : instanceOf.getFrame()});
+ }
+ catch(innerErr){
+ alert("There occurred an error by creating an InstanceOfC frame, please reload this page!\n\n" + innerErr);
+ }
+ }
+
+ getTypePsis(onSuccessHandler, null);
+ }
+
+ makeInstanceOfFrame(liTopicSelect);
+ }catch(err){
+ alert(err);
+ }
+}
\ No newline at end of file
Added: trunk/src/ajax/javascripts/datamodel.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/datamodel.js Tue May 19 05:23:26 2009
@@ -0,0 +1,1158 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+// --- The base class of all Frames defined in this file.
+var FrameC = Class.create({"initialize" : function(content, owner, min, max){
+ if(!owner) throw "From FrameC(): owner must be set but is null";
+ if(max !== -1 && (min > max || max === 0))throw "From FrameC(): min must be > max(" + max + ") and > 0 but is " + min;
+ if(!owner.__frames__) owner.__frames__ = new Array();
+ owner.__frames__.push(this);
+
+ this.__frame__ = new Element("div");
+ this.__remove__ = new Element("span", {"class" : CLASSES.clickable()}).update("-");
+ this.__add__ = new Element("span", {"class" : CLASSES.clickable()}).update("+");
+
+ checkRemoveAddButtons(owner, min, max);
+
+ this.__error__ = new Element("div", {"class" : CLASSES.error()});
+ this.__error__.hide();
+ this.__content__ = new Element("span").update(content);
+
+ this.__frame__.insert({"bottom" : this.__remove__});
+ this.__frame__.insert({"bottom" : this.__content__});
+ this.__frame__.insert({"bottom" : this.__add__});
+ this.__frame__.insert({"bottom" : this.__error__});
+
+ setRemoveAddHandler(this, owner, min, max, function(){
+ return new FrameC("", owner, min, max);
+ });
+ },
+ "getFrame" : function(){
+ return this.__frame__;
+ },
+ "remove" : function(){
+ return this.getFrame().remove();
+ },
+ "hide" : function(){
+ this.getFrame().hide();
+ },
+ "show" : function(){
+ this.getFrame().show();
+ },
+ "getContent" : function(){
+ return this.__content__.textContent;
+ },
+ "toJSON" : function(){
+ return this.getContent().toJSON();
+ },
+ "showError" : function(message){
+ this.__error__.update(message);
+ this.__error__.show();
+ },
+ "hideError" : function(){
+ this.__error__.hide();
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ },
+ "showRemoveButton" : function(){
+ this.__remove__.show();
+ },
+ "hideAddButton" : function(){
+ this.__add__.hide();
+ },
+ "showAddButton" : function(){
+ this.__add__.show();
+ },
+ "append" : function(elem){
+ return this.getFrame().insert({"after" : elem});
+ }});
+
+
+// --- This class represents a textrow with the functionality of FrameC plus the method isValid
+// --- which returns a boolean value depending on the instance's value and the given regular expression.
+var TextrowC = Class.create(FrameC, {"initialize" : function($super, content, regexp, owner, min, max, cssTitle){
+ $super(content, owner, min, max);
+ owner.__frames__.pop();
+ owner.__frames__.push(this);
+
+ this.__regexp__ = new RegExp(regexp);
+ this.__frame__.writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
+ this.__content__.remove();
+ this.__content__ = new Element("input", {"type" : "text", "value" : content});
+ if(cssTitle && cssTitle.length){
+ this.__content__.writeAttribute({"title" : cssTitle});
+ }
+ this.__remove__.insert({"after" : this.__content__});
+
+ checkRemoveAddButtons(owner, min, max);
+ setRemoveAddHandler(this, owner, min, max, function(){
+ return new TextrowC("", regexp, owner, min, max, cssTitle);
+ });
+ },
+ "getContent" : function(){
+ return this.__content__.value;
+ },
+ "isValid" : function(){
+ return this.__regexp__.match(this.getContent());
+ },
+ "showRemoveButton" : function($super){
+ this.__remove__.show();
+ this.getFrame().writeAttribute({"class" : CLASSES.textrowWithRemoveButton()});
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ this.getFrame().writeAttribute({"class" : CLASSES.textrowWithoutRemoveButton()});
+ }});
+
+
+// --- This class represents a selectrow with the functionality of FrameC.
+var SelectrowC = Class.create(FrameC, {"initialize" : function($super, contents, owner, min, max){
+ if(!contents || !contents.length)throw "From SelectrowC(): contents must be an array!";
+ $super(contents, owner, min, max);
+ owner.__frames__.pop();
+ owner.__frames__.push(this);
+
+ this.__frame__.writeAttribute({"class" : CLASSES.selectrowWithRemoveButton()});
+ this.__content__.remove();
+ this.__content__ = new Element("select");
+ for(var i = 0; i != contents.length; ++i){
+ // --- the attribute value must be set for IE
+ this.__content__.insert({"bottom" : new Element("option", {"value" : contents[i]}).update(contents[i])});
+ }
+ this.__remove__.insert({"after" : this.__content__});
+
+ checkRemoveAddButtons(owner, min, max);
+ setRemoveAddHandler(this, owner, min, max, function(){
+ return new SelectrowC(contents, owner, min, max);
+ });
+ },
+ "getContent" : function(){
+ return this.__content__.value;
+ },
+ "showRemoveButton" : function(){
+ this.__remove__.show();
+ this.getFrame().writeAttribute({"class" : CLASSES.selectrowWithRemoveButton()});
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ this.getFrame().writeAttribute({"class" : CLASSES.selectrowWithoutRemoveButton()});
+ }});
+
+
+// --- The base Class for alomost all frames which contains other frames like names, occurrences, ...
+var ContainerC = Class.create({"initialize" : function(){
+ this.__frame__ = new Element("div");
+ this.__error__ = new Element("div", {"class" : CLASSES.error()});
+ this.__error__.hide();
+ this.__frame__.insert({"bottom" : this.__error__});
+ },
+ "hide" : function(){
+ this.__frame__.hide();
+ },
+ "show" : function(){
+ this.__frame__.show();
+ },
+ "getFrame" : function(){
+ return this.__frame__;
+ },
+ "getContent" : function(unique, removeNull){
+ return "";
+ },
+ "toJSON" : function(unique, removeNull){
+ return this.getContent(unique, removeNull).toJSON();
+ },
+ "showError" : function(message){
+ this.__error__.update(message);
+ this.__error__.show();
+ },
+ "hideError" : function(){
+ this.__error__.hide();
+ },
+ "append" : function(newElem){
+ this.getFrame().insert({"after" : newElem});
+ },
+ "remove" : function(){
+ this.getFrame().remove();
+ }});
+
+
+// --- Represents a container for all instanceOf-Psis of a fragment's topic
+var InstanceOfC = Class.create(ContainerC, {"initialize" : function($super, contents, successFun){
+ $super();
+ this.__frame__.writeAttribute({"class" : CLASSES.instanceOfFrame()});
+ this.__container__ = new Object();
+ try{
+ var row = new SelectrowC(contents, this.__container__, 1, -1);
+ this.__error__.insert({"before" : row.getFrame()});
+ }
+ catch(err){
+ throw "From InstanceOfC(): The following exception was thrown:\n" + err;
+ this.__container__ = null;
+ }
+ this.__commit__ = new Element("input", {"type" : "button", "value" : "get constraints"});
+
+ function setHandler(myself){
+ function onSuccessHandler(xhr){
+ var json = null;
+ try{
+ json = xhr.responseText.evalJSON();
+ }
+ catch(err){
+ alert("Got bad JSON data from " + xhr.request.url + "!\n\n" + err);
+ }
+
+ var ret = checkExclusiveInstances(json, myself.getContent(true));
+ if(ret){
+ var str = "Some topics own exclusive-instance-constraints, please deselect the corresponding topics!<br/>";
+ for(var i = 0; i != ret.length; ++i){
+ for(var j = 0; j != ret[i].length; ++j){
+ if(j === 0){
+ str += "<br/>" + ret[i][j];
+ }
+ else {
+ str += " " + ret[i][j];
+ }
+ str += "<br/>";
+ }
+ }
+ var items = $$("li." + CLASSES.topicFrame());
+ for(var i = 0; i != items.length; ++i){
+ items[i].remove();
+ }
+ myself.showError(str);
+ }
+ else {
+ successFun(contents, json);
+ }
+ }
+
+ myself.__commit__.observe("click", function(event){
+ myself.hideError();
+ requestConstraints(myself.toJSON(true), onSuccessHandler, null);
+ });
+ }
+ setHandler(this);
+
+ this.__error__.insert({"before" : this.__commit__});
+ },
+ "getContent" : function(unique, removeNull){
+ var values = new Array();
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ if(unique === true && values.indexOf(this.__container__.__frames__[i].getContent()) !== -1) continue;
+ if(removeNull === true && this.__container__.__frames__[i].getContent().strip().length === 0) continue;
+ values.push(this.__container__.__frames__[i].getContent().strip());
+ }
+ return values;
+ }});
+
+
+
+// --- Representation of a itemIdentity frame.
+var ItemIdentityC = Class.create(ContainerC, {"initialize" : function($super, contents){
+ $super();
+ this.__frame__.writeAttribute({"class" : CLASSES.itemIdentityFrame()});
+ this.__container__ = new Object();
+
+ try{
+ for(var i = 0; i != contents.length; ++i){
+ new TextrowC(contents[i], ".*", this.__container__, 1, -1, null);
+ this.__error__.insert({"before" : this.__container__.__frames__[i].getFrame()});
+ }
+ }
+ catch(err){
+ this.__container__ = new Object();
+ new TextrowC("", ".*", this.__container__, 1, -1, null);
+ this.__error__.insert({"before" : this.__container__.__frames__[i].getFrame()});
+ }
+ },
+ "getContent" : function(unique, removeNull){
+ var values = new Array();
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ if(unique === true && values.indexOf(this.__container__.__frames__[i].getContent()) !== -1) continue;
+ if(removeNull === true && this.__container__.__frames__[i].getContent().strip().length === 0) continue;
+ values.push(this.__container__.__frames__[i].getContent().strip());
+ }
+ return values;
+ },
+ "toJSON" : function(unique, removeNull){
+ var content = this.getContent(unique, removeNull);
+ return content.length === 0 ? "null" : content.toJSON();
+ }});
+
+
+// --- Representation of a subjectLocator and subjectIdentifier frames.
+var IdentifierC = Class.create(ContainerC, {"initialize" : function($super, contents, constraints, cssClass){
+ $super();
+ this.__frame__.writeAttribute({"class" : cssClass});
+ this.__containers__ = new Array();
+
+ try{
+ if((!contents || contents.length === 0) && constraints && constraints.length > 0){
+ for(var i = 0; i != constraints.length; ++i){
+ this.__containers__.push(new Object());
+ var min = parseInt(constraints[i].cardMin);
+ var max = constraints[i].cardMax !== "MAX_INT" ? parseInt(constraints[i].cardMax) : "*";
+ if(max !== 0){
+ var cssTitle = "min: " + min + " max: " + max + " regular expression: " + constraints[i].regexp;
+ for(var j = 0; j != (min === 0 ? 1 : min); ++j){
+ var row = new TextrowC("", constraints[i].regexp, this.__containers__[i],
+ min === 0 ? 1 : min, max === "*" ? -1 : max, cssTitle);
+ this.__error__.insert({"before" : row.getFrame()});
+ }
+ }
+ }
+ }
+ else {
+ // TODO: check already existing contents and order them to the corresponding fields
+ }
+ }
+ catch(err){
+ alert("From IdentifierC(): " + err);
+ }
+ },
+ "getContent" : function(unique, removeNull){
+ var values = new Array();
+ for(var i = 0; i != this.__containers__.length; ++i){
+ for(var j = 0; j != this.__containers__[i].__frames__.length; ++j){
+ if(unique === true && values.indexOf(this.__containers__[i].__frames__[j].getContent()) !== -1) continue;
+ if(removeNull === true && this.__containers__[i].__frames__[j].getContent().strip().length === 0) continue;
+ values.push(this.__containers__[i].__frames__[j].getContent().strip());
+ }
+ }
+ return values;
+ },
+ "isValid" : function(){
+ // TODO: check the validity of this frame with the passed constraints and return a boolean value
+ return true;
+ }});
+
+
+// --- Represantation of a scope frame, doesn't contain SelectrowCs, because the values must be unique!
+// --- So this class uses another implementation.
+var ScopeC = Class.create(ContainerC, {"initialize" : function($super, contents, min, max){
+ $super();
+ this.__frame__.writeAttribute({"class" : CLASSES.scopeFrame()});
+ this.__error__ = this.__error__.remove();
+
+ this.__container__ = null;
+ this.__contents__ = contents;
+ this.resetRows(this.__contents__, min, max);
+ },
+ "resetRows" : function(contents, min, max){
+ try{
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ this.__container__.__frames__[i].remove();
+ }
+ this.__container__ = new Object();
+ }
+ catch(err){
+ this.__container__ = new Object();
+ };
+
+ this.__contents__ = contents;
+ if(!contents || contents.length < min) throw "From ScopeC.resetRows(): contents.length (" +
+ (contents ? contents.length : "null") + ") must be > min (" + min + ")!";
+ if(max !== -1 && (min > max || max === 0))throw "From FrameC(): min must be > max(" + max + ") and > 0 but is " + min;
+
+
+ var options = new Array();
+ for(var i = 0; i != contents.length; ++i){
+ var topicPsis = new Array();
+ for(var j = 0; j != contents[i].length; ++j){
+ for(var k = 0; k != contents[i][j].length; ++k){
+ topicPsis.push(contents[i][j][k]);
+ }
+ }
+ options.push(topicPsis);
+ }
+
+ function checkValues(myself){
+ var rows = myself.getFrame().select("div");
+ var selectedItems = new Array();
+ // --- collects all old selected values and removes the option elements
+ for(var i = 0; i != rows.length; ++i){
+ var selects = rows[i].select("select");
+ if(selects[0].value.strip().length !== 0) selectedItems.push(selects[0].value);
+ selects[0].update("");
+ }
+
+ // --- recreates the original values
+ var values = options.clone();
+ for(var i = 0; i != rows.length && i != selectedItems.length; ++i){
+ var select = rows[i].select("select")[0];
+ var selectedIdx = new Array();
+ for(var j = 0; j != values.length; ++j){
+ if(values[j].indexOf(selectedItems[i]) !== -1){
+ for(var k = 0; k != values[j].length; ++k){
+ select.insert({"bottom" : new Element("option", {"value" : values[j][k]}).update(values[j][k])});
+ if(values[j][k] === selectedItems[i])select.writeAttribute({"selected" : "selected"});
+ //values = values.without(values[j]);
+ selectedIdx.push(j);
+ }
+ break;
+ }
+ }
+ var cleanedValues = new Array();
+ for(var k = 0; k != values.length; ++k){
+ if(selectedIdx.indexOf(k) === -1){
+ cleanedValues.push(values[k]);
+ }
+ }
+ values = cleanedValues;
+ }
+
+ // --- fills all empty select elements
+ for(var i = 0; i != rows.length; ++i){
+ var select = rows[i].select("select")[0];
+ if(select.childElements().length === 0 && values.length !== 0){
+ for(var j = 0; j != values[0].length; ++j){
+ select.insert({"bottom" : new Element("option", {"value" : values[0][j]}).update(values[0][j])});
+ }
+ values.shift();
+ }
+ }
+
+ // --- adds the values which wasn't distributed
+ for(var i = 0; i != rows.length; ++i){
+ var select = rows[i].select("select")[0];
+ for(var j = 0; j != values.length; ++j){
+ for(var k = 0; k != values[j].length; ++k){
+ select.insert({"bottom" : new Element("option" , {"value" :values[j][k]}).update(values[j][k])});
+ }
+ }
+ }
+ }// checkValues
+
+
+ function addHandlers(myself){
+ var rows = myself.getFrame().select("div");
+ checkValues(myself);
+
+ function addHandler(event){
+ var div = new Element("div", {"class" : CLASSES.selectrowWithRemoveButton()});
+ myself.getFrame().insert({"bottom" : div});
+ var select = new Element("select");
+ div.insert({"top" : select});
+ addHandlers(myself);
+ }
+
+ function removeHandler(event){
+ event.element().up().remove();
+ addHandlers(myself);
+ }
+
+ for(var i = 0; i != rows.length; ++i){
+ var spans = rows[i].select("span." + CLASSES.clickable());
+ var removeS = null;
+ var addS = null;
+ if(spans.length === 0){
+ removeS = new Element("span", {"class" : CLASSES.clickable()}).update("-");
+ removeS.observe("click", removeHandler);
+ addS = new Element("span", {"class" : CLASSES.clickable()}).update("+");
+ addS.observe("click", addHandler);
+ rows[i].insert({"top" : removeS});
+ rows[i].insert({"bottom" : addS});
+ }
+ else {
+ removeS = spans[0];
+ addS = spans[1];
+ }
+
+ if(max === -1 || max > rows.length){
+ addS.show()
+ }
+ else {
+ addS.hide();
+ }
+
+ if(min !== -1 || min < rows.length){
+ removeS.show()
+ rows[i].writeAttribute({"class" : CLASSES.selectrowWithRemoveButton()});
+ }
+ else {
+ removeS.hide();
+ rows[i].writeAttribute({"class" : CLASSES.selectrowWithoutRemoveButton()});
+ }
+ if(i == 0 && rows.length === 1 && max > 1){
+ rows[i].writeAttribute({"class" : CLASSES.selectrowWithoutRemoveButton()});
+ removeS.hide();
+ }
+ }
+ } // addHandlers
+
+ for(var i = 0; i != (min === -1 ? 1 : min); ++i){
+ var div = new Element("div", {"class" : CLASSES.selectrowWithoutRemoveButton()});
+ var select = new Element("select");
+ for(var j = 0; j != options.length; ++j){
+ if(j === i || j > min){
+ for(var k = 0; k != options[j].length; ++k){
+ select.insert({"bottom" : new Element("option", {"value" : options[j][k]}).update(options[j][k])});
+ }
+ }
+ }
+
+
+ div.insert({"top" : select});
+ this.getFrame().insert({"bottom" : div});
+ addHandlers(this);
+ }
+ },
+ "getContent" : function(unique, removeNull){
+ // --- unique and removeNull aren't be used, they exist only for consistency
+ var values = new Array();
+ var rows = this.getFrame().select("div");
+ for(var i = 0; i != rows.length; ++i){
+ values.push(new Array(rows[i].select("select")[0].value)); // must be a list of lists
+ }
+ return values;
+ }
+ });
+
+
+
+// --- Representation of a variant element
+var VariantC = Class.create(ContainerC, {"initialize" : function($super, contents, owner){
+ $super();
+ if(!owner.__frames__) owner.__frames__ = new Array();
+ owner.__frames__.push(this);
+ this.__frame__.writeAttribute({"class" : CLASSES.variantFrame()});
+ this.__table__ = new Element("table", {"class" : CLASSES.variantFrame()});
+ this.__frame__.insert({"top" : this.__table__});
+
+ try{
+ // --- control row + itemIdentity
+ makeControlRow(this, 4, contents ? contents.itemIdentities : null);
+ checkRemoveAddButtons(owner, 1, -1);
+ setRemoveAddHandler(this, owner, 1, -1, function(){
+ return new VariantC(null, owner);
+ });
+
+ // --- scopes
+ this.__scopes__ = null;
+ //TODO: implement -> also in the server
+ this.__table__.insert({"bottom" : newRow(CLASSES.scopeFrame(), "Scope", new Element("div"))});
+
+ // --- resourceValue
+ var value = "";
+ var datatype = "";
+ if(contents && contents.resourceRef && contents.resourceRef.length !== 0){
+ value = contents.resourceRef;
+ datatype = ANY_URI;
+ }
+ else if(contents && contents.resourceData){
+ value = contents.resourceData.value;
+ datatype = contents.resourceData.datatype;
+ }
+
+ this.__value__ = new Element("textarea", {"rows" : 3}).update(value);
+ this.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Resource Value", this.__value__)});
+
+ // --- datatype
+ this.__datatype__ = new Object();
+ new TextrowC(datatype, ".*", this.__datatype__, 1, 1, null);
+ this.__table__.insert({"bottom" : newRow(CLASSES.datatypeFrame(), "Datatype", this.__datatype__.__frames__[0].getFrame())});
+
+ // --- minimize
+ this.minimize();
+ }
+ catch(err){
+ alert("From VariantC(): " + err);
+ }
+ },
+ "getContent" : function(){
+ var resourceRef = null;
+ var resourceData = null;
+ if(this.__datatype__.__frames__[0].getContent() === ANY_URI){
+ resourceRef = this.__value__.textContent.strip();
+ }
+ else {
+ var datatype = STRING;
+ if(this.__datatype__.__frames__[0].getContent().strip() !== "")
+ datatype = this.__datatype__.__frames__[0].getContent().strip();
+ resoureceData = {"datatype" : datatype, "value" : this.__value__.textContent.strip()};
+ }
+
+ // TODO: scopes
+ if(this.__itemIdentity__.getContent(true, true).length === 0 &&
+ resourceRef === null && resourceData === null) return null;
+ return {"itemIdentities" : this.__itemIdentity__.getContent(true, true),
+ "scopes" : null,
+ "resourceRef" : resourceRef,
+ "resourceData" : resourceData};
+
+ },
+ "toJSON" : function(){
+ var resourceRef = null;
+ var resourceData = null;
+ if(this.__datatype__.__frames__[0].getContent() === ANY_URI){
+ resourceRef = this.__value__.value.strip().toJSON();
+ }
+ else {
+ var datatype = STRING.toJSON();
+ if(this.__datatype__.__frames__[0].getContent().strip() !== "")
+ datatype = this.__datatype__.__frames__[0].getContent().strip().toJSON();
+ resourceData = "{\"datatype\":" + datatype + ",\"value\":" + this.__value__.value.strip().toJSON() + "}";
+ }
+
+ // TODO: scopes
+ return "{\"itemIdentities\":" + this.__itemIdentity__.toJSON(true, true) +
+ ",\"scopes\":null,\"resourceRef\":" + resourceRef + ",\"resourceData\":" + resourceData + "}";
+
+ },
+ "isValid" : function(){
+ return this.__value__.value.strip() !== "";
+ },
+ "isUsed" : function(){
+ return (this.__itemIdentity__.getContent(true, true).length !== 0 ||
+ this.__value__.value.strip() !== "" || this.__datatype__.__frames__[0].getContent().strip() !== "");
+ },
+ "showRemoveButton" : function(){
+ this.__remove__.show();
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ },
+ "showAddButton" : function(){
+ this.__add__.show();
+ },
+ "hideAddButton" : function(){
+ this.__add__.hide();
+ },
+ "minimize" : function(){
+ var trs = this.__table__.select("tr");
+ for(var i = 0; i != trs.length; ++i){
+ if(i === 0) trs[i].show();
+ else trs[i].hide();
+ }
+ }
+ });
+
+
+// --- contains all variants of a name element
+var VariantContainerC = Class.create(ContainerC, {"initialize" : function($super, contents){
+ $super();
+ this.__frame__.writeAttribute({"class" : CLASSES.variantContainer()});
+ this.__container__ = new Object();
+
+ if(contents && contents.length != 0){
+ for(var i = 0; i != contents.length; ++i){
+ var variant = new VariantC(contents[i], this.__container__);
+ this.__frame__.insert({"bottom" : variant.getFrame()});
+ }
+ }
+ else {
+ var variant = new VariantC(null, this.__container__);
+ this.__frame__.insert({"bottom" : variant.getFrame()});
+ }
+ },
+ "getContent" : function(){
+ var values = new Array();
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ if(this.__container__.__frames__[i].isUsed() === true){
+ values.push(this.__container__.__frames__[i].getContent());
+ }
+ }
+ return values;
+ },
+ "isValid" : function(){
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ if(this.__container__.__frames__[i].isUsed() === true &&
+ this.__container__.__frames__[i].isValid() === false) return false;
+ }
+ return true;
+ },
+ "toJSON" : function(){
+ var str = "[";
+ for(var i = 0; i != this.__container__.__frames__.length; ++i){
+ if(this.__container__.__frames__[i].isUsed() === true){
+ str += this.__container__.__frames__[i].toJSON();
+ }
+ if(i < this.__container__.__frames__.length - 1){
+ str += ","
+ }
+ }
+ str += "]";
+ return str === "[]" ? null : str;
+ }});
+
+
+// --- representation of a name element
+var NameC = Class.create(ContainerC, {"initialize" : function($super, contents, nametypescopes, simpleConstraint, owner, min, max, cssTitle){
+ $super();
+ if(!owner) throw "From NameC(): owner must be set but is null";
+ if(max !== -1 && (min > max || max === 0))throw "From FrameC(): min must be > max(" + max + ") and > 0 but is " + min;
+ if(!owner.__frames__) owner.__frames__ = new Array();
+ owner.__frames__.push(this);
+
+ this.__frame__.writeAttribute({"class" : CLASSES.nameFrame()});
+ this.__table__ = new Element("table", {"class" : CLASSES.nameFrame()});
+ this.__frame__.insert({"top" : this.__table__});
+
+ try{
+ // --- control row + ItemIdentity
+ makeControlRow(this, 5, contents ? contents.itemIdentities : null);
+ checkRemoveAddButtons(owner, min, max);
+ setRemoveAddHandler(this, owner, min, max, function(){
+ return new NameC(null, nametypescopes, simpleConstraint, owner, min, max, cssTitle);
+ });
+
+ // --- type
+ var types = new Array();
+ for(var i = 0; nametypescopes && i !== nametypescopes.length; ++i){
+ for(j = 0; j != nametypescopes[i].nameType.length; ++j){
+ types.push(nametypescopes[i].nameType[j]);
+ if(contents && contents.type && contents.type[0] === nametypescopes[i].nameType[j]){
+ var sslected = nametypescopes[i].nameType[j];
+ types[types.length - 1] = types[0];
+ types[0] = selected;
+ }
+ }
+ }
+ this.__type__ = new Object();
+ var tr = newRow(CLASSES.typeFrame(), "Type", new SelectrowC(types, this.__type__, 1, 1).getFrame());
+ this.__table__.insert({"bottom" : tr});
+
+ // --- scopes
+ this.__scopes__ = null;
+ if(nametypescopes && nametypescopes[0].scopeConstraints){
+ // TODO: pass the selected items seperately to the object, so they can be chosen as default
+ var scopeTypes = nametypescopes[0].scopeConstraints[0].scopeTypes;
+ var min = parseInt(nametypescopes[0].scopeConstraints[0].cardMin);
+ var max = nametypescopes[0].scopeConstraints[0].cardMax !== "MAX_INT" ? parseInt(nametypescopes[0].scopeConstraints[0].cardMax) : "*";
+ this.__scopes__ = new ScopeC(scopeTypes, min === 0 ? 1 : min, max === "*" ? -1 : max);
+ tr = newRow(CLASSES.scopeFrame(), "Scope", this.__scopes__.getFrame());
+ this.__table__.insert({"bottom" : tr});
+ }
+ else {
+ var tr = new Element("tr", {"class" : CLASSES.scopeFrame()});
+ var tdd = new Element("td", {"class" : CLASSES.description()}).update("Scope");
+ var tdc = new Element("td", {"class" : CLASSES.content()});
+ tr.insert({"top" : tdd});
+ tr.insert({"bottom" : tdc});
+ this.__table__.insert({"bottom" : tr});
+ }
+
+ // --- value
+ this.__value__ = new Object();
+ var cssTitleV = "min: " + min + " max: " + max + " regular expression: " + (simpleConstraint ? simpleConstraint.regexp : ".*");
+ new TextrowC((contents && contents.value ? contents.value : ""), (simpleConstraint ? simpleConstraint.regexp : ".*"), this.__value__, 1, 1, cssTitleV);
+ this.__table__.insert({"bottom" : newRow(CLASSES.valueFrame(), "Value", this.__value__.__frames__[0].getFrame())});
+
+ // --- variants
+ this.__variants__ = new VariantContainerC(contents? contents.variants : null);
+ this.__table__.insert({"bottom" : newRow(CLASSES.variantContainer(), "Variants", this.__variants__.getFrame())});
+
+ // --- adds a second show handler, so the variants will be hidden, when the entire
+ // --- name element will be shown
+ function addSecondShowHandler(myself){
+ myself.__table__.select("tr")[0].observe("click", function(event){
+ try{
+ for(var i = 0; i != myself.__variants__.__container__.__frames__.length; ++i){
+ myself.__variants__.__container__.__frames__[i].minimize();
+ }
+ }catch(tmp){ alert(tmp);}
+ });
+ }
+
+ addSecondShowHandler(this);
+ }
+ catch(err){
+ alert("From NameC(): " + err);
+ }
+ },
+ "getContent" : function(){
+ if(this.isUsed() === false) return null;
+ return {"itemIdentities" : this.__itemIdentity__.getContent(true, true),
+ "scopes" : this.__scopes__.getContent(),
+ "value" : this.__value__.__frames__[0].getContent(),
+ "variants" : this.__variants__.getContent()};
+ },
+ "toJSON" : function(){
+ if(this.isUsed() === false) return "null";
+ return "{\"itemIdentities\":" + this.__itemIdentity__.toJSON(true, true) +
+ ",\"type\":[" + this.__type__.__frames__[0].toJSON() +
+ "],\"scopes\":" + (this.__scopes__ ? this.__scopes__.toJSON() : "null") +
+ ",\"value\":" + this.__value__.__frames__[0].toJSON() +
+ ",\"variants\":" + this.__variants__.toJSON() + "}";
+ },
+ "isUsed" : function(){
+ return this.__itemIdentity__.getContent(true, true).length !== 0 ||
+ this.__value__.__frames__[0].getContent().strip().length !== 0 ||
+ this.__variants__.getContent().length !== 0;
+ },
+ "showRemoveButton" : function(){
+ this.__remove__.show();
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ },
+ "showAddButton" : function(){
+ this.__add__.show();
+ },
+ "hideAddButton" : function(){
+ this.__add__.hide();
+ },
+ "isValid" : function(){
+ // TODO: check the content and the constraints + variants.isValid()
+ return true;
+ }});
+
+
+
+// --- contains all names of a topic
+var NameContainerC = Class.create(ContainerC, {"initialize" : function($super, contents, constraints){
+ $super();
+ this.__frame__.writeAttribute({"class" : CLASSES.nameContainer()});
+ this.__containers__ = new Array();
+
+ try{
+ if((!contents || contents.length === 0) && constraints && constraints.length > 0){
+ for(var i = 0; i != constraints.length; ++i){
+ this.__containers__.push(new Array());
+ for(var j = 0; j != constraints[i].constraints.length; ++j){
+ this.__containers__[i].push(new Object());
+ var min = parseInt(constraints[i].constraints[j].cardMin);
+ var max = constraints[i].constraints[j].cardMax !== "MAX_INT" ? parseInt(constraints[i].constraints[j].cardMax) : "*";
+ var regexp = constraints[i].constraints[j].regexp;
+ if(max !== 0){
+ var title = "min: " + min + " max: " + max + " regular expression: " + constraints[i].regexp;
+ var name = new NameC("", constraints[i].nametypescopes, constraints[i].constraints[j],
+ this.__containers__[i][j], min === 0 ? 1 : min, max === "*" ? -1 : max, title);
+ this.__error__.insert({"before" : name.getFrame()});
+ }
+ }
+ }
+ }
+ else {
+ // TODO: check already existing contents and order them to the corresponding fields
+ }
+ }
+ catch(err){
+ alert("From NameContainerC(): " + err);
+ }
+ },
+ "getContent" : function(){
+ var values = new Array();
+ for(var i = 0; i != this.__containers__.length; ++i){
+ for(var j = 0; j != this.__containers__[i].length; ++j){
+ for(var k = 0; k != this.__containers__[i][j].__frames__.length; ++k){
+ if(this.__containers__[i][j].__frames__[k].isUsed() === true){
+ values.push(this.__containers__[i][j].__frames__[k].getContent());
+ }
+ }
+ }
+ }
+ return values;
+ },
+ "toJSON" : function(){
+ var str = "[";
+ for(var i = 0; i != this.__containers__.length; ++i){
+ for(var j = 0; j != this.__containers__[i].length; ++j){
+ for(var k = 0; k != this.__containers__[i][j].__frames__.length; ++k){
+ if(this.__containers__[i][j].__frames__[k].isUsed() === true){
+ str += this.__containers__[i][j].__frames__[k].toJSON() + ",";
+ }
+ }
+ }
+ }
+ if(str.endsWith(",")) str = str.slice(0, str.length - 1);
+ str += "]";
+ return str === "[]" ? null : str;
+ },
+ "isValid" : function(){
+ // TODO: check the validity of this frame with the passed constraints and return a boolean value + isValid() of all names
+ return true;
+ }});
+
+
+
+var OccurrenceC = Class.create(ContainerC, {"initialize" : function($super, contents, constraints, owner, min, max, cssTitl){
+
+},
+ "getContent" : function(){
+ // TODO: implement
+ },
+ "toJSON" : function(){
+ // TODO: implement
+ },
+ "isUsed" : function(){
+ // TODO: implement
+ },
+ "showRemoveButton" : function(){
+ this.__remove__.show();
+ },
+ "hideRemoveButton" : function(){
+ this.__remove__.hide();
+ },
+ "showAddButton" : function(){
+ this.__add__.show();
+ },
+ "hideAddButton" : function(){
+ this.__add__.hide();
+ },
+ "isValid" : function(){
+ // TODO: check the content and the constraints
+ return true;
+ }});
+
+
+
+var OccurrenceContainerC = Class.create(ContainerC, {"initialize" : function($super, contents, constraints){
+
+},
+ "isValid" : function(){
+ // TODO: implement this method
+ return true;
+ },
+ "getContent" : function(){
+ // TODO: implement this method
+ },
+ "toJSON" : function(){
+ // TODO: implement this method
+ }});
+
+
+
+
+
+var TopicC = Class.create(ContainerC, {"initialize" : function($super, content, constraints){
+ $super();
+ try{
+ this.__frame__ .writeAttribute({"class" : CLASSES.topicFrame()});
+ this.__table__ = new Element("table", {"class" : CLASSES.topicFrame()});
+ this.__frame__.insert({"top" : this.__table__});
+ this.__caption__ = new Element("caption").update("Topic");
+ this.__table__.insert({"top" : this.__caption__});
+
+ // --- topic id
+ this.__topicid__ = new Object();
+ new TextrowC((content ? content.topicid : null), ".*", this.__topicid__, 1, 1, null);
+ this.__table__.insert({"bottom" : newRow(CLASSES.topicIdFrame(), "Topic ID", this.__topicid__.__frames__[0].getFrame())});
+
+ // --- itemIdentity
+ this.__itemIdentity__ = new ItemIdentityC(content ? content.itemIdentities : null);
+ this.__table__.insert({"bottom" : newRow(CLASSES.itemIdentityFrame(), "ItemIdentity", this.__itemIdentity__.getFrame())});
+
+ // --- subjectLocator
+ var _contents = (content ? content.subjectLocators : null);
+ var _constraints = (constraints ? constraints.subjectLocatorConstraints : null);
+ this.__subjectLocator__ = new IdentifierC(_contents, _constraints, CLASSES.subjectLocatorFrame());
+ this.__table__.insert({"bottom" : newRow(CLASSES.subjectLocatorFrame(), "SubjectLocator", this.__subjectLocator__.getFrame())});
+
+ // --- subjectIdentifier
+ _contents = (content ? content.subjectIdentifiers : null);
+ _constraints = (constraints ? constraints.subjectIdentifierConstraints : null);
+ this.__subjectIdentifier__ = new IdentifierC(_contents, _constraints, CLASSES.subjectIdentifierFrame());
+ this.__table__.insert({"bottom" : newRow(CLASSES.subjectIdentifierFrame(), "SubjectIdentifier", this.__subjectIdentifier__.getFrame())});
+
+ // --- names
+ _contents = (content ? content.names : null);
+ _constraints = (constraints ? constraints.topicNameConstraints : null);
+ this.__name__ = new NameContainerC(_contents, _constraints);
+ this.__table__.insert({"bottom" : newRow(CLASSES.nameContainer(), "Names", this.__name__.getFrame())});
+
+
+
+
+
+
+
+
+
+
+ var tmp = new Element("input", {"type" : "button", "value" : "test"});
+ function tester(myself){
+ tmp.observe("click", function(event){
+ //alert(myself.__subjectLocator__.getContent() + " -> " + myself.__subjectLocator__.toJSON() + "\n\n" + myself.__subjectLocator__.getContent(true, true) + " -> " + myself.__subjectLocator__.toJSON(true, true));
+
+ });
+ };
+ tester(this);
+ this.__frame__.insert({"bottom" : tmp});
+ }catch(err){
+ alert("From TopciC(): " + err);
+ }
+ },
+ "getContent" : function(){
+ return {"id" : this.__topicid__.__frames__[0].getContent };
+ }
+ });
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// --- helper function to create a dom-fragment of the form
+// --- <tr class="rowClass"><td class="description">description</td>
+//---- <td class="content">content</td></tr>
+function newRow(rowClass, description, content){
+ var tr = new Element("tr", {"class" : rowClass});
+ tr.insert({"top" : new Element("td", {"class" : CLASSES.description()}).update(description)});
+ tr.insert({"bottom" : new Element("td", {"class" : CLASSES.content()}).update(content)});
+ return tr;
+}
+
+
+// --- Helper function for the constructors of all classes
+// --- of the type FrameC.
+// --- There will be set the remome and add handler.
+function setRemoveAddHandler(myself, owner, min, max, call){
+ myself.__remove__.stopObserving();
+ myself.__add__.stopObserving();
+ myself.__remove__.observe("click", function(event){
+ myself.remove();
+ owner.__frames__ = owner.__frames__.without(myself);
+ if(min >= owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].hideRemoveButton();
+ }
+ }
+ if(max > owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].showAddButton();
+ }
+ }
+ });
+
+ myself.__add__.observe("click", function(event){
+ var newElem = call();
+ myself.append(newElem.getFrame());
+ if(remove === true && min !== -1 && owner.__frames__.length > min){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].showRemoveButton();
+ }
+ }
+ if(max > -1 && max <= owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].hideAddButton();
+ }
+ }
+ });
+}
+
+
+// --- Helper function for the constructors of all classes
+// --- of the type FrameC.
+// --- There will be checked the visibility of the remove and
+// --- add buttons.
+function checkRemoveAddButtons(owner, min, max){
+ if(min >= owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].hideRemoveButton();
+ }
+ }
+
+ if(min > -1 && min < owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].showRemoveButton();
+ }
+ }
+
+ if(max > -1 && max <= owner.__frames__.length){
+ for(var i = 0; i != owner.__frames__.length; ++i){
+ owner.__frames__[i].hideAddButton();
+ }
+ }
+}
+
+
+// --- creates a control row for NameC, OccurrenceC and VariantC with a nested ItemIdentity frame.
+function makeControlRow(myself, rowspan, contents)
+{
+ var tr = new Element("tr", {"class" : CLASSES.itemIdentityFrame()});
+ var tdCtrl = new Element("td", {"class" : CLASSES.controlColumn(), "rowspan" : rowspan});
+ tr.insert({"top" : tdCtrl})
+ var tdDesc = new Element("td", {"class" : CLASSES.description()}).update("ItemIdentity");
+ tr.insert({"bottom" : tdDesc});
+ var min = new Element("span", {"class" : CLASSES.clickable()}).update("«");
+ myself.__min__ = min;
+ myself.__remove__ = new Element("span", {"class" : CLASSES.clickable()}).update("-");
+ myself.__add__ = new Element("span", {"class" : CLASSES.clickable()}).update("+");
+ tdCtrl.insert({"top" : min});
+ tdCtrl.insert({"bottom" : "<br/>"});
+ tdCtrl.insert({"bottom" : myself.__remove__});
+ tdCtrl.insert({"bottom" : "<br/>"});
+ tdCtrl.insert({"bottom" : myself.__add__});
+ var tdCont = new Element("td", {"class" : CLASSES.content()});
+ tr.insert({"bottom" : tdCont});
+ myself.__itemIdentity__ = new ItemIdentityC(contents ? contents.itemIdentities : null);
+ tdCont.insert({"top" : myself.__itemIdentity__.getFrame()});
+ myself.__table__.insert({"bottom" : tr});
+
+ var trCtrl = new Element("tr", {"class" : CLASSES.showHiddenRows()});
+ trCtrl.insert({"top" : new Element("td", {"class" : CLASSES.clickable()}).update("»")});
+ myself.__table__.insert({"top" : trCtrl});
+ trCtrl.hide();
+ trCtrl.observe("click", function(){
+ var trs = myself.__table__.select("tr");
+ for(var i = 0; i != trs.length; ++i) trs[i].show();
+ trCtrl.hide();
+ });
+
+ // --- min click-handler
+ min.observe("click", function(event){
+ var trs = myself.__table__.select("tr");
+ for(var i = 0; i != trs.length; ++i){
+ if(i === 0) trs[i].show();
+ else trs[i].hide();
+ }
+ });
+}
\ No newline at end of file
Added: trunk/src/ajax/javascripts/edit.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/edit.js Tue May 19 05:23:26 2009
@@ -0,0 +1,18 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+
+function makeEdit(psi)
+{
+ var content = new Element("div", {"class" : CLASSES.content()});
+ var header = new Element("h1").update("Edit a Topic");
+ $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+}
Modified: trunk/src/ajax/javascripts/home.js
==============================================================================
--- trunk/src/ajax/javascripts/home.js (original)
+++ trunk/src/ajax/javascripts/home.js Tue May 19 05:23:26 2009
@@ -10,265 +10,9 @@
//+-----------------------------------------------------------------------------
-// --- with this object there will be set the first and last index of topics to get by the ajax request
-// --- further this object handles out of range violations and some other site effects, e.g.
-// --- topicsPerPage === -1 -> show all topics, ...
-var __idx = {"firstIdx" : 0, "lastIdx" : 10, "lastDirectionForward" : true, "topicsPerPage" : 10, "outOfRange" : false,
- "topicPerPageVals" : ["5", "10", "15", "25", "50", "100", "200", "300", "All"],
- "getTopicPerPageVals" : function(){ return this.topicPerPageVals; },
- "getFirstIdx" : function(){ return this.firstIdx; },
- "setFirstIdx" : function(x) { if(typeof(x) === "number" && x >= 0) this.firstIdx = x; },
- "getLastIdx" : function(){ return this.lastIdx; },
- "setLastIdx" : function(x) { if(typeof(x) === "number" && x >= 0) this.lastIdx = x; },
- "getLastDirectionForward" : function() { return this.lastDirectionForward; },
- "setLastDirectionForward" : function(x) { if(typeof(x) === "boolean") this.lastDirectionForward = x; },
- "getTopicsPerPage" : function() {return (this.topicsPerPage === -1 ? "nil" : this.topicsPerPage); },
- "getTopicsPerPageAsNumber" : function(){ return this.topicsPerPage; },
- "setTopicsPerPage" : function(x) {
- if(typeof(x) === "number" && x > 0){
- this.topicsPerPage = x;
- this.lastIdx = this.firstIdx + this.topicsPerPage;
- }
- else if(typeof(x) === "number" && x === -1){
- this.topicsPerPage = x;
- this.lastIdx = "nil";
- }
- },
- "getOutOfRange" : function() { return this.outOfRange; },
- "setOutOfRange" : function(x){ if(typeof(x) === "boolean") this.outOfRange = x; },
- "next" : function() {
- if(this.outOfRange) return;
- this.firstIdx += this.topicsPerPage;
- if(this.topicsPerPage !== -1){ this.lastIdx = this.firstIdx + this.topicsPerPage; }
- else { this.lastIdx = "nil"; }
- this.lastDirectionForward = true;
- },
- "prev" : function() {
- if(this.topicsPerPage !== -1){
- this.firstIdx -= this.topicsPerPage;
- if(this.firstIdx < 0)this.firstIdx = 0;
- this.lastIdx = this.firstIdx + this.topicsPerPage;
- }
- else {
- this.firstIdx = 0;
- this.lastIdx = "nil";
- }
- this.lastDirectionForward = false;
- }
- };
-
-
-
-// --- creates a html table with the id "tableId" and appends it on the element with the id
-// --- "parentId", if the variable next ist set to true there will be shown the next
-// --- topics otherwise the previous topics
-// --- the table looks like the following schema:
-// --- itemIdentity | subjectLocator | subjectIdentifier | instanceOf | name | occurrence
-function makeHome(parentId, tableId, next)
+function makeHome()
{
- // --- create the ajax-request handlers ------------------------------------
- function onSuccessHandler(xhr)
- {
- // --- creates the navigation div-element with a forward-, backward- button and a
- // --- selection box where the user can choose the amount of topics per page
- function createTableNavi(top)
- {
- // --- creates the backwards and forwards buttons, if they don't exist
- if(($("naviDivTop") === null && top === true) || ($("naviDivBottom") === null && top === false) && $(parentId)){
- var div = new Element("div", {"id" : (top ? "naviDivTop" : "naviDivBottom"), "class" : "naviTopicTable " + PAGES.home});
- var lftBtn = new Element("input", {"type" : "button", "id" : (top ? "topicTableLftBtnTop" : "topicTableLftBtnBottom")});
- var rgtBtn = new Element("input", {"type" : "button", "id" : (top ? "topicTableRgtBtnTop" : "topicTableRgtBtnBottom")});
- lftBtn.value = "<<";
- rgtBtn.value = ">>";
- rgtBtn.setStyle({"float" : "right"});
- lftBtn.setStyle({"float" : "left"});
- div.insert(lftBtn, {"position" : "top"});
- div.insert(rgtBtn, {"position" : "bottom"});
- $("content").insert(div, {"position" : "top"});
-
- rgtBtn.observe("click", function(event)
- {
- __idx.next();
- makeHome(parentId, tableId, true);
- });
- lftBtn.observe("click", function(event)
- {
- __idx.prev();
- makeHome(parentId, tableId, false);
- });
-
- var select = new Element("select", {"id" : (top === true ? "topicTableSelectTop" : "topicTableSelectBottom"), "class" : "topicTable"});
- var selectValues = __idx.getTopicPerPageVals();
- var selectInnerHTML = "";
- selectValues.each(function(value, idx)
- {
- var numberValue = value;
- numberValue = (numberValue === "All" ? "-1" : numberValue);
- if(Number(numberValue) !== __idx.getTopicsPerPageAsNumber()){
- select.insert(new Element("option", {"value" : numberValue}).update(value), {"position" : "bottom"});
- }
- else {
- select.insert(new Element("option", {"value" : numberValue, "selected" : "selected"}).update(value), {"position" : "bottom"});
- }
- });
- div.insert(select, {"position" : "content"});
-
- select.observe("change", function(event)
- {
- __idx.setTopicsPerPage(Number(event.element().value));
- makeHome(parentId, tableId, true);
- });
- }
- }
-
-
- try {
- var topicSummaries = xhr.responseText.evalJSON();
- // --- inserts or updates the topic table if there is some json data or
- // --- if there isn't a table yet
- if(topicSummaries !== null || $(tableId) === null){
- // --- removes the old table - if there exists an element with the id "tableId"
- if($(tableId) !== null)$(tableId).remove();
- if($("naviDivTop") !== null)$("naviDivTop").remove();
- if($("naviDivBottom") !== null)$("naviDivBottom").remove();
-
- createTableNavi(true);
-
- // --- creates the html table
- var topicTable = new Element("table", {"id" : "topicTable", "class" : PAGES.home});
-
- // --- creates the header row
- var header = new Element("tr");
- header.insert(new Element("th", {"id" : "itemIdentityTh"}).update("itemIdentity"), {"position" : "bottom"});
- header.insert(new Element("th", {"id" : "subjectLocatorTh"}).update("subjectLocator"), {"position" : "bottom"});
- header.insert(new Element("th", {"id" : "subjectIdentifierTh"}).update("subjectIdentifier"), {"position" : "bottom"});
- header.insert(new Element("th", {"id" : "instanceOfTh"}).update("instanceOf"), {"position" : "bottom"});
- header.insert(new Element("th", {"id" : "nameTh"}).update("name"), {"position" : "bottom"});
- header.insert(new Element("th", {"id" : "occurrenceTh"}).update("occurrence"), {"position" : "bottom"});
- topicTable.insert(header, {"position" : "top"});
-
- // --- creates the topic summary data of the json object
- if(topicSummaries !== null){
- topicSummaries.each(function(topicSummary, idx)
- {
- var tr = new Element("tr");
-
-
- var itemIdentity = new Element("td", {"class" : "topicSummaryTd"});
- var ul = new Element("ul", {"class" : "topicTable"});
- itemIdentity.insert(ul, {"position" : "top"});
- if(topicSummary.itemIdentities){
- topicSummary.itemIdentities.each(function(itemIdentityJ, innerIdx)
- {
- ul.insert(new Element("li").update(itemIdentityJ), {"position" : "bottom"});
- });
- }
-
- var subjectLocator = new Element("td", {"class" : "topicSummaryTd"});
- ul = new Element("ul", {"class" : "topicTable"});
- subjectLocator.insert(ul, {"position" : "top"});
- if(topicSummary.subjectLocators){
- topicSummary.subjectLocators.each(function(subjectLocatorJ, innerIdx)
- {
- ul.insert(new Element("li").update(subjectLocatorJ), {"position" : "bottom"});
- });
- }
-
- var subjectIdentifier = new Element("td", {"class" : "topicSummaryTd"});
- ul = new Element("ul", {"class" : "topicTable"});
- subjectIdentifier.insert(ul, {"position" : "top"});
- if(topicSummary.subjectIdentifiers){
- topicSummary.subjectIdentifiers.each(function(subjectIdentifierJ, innerIdx)
- {
- var li = new Element("li", {"class" : "clickable"}).update(subjectIdentifierJ);
- ul.insert(li, {"position" : "bottom"});
- li.observe("click", function(event)
- {
- var node = event.element();
- makePage(PAGES.edit, node.textContent);
- });
- });
- }
-
- var instanceOf = new Element("td", {"class" : "topicSummaryTd"});
- ul = new Element("ul", {"class" : "topicTable"});
- instanceOf.insert(ul, {"position" : "top"});
- if(topicSummary.instanceOfs){
- topicSummary.instanceOfs.each(function(instanceOfJ, innerIdx)
- {
- if(instanceOfJ){
- instanceOfJ.each(function(psi, psiIdx)
- {
- ul.insert(new Element("li").update(psi), {"position" : "top"});
- });
- }
- });
- }
-
- var name = new Element("td", {"class" : "topicSummaryTd"});
- ul = new Element("ul", {"class" : "topicTable"});
- name.insert(ul, {"position" : "top"});
- if(topicSummary.names){
- topicSummary.names.each(function(nameJ, innerIdx)
- {
- ul.insert(new Element("li").update(nameJ), {"position" : "top"});
- });
- }
-
- var occurrence = new Element("td", {"class" : "topicSummaryTd"});
- ul = new Element("ul", {"class" : "topicTable"});
- occurrence.insert(ul, {"position" : "top"});
- if(topicSummary.occurrences){
- topicSummary.occurrences.each(function(occurrenceJ, innerIdx)
- {
- ul.insert(new Element("li").update(occurrenceJ), {"position" : "top"});
- });
- }
-
- tr.insert(itemIdentity, {"position" : "bottom"});
- tr.insert(subjectLocator, {"position" : "bottom"});
- tr.insert(subjectIdentifier, {"position" : "bottom"});
- tr.insert(instanceOf, {"position" : "bottom"});
- tr.insert(name, {"position" : "bottom"});
- tr.insert(occurrence, {"position" : "bottom"});
-
- topicTable.insert(tr, {"position" : "bottom"});
- });
- }
- }
-
- // --- there was no data received or not all requested
- // --- so it's not allowed to increment the indices of the requested topics
- if(topicSummaries === null || topicSummaries.length != __idx.getTopicsPerPage()){
- __idx.setOutOfRange(true);
- }
- else {
- __idx.setOutOfRange(false);
- }
-
- // --- inserts the table in the parent element
- if($(parentId)){
- $(parentId).insert(topicTable, {"position" : "top"});
- }
- createTableNavi(false);
- }
- catch(err){
- window.alert("got bad json data from: " + SUMMARY_URL + "\n\n" + err);
- }
- }
-
-
- function onFailureHandler(xhr)
- {
- window.alert("something went wrong ...\n" + xhr.status + ": " + xhr.statusText);
- }
-
-
- // --- the real ajax request
- new Ajax.Request(SUMMARY_URL,
- {"method" : "get",
- "onSuccess" : onSuccessHandler,
- "onFailure" : onFailureHandler,
- "parameters" : {"start" : __idx.getFirstIdx(), "end" : __idx.getLastIdx()}
- });
-}
\ No newline at end of file
+ var content = new Element("div", {"class" : CLASSES.content()});
+ var header = new Element("h1").update("Topic Map Overview");
+ $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+}
Modified: trunk/src/ajax/javascripts/navi.js
==============================================================================
--- trunk/src/ajax/javascripts/navi.js (original)
+++ trunk/src/ajax/javascripts/navi.js Tue May 19 05:23:26 2009
@@ -13,49 +13,55 @@
// --- adds some event handlers to the navigation elements
function addHandlersToNavi()
{
- $(PAGES.home).observe("click", function(){ makePage(PAGES.home, ""); });
- $(PAGES.search).observe("click", function(){ makePage(PAGES.search, ""); });
- $(PAGES.edit).observe("click", function(){ makePage(PAGES.edit, ""); });
- $(PAGES.create).observe("click", function(){ makePage(PAGES.create, ""); });
+ $(PAGES.home).observe("click", function(event){ setNaviClasses(event.element()); makePage(PAGES.home, ""); });
+ $(PAGES.search).observe("click", function(event){ setNaviClasses(event.element()); makePage(PAGES.search, ""); });
+ $(PAGES.edit).observe("click", function(event){ setNaviClasses(event.element()); makePage(PAGES.edit, ""); });
+ $(PAGES.create).observe("click", function(event){ setNaviClasses(event.element()); makePage(PAGES.create, ""); });
// --- necessary for the first call of the page
- makePage(PAGES.home);
+ makePage(PAGES.home, "");
+}
+
+
+// --- Sets the classes of all navi-elements to the default class.
+// --- The currently clicked element is set to "isActive".
+function setNaviClasses(activeNaviElement)
+{
+ $(PAGES.home).writeAttribute({"class" : "clickableButton"});
+ $(PAGES.search).writeAttribute({"class" : "clickableButton"});
+ $(PAGES.edit).writeAttribute({"class" : "clickableButton"});
+ $(PAGES.create).writeAttribute({"class" : "clickableButton"});
+ activeNaviElement.writeAttribute({"class" : "isActive"});
}
// --- generates the current page depending on the variable __currentPage
function makePage(newPage, psi)
{
+ // --- if there is called the subpage which is already displayed
+ // --- there will be done nothing!
+ if(newPage === PAGES.current) return;
+ PAGES.current = newPage;
+
// --- removes the old content
- cleanPage(newPage);
+ $(CLASSES.subPage()).update();
// --- creates the new content
switch(newPage){
case PAGES.home:
- makeHome("content", "topicTable", true);
+ makeHome();
break;
case PAGES.search:
+ makeSearch(psi);
break;
case PAGES.edit:
- makeEdit(psi);
+ makeEdit(psi)
break;
case PAGES.create:
+ makeCreate(psi);
break;
}
}
-// --- removes all old DOM-Elements - if the page to create is not
-// --- the old page
-function cleanPage(newPage)
-{
- $("content").childElements().each(function(nodeToDelete, idx)
- {
- if(!nodeToDelete.hasClassName(newPage))
- nodeToDelete.remove();
- });
-}
-
-
-document.observe("dom:loaded", addHandlersToNavi);
-
+document.observe("dom:loaded", addHandlersToNavi);
\ No newline at end of file
Added: trunk/src/ajax/javascripts/requests.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/requests.js Tue May 19 05:23:26 2009
@@ -0,0 +1,55 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+
+// --- This is the default error handler of the used ajax.requests.
+function defaultFailureHandler(xhr)
+{
+ window.alert("Something went wrong by calling \"" + xhr.request.url + "\"\n" + xhr.status +
+ ": " + xhr.statusText + "\n" + xhr.responseText);
+}
+
+
+// --- Gets all type psis from the server.
+function getTypePsis(onSuccessHandler, onFailureHandler)
+{
+ try{
+ var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler;
+
+ new Ajax.Request(TYPE_PSIS_URL, {
+ "method" : "get",
+ "requestHeaders" : ["If-Modified-Since", "Thu, 1 Jan 1970 00:00:00 GMT"],
+ "onSuccess" : onSuccessHandler,
+ "onFailure" : onFailure});
+ }
+ catch(err){
+ alert("Could not request all type PSIs, please try again!\n\n" + err);
+ }
+}
+
+
+// --- Sends a post-request to the server with the passed psis as postBody.
+// --- Gets a constraint-object.
+function requestConstraints(psis, onSuccessHandler, onFailureHandler)
+{
+ try{
+ var onFailure = onFailureHandler ? onFailureHandler : defaultFailureHandler;
+
+ new Ajax.Request(TMCL_TYPE_URL, {
+ "method" : "post",
+ "postBody" : psis,
+ "onSuccess" : onSuccessHandler,
+ "onFailure" : onFailure});
+ }
+ catch(err){
+ alert("Could not request contraints, please try again!\n\n" + err);
+ }
+}
\ No newline at end of file
Added: trunk/src/ajax/javascripts/search.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/search.js Tue May 19 05:23:26 2009
@@ -0,0 +1,18 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+
+function makeSearch(psi)
+{
+ var content = new Element("div", {"class" : CLASSES.content()});
+ var header = new Element("h1").update("Search a Topic");
+ $(CLASSES.subPage()).insert((content.insert(header, {"position" : "bottom"})), {"position" : "bottom"});
+}
Added: trunk/src/ajax/javascripts/tmcl_tools.js
==============================================================================
--- (empty file)
+++ trunk/src/ajax/javascripts/tmcl_tools.js Tue May 19 05:23:26 2009
@@ -0,0 +1,66 @@
+//+-----------------------------------------------------------------------------
+//+ Isidorus
+//+ (c) 2008-2009 Marc Kuester, Christoph Ludwig, Lukas Giessmann
+//+
+//+ Isidorus is freely distributable under the LGPL license.
+//+ This ajax module uses the frameworks PrototypeJs and Scriptaculous, both
+//+ are distributed under the MIT license.
+//+ You can find a detailed description in trunk/docs/LGPL-LICENSE.txt and
+//+ in trunk/src/ajax/javascripts/external/MIT-LICENSE.txt.
+//+-----------------------------------------------------------------------------
+
+
+// --- Returns an Array of the type [<boolean>, <string>].
+// --- If there are exclusive-instance-constraints, the return value is an array
+// --- of the form [false, "message"] otherwise [true, ""].
+function checkExclusiveInstances(constraints, psis){
+ try{
+ var exc = constraints.topicConstraints.exclusiveInstances;
+ var ret = new Array();
+ for(var i = 0; i !== psis.length; ++i){
+ var currentArray = new Array(psis[i]);
+ for(var j = 0; j !== exc.length; ++j){
+ for(var k = 0; k !== exc[j].exclusives.length; ++k){
+ for(var l = 0; l !== exc[j].exclusives[k].length; ++l){
+ if(exc[j].exclusives[k][l] === psis[i]){
+ for(var m = 0; m != exc[j].owner.length; ++m){
+ currentArray.push(exc[j].owner[m]);
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if(currentArray.length > 1)ret.push(currentArray);
+ }
+ if(ret.length === 0) return null;
+ return ret;
+ }
+ catch(err){
+ return null;
+ }
+}
+
+
+// --- checks SubjectLocator and SubjectIdentifier contraints and contents
+function checkIdentifierConstraints(contents, constraints)
+{
+ var innerConstents = (!contents ? new Array() : contents);
+ if((!constraints || constraints.length === 0) && innerConstraints.length === 0) return false;
+
+ for(var i = 0; i != constraints.length; ++i){
+ var regexp = constraints[i].regexp;
+ var min = constraints[i].cardMin;
+ var max = constraints[i].cardMax;
+
+ var foundContents = 0;
+ for(var j = 0; j != innerContents.length; ++j){
+ var rex = new RegExp(regexp);
+ if(rex.match(innerContents[j]) === true) ++foundContents;
+ }
+
+ if(foundContents < min || foundContents > max) return false;
+ }
+ return true;
+}
\ 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 Tue May 19 05:23:26 2009
@@ -13,21 +13,32 @@
;; =============================================================================
;; --- all fragment constraints ------------------------------------------------
;; =============================================================================
-(defun get-constraints-of-fragment(topic-psi &key (treat-as 'type))
+(defun get-constraints-of-fragment(topic-psis &key (treat-as 'type))
+ "Returns a json string with all constraints of this topic-psis.
+ topic-psis must contain one item if it is treated as instance other wiese there can be more psis
+ then the fragment will be treated as an instanceOf all passed psis."
(let ((associationtype (get-item-by-psi *associationtype-psi*))
(associationtype-constraint (get-item-by-psi *associationtype-constraint-psi*))
- (topic
- (let ((psi
- (elephant:get-instance-by-value 'PersistentIdC 'uri topic-psi)))
- (when psi
- (identified-construct psi)))))
- (when topic
+ (topics nil))
+ (when (and (not (eql treat-as 'type))
+ (> (length topic-psis) 1))
+ (error "From get-constraints-of-fragment: when treat-as is set ot instance there must be exactly one item in topic-psis!"))
+
+ (loop for topic-psi in topic-psis
+ do (let ((psi
+ (elephant:get-instance-by-value 'PersistentIdC 'uri topic-psi)))
+ (if psi
+ (pushnew (identified-construct psi) topics)
+ (error "Topic \"~a\" not found!" topic-psi))))
+ (when topics
(let ((topic-constraints
(let ((value
- (get-constraints-of-topic topic :treat-as treat-as)))
+ (get-constraints-of-topic topics :treat-as treat-as)))
(concatenate 'string "\"topicConstraints\":" value))))
(let ((available-associations ;what's with association which have only a associationrole-constraint?
- (get-available-associations-of-topic topic :treat-as treat-as)))
+ (remove-duplicates
+ (loop for topic in topics
+ append (get-available-associations-of-topic topic :treat-as treat-as)))))
(dolist (item available-associations)
(topictype-p item associationtype associationtype-constraint))
(let ((associations-constraints
@@ -46,6 +57,40 @@
(concatenate 'string
"{" topic-constraints "," associations-constraints "}")))
json-string)))))))
+
+;(defun get-constraints-of-fragment(topic-psi &key (treat-as 'type))
+; (let ((associationtype (get-item-by-psi *associationtype-psi*))
+; (associationtype-constraint (get-item-by-psi *associationtype-constraint-psi*))
+; (topic
+; (let ((psi
+; (elephant:get-instance-by-value 'PersistentIdC 'uri topic-psi)))
+; (when psi
+; (identified-construct psi)))))
+; (when topic
+; (let ((topic-constraints
+; (let ((value
+; (get-constraints-of-topic topic :treat-as treat-as)))
+; (concatenate 'string "\"topicConstraints\":" value))))
+; (let ((available-associations ;what's with association which have only a associationrole-constraint?
+; (get-available-associations-of-topic topic :treat-as treat-as)))
+; (dolist (item available-associations)
+; (topictype-p item associationtype associationtype-constraint))
+; (let ((associations-constraints
+; (concatenate 'string "\"associationsConstraints\":"
+; (let ((inner-associations-constraints "["))
+; (loop for available-association in available-associations
+; do (let ((value
+; (get-constraints-of-association available-association)))
+; (setf inner-associations-constraints
+; (concatenate 'string inner-associations-constraints value ","))))
+; (if (string= inner-associations-constraints "[")
+; (setf inner-associations-constraints "null")
+; (setf inner-associations-constraints
+; (concatenate 'string (subseq inner-associations-constraints 0 (- (length inner-associations-constraints) 1)) "]")))))))
+; (let ((json-string
+; (concatenate 'string
+; "{" topic-constraints "," associations-constraints "}")))
+; json-string)))))))
;; =============================================================================
@@ -351,37 +396,77 @@
;; =============================================================================
;; --- all topic constraints ---------------------------------------------------
;; =============================================================================
-(defun get-constraints-of-topic (topic-instance &key(treat-as 'type))
- "Returns a constraint list with the constraints:
- subjectidentifier-constraints, subjectlocator-constraints,
- topicname-constraints, topicoccurrence-constraints and
- uniqueoccurrence-constraints."
- (let ((constraint-topics
- (get-all-constraint-topics-of-topic topic-instance :treat-as treat-as)))
+(defun get-constraints-of-topic (topic-instances &key(treat-as 'type))
+ "Returns a constraint list with the constraints:
+ subjectidentifier-constraints, subjectlocator-constraints,
+ topicname-constraints, topicoccurrence-constraints and
+ uniqueoccurrence-constraints.
+ topic-instances should be a list with exactly one item if trea-as is set to type
+ otherwise it can constain more items."
+ (declare (list topic-instances))
+ (when (and (> (length topic-instances) 1)
+ (not (eql treat-as 'type)))
+ (error "From get-constraints-of-topic: topic-instances must contain exactly one item when treated as instance!"))
+ (let ((abstract-topictype-constraints nil)
+ (exclusive-instance-constraints nil)
+ (subjectidentifier-constraints nil)
+ (subjectlocator-constraints nil)
+ (topicname-constraints nil)
+ (topicoccurrence-constraints nil)
+ (uniqueoccurrence-constraints nil))
+ (loop for topic-instance in topic-instances
+ do (let ((current-constraints
+ (get-all-constraint-topics-of-topic topic-instance :treat-as treat-as)))
+ (dolist (item (getf current-constraints :abstract-topictype-constraints))
+ (pushnew item abstract-topictype-constraints))
+ (dolist (item (getf current-constraints :exclusive-instance-constraints))
+ (let ((current-list
+ (list topic-instance (list item))))
+ (let ((found-item
+ (find current-list exclusive-instance-constraints :key #'first)))
+ (if found-item
+ (dolist (inner-item (second current-list))
+ (pushnew inner-item (second found-item)))
+ (push current-list exclusive-instance-constraints)))))
+ (dolist (item (getf current-constraints :subjectidentifier-constraints))
+ (pushnew item subjectidentifier-constraints))
+ (dolist (item (getf current-constraints :subjectlocator-constraints))
+ (pushnew item subjectlocator-constraints))
+ (dolist (item (getf current-constraints :topicname-constraints))
+ (pushnew item topicname-constraints))
+ (dolist (item (getf current-constraints :topicoccurrence-constraints))
+ (pushnew item topicoccurrence-constraints))
+ (dolist (item (getf current-constraints :uniqueoccurrence-constraints))
+ (pushnew item uniqueoccurrence-constraints))))
(let ((exclusive-instance-constraints
- (let ((value
- (get-exclusive-instance-constraints (getf constraint-topics :exclusive-instance-constraints))))
+ (let ((value "["))
+ (loop for exclusive-instance-constraint in exclusive-instance-constraints
+ do (setf value (concatenate 'string value
+ (get-exclusive-instance-constraints (first exclusive-instance-constraint)
+ (second exclusive-instance-constraint)) ",")))
+ (if (string= value "[")
+ (setf value "null")
+ (setf value (concatenate 'string (subseq value 0 (- (length value) 1)) "]")))
(concatenate 'string "\"exclusiveInstances\":" value)))
(subjectidentifier-constraints
(let ((value
- (get-simple-constraints (getf constraint-topics :subjectidentifier-constraints) :error-msg-constraint-name "subjectidentifier")))
+ (get-simple-constraints subjectidentifier-constraints :error-msg-constraint-name "subjectidentifier")))
(concatenate 'string "\"subjectIdentifierConstraints\":" value)))
(subjectlocator-constraints
(let ((value
- (get-simple-constraints (getf constraint-topics :subjectlocator-constraints) :error-msg-constraint-name "subjectlocator")))
+ (get-simple-constraints subjectlocator-constraints :error-msg-constraint-name "subjectlocator")))
(concatenate 'string "\"subjectLocatorConstraints\":" value)))
(topicname-constraints
(let ((value
- (get-topicname-constraints (getf constraint-topics :topicname-constraints))))
+ (get-topicname-constraints topicname-constraints)))
(concatenate 'string "\"topicNameConstraints\":" value)))
(topicoccurrence-constraints
(let ((value
- (get-topicoccurrence-constraints (getf constraint-topics :topicoccurrence-constraints)
- (getf constraint-topics :uniqueoccurrence-constraints))))
+ (get-topicoccurrence-constraints topicoccurrence-constraints uniqueoccurrence-constraints)))
(concatenate 'string "\"topicOccurrenceConstraints\":" value)))
(abstract-constraint
(concatenate 'string "\"abstractConstraint\":"
- (if (getf constraint-topics :abstract-constraint)
+ (if abstract-topictype-constraints
"true"
"false"))))
(let ((json-string
@@ -390,12 +475,50 @@
topicoccurrence-constraints "," abstract-constraint "}")))
json-string))))
-
-(defun get-exclusive-instance-constraints(exclusive-instances-lists)
- "Returns a list of psis which represents some topics."
+;(defun get-constraints-of-topic (topic-instances &key(treat-as 'type))
+; (let ((constraint-topics
+; (get-all-constraint-topics-of-topic topic-instance :treat-as treat-as)))
+; (let ((exclusive-instance-constraints
+; (let ((value
+; (get-exclusive-instance-constraints (getf constraint-topics :exclusive-instance-constraints))))
+; (concatenate 'string "\"exclusiveInstances\":" value)))
+; (subjectidentifier-constraints
+; (let ((value
+; (get-simple-constraints (getf constraint-topics :subjectidentifier-constraints) :error-msg-constraint-name "subjectidentifier")))
+; (concatenate 'string "\"subjectIdentifierConstraints\":" value)))
+; (subjectlocator-constraints
+; (let ((value
+; (get-simple-constraints (getf constraint-topics :subjectlocator-constraints) :error-msg-constraint-name "subjectlocator")))
+; (concatenate 'string "\"subjectLocatorConstraints\":" value)))
+; (topicname-constraints
+; (let ((value
+; (get-topicname-constraints (getf constraint-topics :topicname-constraints))))
+; (concatenate 'string "\"topicNameConstraints\":" value)))
+; (topicoccurrence-constraints
+; (let ((value
+; (get-topicoccurrence-constraints (getf constraint-topics :topicoccurrence-constraints)
+; (getf constraint-topics :uniqueoccurrence-constraints))))
+; (concatenate 'string "\"topicOccurrenceConstraints\":" value)))
+; (abstract-constraint
+; (concatenate 'string "\"abstractConstraint\":"
+; (if (getf constraint-topics :abstract-topictype-constraints)
+; "true"
+; "false"))))
+; (let ((json-string
+; (concatenate 'string "{" exclusive-instance-constraints "," subjectidentifier-constraints
+; "," subjectlocator-constraints "," topicname-constraints ","
+; topicoccurrence-constraints "," abstract-constraint "}")))
+; json-string))))
+
+
+(defun get-exclusive-instance-constraints(owner exclusive-instances-lists)
+ "Returns a JSON-obejct of the following form:
+ {owner: [psi-1, psi-2], exclusives: [[psi-1-1, psi-1-2], [psi-2-1, <...>], <...>]}."
(let ((constraint-role (get-item-by-psi *constraint-role-psi*))
(applies-to (get-item-by-psi *applies-to-psi*))
- (topictype-role (get-item-by-psi *topictype-role-psi*)))
+ (topictype-role (get-item-by-psi *topictype-role-psi*))
+ (topictype (get-item-by-psi *topictype-psi*))
+ (topictype-constraint (get-item-by-psi *topictype-constraint-psi*)))
(let ((topics
(remove-duplicates
(loop for exclusive-instances-list in exclusive-instances-lists
@@ -408,10 +531,13 @@
append (loop for other-role in (roles (parent role))
when (and (eq topictype-role (instance-of other-role))
(not (eq owner (player other-role))))
- collect (player other-role)))))))))
- (json:encode-json-to-string (map 'list #'(lambda(y)
- (map 'list #'uri y))
- (map 'list #'psis topics))))))
+ ;collect (player other-role)))))))))
+ append (getf (list-subtypes (player other-role) topictype topictype-constraint) :subtypes)))))))))
+ (concatenate 'string "{\"owner\":" (json-exporter::identifiers-to-json-string owner)
+ ",\"exclusives\":"
+ (json:encode-json-to-string (map 'list #'(lambda(y)
+ (map 'list #'uri y))
+ (map 'list #'psis topics))) "}"))))
(defun get-simple-constraints(constraint-topics &key (error-msg-constraint-name "uniqueoccurrence"))
@@ -456,7 +582,7 @@
(defun get-topicname-constraints(constraint-topics)
"Returns all topicname constraints as a list of the following form:
[{nametypescopes:[{nameType: [psi-1, psi-2], scopeConstraints: [<scopeConstraint>]},
- {nameType: [subtype-1-psi-1], scopeConstriants: [<scopeConstraints>]},
+ {nameType: [subtype-1-psi-1], scopeConstraints: [<scopeConstraints>]},
constraints: [<simpleConstraint>, <...>]},
<...>]."
(let ((constraint-role (get-item-by-psi *constraint-role-psi*))
@@ -742,7 +868,7 @@
(defun get-constraint-occurrence-value(topic &key (what 'regexp))
"Checks the occurrence-value of a regexp, card-min or card-max
- constriant-occurrence.
+ constraint-occurrence.
If what = 'regexp and the occurrence-value is empty there will be returned
the value '.*!'.
If what = 'card-min and the occurrence-value is empty there will be returned
@@ -905,7 +1031,7 @@
:uniqueoccurrence-constraints uniqueoccurrence-constraints)))
-(defmethod get-all-constraint-topics-of-topic (topic-instance &key (treat-as 'type))
+(defun get-all-constraint-topics-of-topic (topic-instance &key (treat-as 'type))
"Returns a list of constraint-topics of the topics-instance's base type(s).
If topic c is instanceOf a and b, there will be returned all
constraint-topics of the topic types a and b.
Modified: trunk/src/json/json_tmcl_validation.lisp
==============================================================================
--- trunk/src/json/json_tmcl_validation.lisp (original)
+++ trunk/src/json/json_tmcl_validation.lisp Tue May 19 05:23:26 2009
@@ -30,7 +30,7 @@
(eq applies-to (instance-of (parent role))))
return (loop for other-role in (roles (parent role))
when (and (eq constraint-role (instance-of other-role))
- (eq abstract-topictype-constraint (player other-role)))
+ (topictype-of-p (player other-role) abstract-topictype-constraint))
return t))))
Modified: trunk/src/rest_interface/set-up-json-interface.lisp
==============================================================================
--- trunk/src/rest_interface/set-up-json-interface.lisp (original)
+++ trunk/src/rest_interface/set-up-json-interface.lisp Tue May 19 05:23:26 2009
@@ -15,8 +15,8 @@
(defparameter *json-get-summary-url* "/json/summary/?$") ;the url to get a summary od all topic stored in isidorus; you have to set the GET-parameter "start" for the start index of all topics within elephant and the GET-paramter "end" for the last index of the topic sequence -> http://localhost:8000/json/summary/?start=12&end=13
(defparameter *json-get-all-type-psis* "/json/tmcl/types/?$") ;returns a list of all psis that can be a type
(defparameter *json-get-topic-stub-prefix* "/json/topicstubs/(.+)$") ;the json prefix for getting some topic stub information of a topic
-(defparameter *json-get-type-tmcl-prefix* "/json/tmcl/type/(.+)$") ;the json prefix for getting some tmcl information of a topic treated as a type
-(defparameter *json-get-instance-tmcl-prefix* "/json/tmcl/instance/(.+)$") ;the json prefix for getting some tmcl information of a topic treated as an instance
+(defparameter *json-get-type-tmcl-url* "/json/tmcl/type/?$") ;the json url for getting some tmcl information of a topic treated as a type
+(defparameter *json-get-instance-tmcl-url* "/json/tmcl/instance/?$") ;the json url for getting some tmcl information of a topic treated as an instance
(defparameter *ajax-user-interface-url* "/isidorus/?$") ;the url to the user interface; if you want to get all topics set start=0&end=nil -> localhost:8000/isidorus
(defparameter *ajax-user-interface-css-prefix* "/css") ;the url to the css files of the user interface
(defparameter *ajax-user-interface-css-directory-path* "ajax/css") ;the directory contains the css files
@@ -30,8 +30,8 @@
(json-get-summary-url *json-get-summary-url*)
(json-get-all-type-psis *json-get-all-type-psis*)
(json-get-topic-stub-prefix *json-get-topic-stub-prefix*)
- (json-get-type-tmcl-prefix *json-get-type-tmcl-prefix*)
- (json-get-instance-tmcl-prefix *json-get-instance-tmcl-prefix*)
+ (json-get-type-tmcl-url *json-get-type-tmcl-url*)
+ (json-get-instance-tmcl-url *json-get-instance-tmcl-url*)
(ajax-user-interface-url *ajax-user-interface-url*)
(ajax-user-interface-file-path *ajax-user-interface-file-path*)
(ajax-user-interface-css-prefix *ajax-user-interface-css-prefix*)
@@ -84,12 +84,14 @@
(create-regex-dispatcher json-get-all-type-psis #'return-all-tmcl-types)
hunchentoot:*dispatch-table*)
(push
- (create-regex-dispatcher json-get-type-tmcl-prefix #'(lambda(&optional psi)
- (return-tmcl-info-of-psi 'json-tmcl::type psi)))
+ (create-regex-dispatcher json-get-type-tmcl-url #'(lambda(&optional param)
+ (declare (ignorable param))
+ (return-tmcl-info-of-psis 'json-tmcl::type)))
hunchentoot:*dispatch-table*)
(push
- (create-regex-dispatcher json-get-instance-tmcl-prefix #'(lambda(&optional psi)
- (return-tmcl-info-of-psi 'json-tmcl::instance psi)))
+ (create-regex-dispatcher json-get-instance-tmcl-url #'(lambda(&optional param)
+ (declare (ignorable param))
+ (return-tmcl-info-of-psis 'json-tmcl::instance)))
hunchentoot:*dispatch-table*)
(push
(create-regex-dispatcher json-commit-url #'json-commit)
@@ -102,6 +104,8 @@
;; --- some handlers for the json-rest-interface -------------------------------
;; =============================================================================
(defun return-all-tmcl-types(&optional param)
+ "Returns all topics that are valid types -> so they have to be valid to the
+ topictype-constraint (if it exists) and the can't be abstract."
(declare (ignorable param))
(handler-case (let ((all-topics
(elephant:get-instances-by-class 'd:TopicC))
@@ -150,29 +154,55 @@
(format nil "Condition: Topic \"~a\" not found" psi)))))
-(defun return-tmcl-info-of-psi(treat-as &optional psi)
+(defun return-tmcl-info-of-psis(treat-as)
"Returns a json string which represents the defined tmcl-constraints of the
topic and the associations where this topic can be a player."
- (assert psi)
- (let ((http-method (hunchentoot:request-method*)))
- (if (eq http-method :GET)
- (let ((identifier (string-replace psi "%23" "#")))
- (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
- (handler-case (let ((tmcl
- (json-tmcl:get-constraints-of-fragment identifier :treat-as treat-as)))
- (if tmcl
- (progn
- (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
- tmcl)
- (progn
- (setf (hunchentoot:return-code*) hunchentoot:+http-not-found+)
- (setf (hunchentoot:content-type*) "text")
- (format nil "Topic \"~a\" not found." psi))))
+ (let ((http-method (hunchentoot:request-method*)))
+ (if (or (eq http-method :POST)
+ (eq http-method :PUT))
+ (let ((external-format (flexi-streams:make-external-format :UTF-8 :eol-style :LF)))
+ (let ((json-data (hunchentoot:raw-post-data :external-format external-format :force-text t)))
+ (handler-case (let ((psis
+ (json:decode-json-from-string json-data)))
+ (let ((tmcl
+ (json-tmcl:get-constraints-of-fragment psis :treat-as treat-as)))
+ (if tmcl
+ (progn
+ (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+ tmcl)
+ (progn
+ (setf (hunchentoot:return-code*) hunchentoot:+http-not-found+)
+ (setf (hunchentoot:content-type*) "text")
+ (format nil "Topic \"~a\" not found." psis)))))
(condition (err) (progn
(setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
(setf (hunchentoot:content-type*) "text")
- (format nil "Condition: \"~a\"" err)))))
- (setf (hunchentoot:return-code*) hunchentoot:+http-bad-request+))))
+ (format nil "Condition: \"~a\"" err))))))
+ (setf (hunchentoot:return-code*) hunchentoot:+http-bad-request+))))
+
+;(defun return-tmcl-info-of-psis(treat-as &otptional psi)
+; "Returns a json string which represents the defined tmcl-constraints of the
+; topic and the associations where this topic can be a player."
+; (alert psi)
+; (let ((http-method (hunchentoot:request-method*)))
+; (if (eq http-method :GET)
+; (let ((identifier (string-replace psi "%23" "#")))
+; (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+; (handler-case (let ((tmcl
+; (json-tmcl:get-constraints-of-fragment identifier :treat-as treat-as)))
+; (if tmcl
+; (progn
+; (setf (hunchentoot:content-type*) "application/json") ;RFC 4627
+; tmcl)
+; (progn
+; (setf (hunchentoot:return-code*) hunchentoot:+http-not-found+)
+; (setf (hunchentoot:content-type*) "text")
+; (format nil "Topic \"~a\" not found." psis))))
+; (condition (err) (progn
+; (setf (hunchentoot:return-code*) hunchentoot:+http-internal-server-error+)
+; (setf (hunchentoot:content-type*) "text")
+; (format nil "Condition: \"~a\"" err)))))
+; (setf (hunchentoot:return-code*) hunchentoot:+http-bad-request+))))
(defun return-all-topic-psis (&optional param)
Modified: trunk/src/unit_tests/poems.xtm
==============================================================================
--- trunk/src/unit_tests/poems.xtm (original)
+++ trunk/src/unit_tests/poems.xtm Tue May 19 05:23:26 2009
@@ -1,90 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<tm:topicMap version="2.0" xmlns:tm="http://www.topicmaps.org/xtm/">
-
- <!-- === association-test ================================================ -->
- <tm:topic id="test-scope-1">
- <tm:subjectIdentifier href="test-scope-1"/>
- <tm:instanceOf><tm:topicRef href="#scopetype"/></tm:instanceOf>
- </tm:topic>
-
- <tm:topic id="test-scope-2">
- <tm:subjectIdentifier href="test-scope-2"/>
- <tm:instanceOf><tm:topicRef href="#scopetype"/></tm:instanceOf>
- </tm:topic>
-
- <tm:topic id="written-by-test-scope-constraint">
- <tm:subjectIdentifier href="written-by-test-scope-constraint"/>
- <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">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-test-scope-constraint"/>
- </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="#written-by-test-scope-constraint"/>
- </tm:role>
- <tm:role>
- <tm:type>
- <tm:topicRef href="#scopetype-role"/>
- </tm:type>
- <tm:topicRef href="#test-scope-1"/>
- </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="#written-by-test-scope-constraint"/>
- </tm:role>
- <tm:role>
- <tm:type>
- <tm:topicRef href="#scopetype-role"/>
- </tm:type>
- <tm:topicRef href="#test-scope-2"/>
- </tm:role>
- </tm:association>
- <!-- === end association-test ============================================ -->
-
-
<!-- ===================================================================== -->
<!-- === TMCL meta-model topics ========================================== -->
<!-- ===================================================================== -->
@@ -678,6 +593,84 @@
<tm:instanceOf><tm:topicRef href="#scopetype"/></tm:instanceOf>
</tm:topic>
+ <!-- region -->
+ <tm:topic id="region">
+ <tm:subjectIdentifier href="http://some.where/base-psis/region"/>
+ <tm:instanceOf><tm:topicRef href="#topictype"/></tm:instanceOf>
+ </tm:topic>
+
+ <tm:topic id="abstract-constraint-for-region">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/abstract-constraint-for-region"/>
+ <tm:instanceOf><tm:topicRef href="#abstract-topictype-constraint"/></tm:instanceOf>
+ </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="#abstract-constraint-for-region"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#region"/>
+ </tm:role>
+ </tm:association>
+
+ <tm:topic id="region-name">
+ <tm:subjectIdentifier href="http://some.where/base-psis/region-name"/>
+ <tm:instanceOf><tm:topicRef href="#nametype"/></tm:instanceOf>
+ </tm:topic>
+
+ <tm:topic id="region-population">
+ <tm:subjectIdentifier href="http://some.where/base-psis/region-population"/>
+ <tm:instanceOf><tm:topicRef href="#occurrencetype"/></tm:instanceOf>
+ </tm:topic>
+
+ <!-- city -->
+ <tm:topic id="city">
+ <tm:subjectIdentifier href="http://some.where/base-psis/city"/>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#supertype-subtype"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#supertype"/></tm:type>
+ <tm:topicRef href="#region"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#subtype"/></tm:type>
+ <tm:topicRef href="#city"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- metropolis -->
+ <tm:topic id="metropolis">
+ <tm:subjectIdentifier href="http://some.where/base-psis/metropolis"/>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#supertype-subtype"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#supertype"/></tm:type>
+ <tm:topicRef href="#region"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#subtype"/></tm:type>
+ <tm:topicRef href="#metropolis"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- country -->
+ <tm:topic id="country">
+ <tm:subjectIdentifier href="http://some.where/base-psis/country"/>
+ <tm:instanceOf><tm:topicRef href="#topictype"/></tm:instanceOf>
+ </tm:topic>
+
+ <tm:topic id="country-name">
+ <tm:subjectIdentifier href="http://some.where/base-psis/country-name"/>
+ <tm:instanceOf><tm:topicRef href="#nametype"/></tm:instanceOf>
+ </tm:topic>
+
<!-- association author-poem -->
<tm:topic id="written-by">
<tm:subjectIdentifier href="http://some.where/base-psis/written-by"/>
@@ -694,6 +687,34 @@
<tm:instanceOf><tm:topicRef href="#roletype"/></tm:instanceOf>
</tm:topic>
+ <!-- association country-city -->
+ <tm:topic id="located-in">
+ <tm:subjectIdentifier href="http://some.where/base-psis/located-in"/>
+ <tm:instanceOf><tm:topicRef href="#associationtype"/></tm:instanceOf>
+ </tm:topic>
+
+ <tm:topic id="container">
+ <tm:subjectIdentifier href="http://some.where/base-psis/container"/>
+ <tm:instanceOf><tm:topicRef href="#roletype"/></tm:instanceOf>
+ </tm:topic>
+
+ <tm:topic id="containee">
+ <tm:subjectIdentifier href="http://some.where/base-psis/containee"/>
+ <tm:instanceOf><tm:topicRef href="#roletype"/></tm:instanceOf>
+ </tm:topic>
+
+ <!-- association author-city -->
+ <tm:topic id="born-in">
+ <tm:subjectIdentifier href="http://some.where/base-psis/born-in"/>
+ <tm:instanceOf><tm:topicRef href="#associationtype"/></tm:instanceOf>
+ </tm:topic>
+
+ <!-- writer already defined for written-by -->
+
+ <tm:topic id="place">
+ <tm:subjectIdentifier href="http://some.where/base-psis/place"/>
+ <tm:instanceOf><tm:topicRef href="#roletype"/></tm:instanceOf>
+ </tm:topic>
<!-- ===================================================================== -->
<!-- === own datamodel: exclusive type constraint ======================== -->
@@ -728,6 +749,30 @@
</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="#exc"/>
+ </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="#exc"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#country"/>
+ </tm:role>
+ </tm:association>
+
<!-- ===================================================================== -->
<!-- === own datamodel: subjectIdentifier constraints ==================== -->
<!-- ===================================================================== -->
@@ -797,9 +842,69 @@
</tm:role>
</tm:association>
- <!-- further subjectidentifiers of author and poem -->
- <tm:topic id="sic-author-poem">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/sic-author-poem"/>
+ <!-- subjectidentifier of region -->
+ <tm:topic id="sic-region">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/sic-region"/>
+ <tm:instanceOf><tm:topicRef href="#subjectidentifier-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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^http://some.where/psis/region/.+$</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="#sic-region"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#region"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- subjectidentifier of country -->
+ <tm:topic id="sic-country">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/sic-country"/>
+ <tm:instanceOf><tm:topicRef href="#subjectidentifier-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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^http://some.where/psis/country/.+$</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="#sic-country"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#country"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- further subjectidentifiers of all topics -->
+ <tm:topic id="sic-all">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/all"/>
<tm:instanceOf><tm:topicRef href="#subjectidentifier-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
@@ -819,7 +924,7 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#sic-author-poem"/>
+ <tm:topicRef href="#sic-all"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
@@ -831,7 +936,7 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#sic-author-poem"/>
+ <tm:topicRef href="#sic-all"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
@@ -839,15 +944,39 @@
</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="#sic-all"/>
+ </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="#sic-all"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#country"/>
+ </tm:role>
+ </tm:association>
+
<!-- ===================================================================== -->
- <!-- === own datamodel: subjectIdentifier constraints ==================== -->
+ <!-- === own datamodel: subjectLocator constraints ======================= -->
<!-- ===================================================================== -->
- <!-- all instances of author and poem are not allowed to own a
+ <!-- all instances of author, poem, city and country are not allowed to own a
subjectLocator -->
- <tm:topic id="slc-author-poem">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/slc-author-poem"/>
+ <tm:topic id="slc-author-poem-city-country">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/slc-author-poem-city-country"/>
<tm:instanceOf><tm:topicRef href="#subjectlocator-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
@@ -867,7 +996,7 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#slc-author-poem"/>
+ <tm:topicRef href="#slc-author-poem-city-country"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
@@ -879,7 +1008,7 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#slc-author-poem"/>
+ <tm:topicRef href="#slc-author-poem-city-country"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
@@ -887,8 +1016,32 @@
</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="#slc-author-poem-city-country"/>
+ </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="#slc-author-poem-city-country"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#country"/>
+ </tm:role>
+ </tm:association>
+
<!-- ===================================================================== -->
- <!-- === own datamodel: names constraints ================================ -->
+ <!-- === own datamodel: name constraints ================================= -->
<!-- ===================================================================== -->
<!-- instances of the type author has to own a name of the type first-name
and one of the type last-name. both must be valid to the regular
@@ -902,11 +1055,11 @@
<tm:instanceOf><tm:topicRef href="#topicname-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">0</tm:resourceData>
+ <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:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">3</tm:resourceData>
</tm:occurrence>
<tm:occurrence>
<tm:type><tm:topicRef href="#regexp"/></tm:type>
@@ -944,7 +1097,7 @@
<tm:instanceOf><tm:topicRef href="#topicname-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">0</tm:resourceData>
+ <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>
@@ -986,7 +1139,7 @@
<tm:instanceOf><tm:topicRef href="#topicname-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">0</tm:resourceData>
+ <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>
@@ -1022,20 +1175,13 @@
</tm:role>
</tm:association>
-
- <!-- ===================================================================== -->
- <!-- === own datamodel: occurences constraints =========================== -->
- <!-- ===================================================================== -->
- <!-- every instance of the topic author can have one occurrence of the type
- author-info which contains a resourceRef (= datatype #anyURI) -->
-
- <!-- author info occurrence -->
- <tm:topic id="author-occurrence-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/author-occurrence-constraint"/>
- <tm:instanceOf><tm:topicRef href="#topicoccurrence-constraint"/></tm:instanceOf>
+ <!-- region: region-name -->
+ <tm:topic id="region-name-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/region-name-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#topicname-constraint"/></tm:instanceOf>
<tm:occurrence>
<tm:type><tm:topicRef href="#card-min"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">0</tm:resourceData>
+ <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>
@@ -1051,11 +1197,11 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#author-occurrence-constraint"/>
+ <tm:topicRef href="#region-name-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
- <tm:topicRef href="#author"/>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
@@ -1063,7 +1209,150 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#author-occurrence-constraint"/>
+ <tm:topicRef href="#region-name-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#nametype-role"/></tm:type>
+ <tm:topicRef href="#region-name"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- country: country-name
+ A country hast to have at least one name with the scope "en" or "de".
+ There can exist both names with the scopes "en" and "de". -->
+ <tm:topic id="country-name-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/country-name-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#topicname-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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^.+$</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="#country-name-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#country"/>
+ </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="#country-name-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#nametype-role"/></tm:type>
+ <tm:topicRef href="#country-name"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- country-name scopes -->
+ <tm:topic id="scoped-country-name-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/scoped-country-name-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#nametypescope-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-country-name-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#nametype-role"/></tm:type>
+ <tm:topicRef href="#country-name"/>
+ </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-country-name-constraint"/>
+ </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-country-name-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#scopetype-role"/></tm:type>
+ <tm:topicRef href="#de"/>
+ </tm:role>
+ </tm:association>
+
+
+ <!-- ===================================================================== -->
+ <!-- === own datamodel: occurence constraints ============================ -->
+ <!-- ===================================================================== -->
+ <!-- every instance of the topic author can have one occurrence of the type
+ author-info which contains a resourceRef (= datatype #anyURI) -->
+
+ <!-- author info occurrence -->
+ <tm:topic id="author-occurrence-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/author-occurrence-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#topicoccurrence-constraint"/></tm:instanceOf>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#card-min"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedInt">0</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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^.+$</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="#author-occurrence-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="#author-occurrence-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
@@ -1137,57 +1426,824 @@
</tm:role>
</tm:association>
- <!-- poem content-occurrence datatype -->
- <tm:topic id="poem-content-occurrence-datatype-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/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#string</tm:resourceData>
- </tm:occurrence>
- </tm:topic>
-
+ <!-- poem content-occurrence datatype -->
+ <tm:topic id="poem-content-occurrence-datatype-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/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#string</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="#poem-content-occurrence-datatype-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
+ <tm:topicRef href="#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 -->
+ <tm:topic id="unique-poem-occurrence-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/unique-poem-occurrence-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#uniqueoccurrence-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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^.*$</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="#unique-poem-occurrence-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#poem"/>
+ </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="#unique-poem-occurrence-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
+ <tm:topicRef href="#poem-content"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- add a scope to the occurrence "poem-content" -->
+ <tm:topic id="scoped-poem-occurrence-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/scoped-poem-occurrence-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#occurrencetypescope-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-poem-occurrence-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
+ <tm:topicRef href="#poem-content"/>
+ </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-poem-occurrence-constraint"/>
+ </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-poem-occurrence-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#scopetype-role"/></tm:type>
+ <tm:topicRef href="#de"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- city population-occurrence -->
+ <tm:topic id="region-population-occurrence-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/region-population-occurrence-constraint"/>
+ <tm:instanceOf><tm:topicRef href="#topicoccurrence-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:occurrence>
+ <tm:type><tm:topicRef href="#regexp"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^.+$</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="#region-population-occurrence-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="#region-population-occurrence-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
+ <tm:topicRef href="#region-population"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- city population-occurrence datatype -->
+ <tm:topic id="region-population-occurrence-datatype-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/region-population-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#unsignedLong</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="#region-population-occurrence-datatype-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
+ <tm:topicRef href="#region-population"/>
+ </tm:role>
+ </tm:association>
+
+ <!-- ===================================================================== -->
+ <!-- === own datamodel: association (-role) constraints ================== -->
+ <!-- ===================================================================== -->
+ <!-- there exists one asoociation of the type written-by between the types
+ author and poem. where one role is of type writer which has a player
+ 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
+ written-by -->
+ <tm:topic id="written-by-writer-role-constraint">
+ <tm:subjectIdentifier href="http://some.where/constraint-psis/written-by-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="#written-by-writer-role-constraint"/>
+ </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="#written-by-writer-role-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#writer"/>
+ </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"/>
+ <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-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="#written-by-writer-role-player-constraint"/>
+ </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="#written-by-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>
+
+
+ <!-- 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>
+ <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-constraint"/>
+ </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="#written-role-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#written"/>
+ </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:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#poem"/>
+ </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="#written-role-player-constraint"/>
+ </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="#written-role-player-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#written"/>
+ </tm:role>
+ </tm:association>
+
+
+ <!-- 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>
+ <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: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="#written-by-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="#written-by-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="#written-by-otherrole-constraint-for-writer"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type>
+ <tm:topicRef href="#written"/>
+ </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="#written-by-otherrole-constraint-for-writer"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type>
+ <tm:topicRef href="#poem"/>
+ </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"/>
+ <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="#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: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="#written-by-otherrole-constraint-for-written"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#written"/>
+ </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="#written-by-otherrole-constraint-for-written"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#poem"/>
+ </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="#written-by-otherrole-constraint-for-written"/>
+ </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="#written-by-otherrole-constraint-for-written"/>
+ </tm:role>
+ <tm:role>
+ <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 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: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-place-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-place-role-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#place"/>
+ </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: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-place-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="#born-in-place-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-place-role-player-constraint"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#place"/>
+ </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="#poem-content-occurrence-datatype-constraint"/>
+ <tm:topicRef href="#born-in-otherrole-constraint-for-writer"/>
</tm:role>
<tm:role>
- <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
- <tm:topicRef href="#poem-content"/>
+ <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type>
+ <tm:topicRef href="#region"/>
</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 -->
- <tm:topic id="unique-poem-occurrence-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/unique-poem-occurrence-constraint"/>
- <tm:instanceOf><tm:topicRef href="#uniqueoccurrence-constraint"/></tm:instanceOf>
+ <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: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:occurrence>
- <tm:type><tm:topicRef href="#regexp"/></tm:type>
- <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">^.*$</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="#unique-poem-occurrence-constraint"/>
+ <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="#poem"/>
+ <tm:type><tm:topicRef href="#associationtype-role"/></tm:type>
+ <tm:topicRef href="#born-in"/>
</tm:role>
</tm:association>
@@ -1195,37 +2251,23 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#unique-poem-occurrence-constraint"/>
+ <tm:topicRef href="#born-in-otherrole-constraint-for-place"/>
</tm:role>
<tm:role>
- <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
- <tm:topicRef href="#poem-content"/>
+ <tm:type><tm:topicRef href="#roletype-role"/></tm:type>
+ <tm:topicRef href="#place"/>
</tm:role>
</tm:association>
-
- <!-- add a scope to the occurrence "poem-content" -->
- <tm:topic id="scoped-poem-occurrence-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/scoped-poem-occurrence-constraint"/>
- <tm:instanceOf><tm:topicRef href="#occurrencetypescope-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-poem-occurrence-constraint"/>
+ <tm:topicRef href="#born-in-otherrole-constraint-for-place"/>
</tm:role>
<tm:role>
- <tm:type><tm:topicRef href="#occurrencetype-role"/></tm:type>
- <tm:topicRef href="#poem-content"/>
+ <tm:type><tm:topicRef href="#topictype-role"/></tm:type>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
@@ -1233,11 +2275,11 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#scoped-poem-occurrence-constraint"/>
+ <tm:topicRef href="#born-in-otherrole-constraint-for-place"/>
</tm:role>
<tm:role>
- <tm:type><tm:topicRef href="#scopetype-role"/></tm:type>
- <tm:topicRef href="#en"/>
+ <tm:type><tm:topicRef href="#otherroletype-role"/></tm:type>
+ <tm:topicRef href="#writer"/>
</tm:role>
</tm:association>
@@ -1245,27 +2287,20 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#scoped-poem-occurrence-constraint"/>
+ <tm:topicRef href="#born-in-otherrole-constraint-for-place"/>
</tm:role>
<tm:role>
- <tm:type><tm:topicRef href="#scopetype-role"/></tm:type>
- <tm:topicRef href="#de"/>
+ <tm:type><tm:topicRef href="#othertopictype-role"/></tm:type>
+ <tm:topicRef href="#author"/>
</tm:role>
</tm:association>
-
- <!-- ===================================================================== -->
- <!-- === own datamodel: association (-role) constraints ================== -->
- <!-- ===================================================================== -->
- <!-- there exists one asoociation of the type written-by between the types
- author and poem. where one role is of type writer which has a player
- 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
- written-by -->
- <tm:topic id="writer-role-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/writer-role-constraint"/>
+ <!-- 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>
@@ -1281,11 +2316,11 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#writer-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="#written-by"/>
+ <tm:topicRef href="#located-in"/>
</tm:role>
</tm:association>
@@ -1293,17 +2328,17 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#writer-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="#writer"/>
+ <tm:topicRef href="#container"/>
</tm:role>
</tm:association>
- <!-- the writer role owns a player of the type author -->
- <tm:topic id="writer-role-player-constraint">
- <tm:subjectIdentifier href="http://some.where/constraint-psis/writer-role-player-constraint"/>
+ <!-- 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>
@@ -1319,11 +2354,11 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#writer-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="#author"/>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
@@ -1331,11 +2366,11 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#writer-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="#written-by"/>
+ <tm:topicRef href="#located-in"/>
</tm:role>
</tm:association>
@@ -1343,19 +2378,17 @@
<tm:type><tm:topicRef href="#applies-to"/></tm:type>
<tm:role>
<tm:type><tm:topicRef href="#constraint-role"/></tm:type>
- <tm:topicRef href="#writer-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="#writer"/>
+ <tm:topicRef href="#container"/>
</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"/>
+ <!-- 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>
@@ -1371,11 +2404,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-constraint"/>
+ <tm:topicRef href="#located-in-containee-role-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#associationtype-role"/></tm:type>
- <tm:topicRef href="#written-by"/>
+ <tm:topicRef href="#located-in"/>
</tm:role>
</tm:association>
@@ -1383,17 +2416,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-role-constraint"/>
+ <tm:topicRef href="#located-in-containee-role-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#roletype-role"/></tm:type>
- <tm:topicRef href="#written"/>
+ <tm:topicRef href="#containee"/>
</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"/>
+ <!-- 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>
@@ -1409,11 +2442,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="#located-in-containee-role-player-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
- <tm:topicRef href="#poem"/>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
@@ -1421,11 +2454,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="#located-in-containee-role-player-constraint"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#associationtype-role"/></tm:type>
- <tm:topicRef href="#written-by"/>
+ <tm:topicRef href="#located-in"/>
</tm:role>
</tm:association>
@@ -1433,27 +2466,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-role-player-constraint"/>
+ <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="#written"/>
+ <tm:topicRef href="#containee"/>
</tm:role>
</tm:association>
-
- <!-- 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="written-by-otherrole-constraint-for-writer"/>
+ <!-- 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>
<tm:occurrence>
<tm:type>
@@ -1473,11 +2499,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="#located-in-otherrole-constraint-for-container"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#associationtype-role"/></tm:type>
- <tm:topicRef href="#written-by"/>
+ <tm:topicRef href="#located-in"/>
</tm:role>
</tm:association>
@@ -1485,11 +2511,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="#located-in-otherrole-constraint-for-container"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#roletype-role"/></tm:type>
- <tm:topicRef href="#writer"/>
+ <tm:topicRef href="#container"/>
</tm:role>
</tm:association>
@@ -1497,11 +2523,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="#located-in-otherrole-constraint-for-container"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
- <tm:topicRef href="#author"/>
+ <tm:topicRef href="#country"/>
</tm:role>
</tm:association>
@@ -1509,11 +2535,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="#located-in-otherrole-constraint-for-container"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#otherroletype-role"/></tm:type>
- <tm:topicRef href="#written"/>
+ <tm:topicRef href="#containee"/>
</tm:role>
</tm:association>
@@ -1521,16 +2547,16 @@
<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="#located-in-otherrole-constraint-for-container"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#othertopictype-role"/></tm:type>
- <tm:topicRef href="#poem"/>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
- <tm:topic id="written-by-otherrole-constraint-for-written">
- <tm:subjectIdentifier href="written-by-otherrole-constraint-for-written"/>
+ <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>
@@ -1550,11 +2576,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="#located-in-otherrole-constraint-for-containee"/>
</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>
@@ -1562,11 +2588,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="#located-in-otherrole-constraint-for-containee"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#roletype-role"/></tm:type>
- <tm:topicRef href="#written"/>
+ <tm:topicRef href="#containee"/>
</tm:role>
</tm:association>
@@ -1574,11 +2600,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="#located-in-otherrole-constraint-for-containee"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#topictype-role"/></tm:type>
- <tm:topicRef href="#poem"/>
+ <tm:topicRef href="#region"/>
</tm:role>
</tm:association>
@@ -1586,11 +2612,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="#located-in-otherrole-constraint-for-containee"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#otherroletype-role"/></tm:type>
- <tm:topicRef href="#writer"/>
+ <tm:topicRef href="#container"/>
</tm:role>
</tm:association>
@@ -1598,17 +2624,131 @@
<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="#located-in-otherrole-constraint-for-containee"/>
</tm:role>
<tm:role>
<tm:type><tm:topicRef href="#othertopictype-role"/></tm:type>
- <tm:topicRef href="#author"/>
+ <tm:topicRef href="#country"/>
</tm:role>
</tm:association>
<!-- ===================================================================== -->
<!-- === the "user's" topic map ========================================== -->
<!-- ===================================================================== -->
+ <tm:topic id="germany">
+ <tm:subjectIdentifier href="http://some.where/psis/country/germany"/>
+ <tm:instanceOf><tm:topicRef href="#country"/></tm:instanceOf>
+ <tm:name>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
+ <tm:value>Deutschland</tm:value>
+ </tm:name>
+ <tm:name>
+ <tm:scope><tm:topicRef href="#en"/></tm:scope>
+ <tm:value>Germany</tm:value>
+ </tm:name>
+ </tm:topic>
+
+ <tm:topic id="poland">
+ <tm:subjectIdentifier href="http://some.where/psis/country/poland"/>
+ <tm:instanceOf><tm:topicRef href="#country"/></tm:instanceOf>
+ <tm:name>
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
+ <tm:value>Polen</tm:value>
+ </tm:name>
+ <tm:name>
+ <tm:scope><tm:topicRef href="#en"/></tm:scope>
+ <tm:value>Poland</tm:value>
+ </tm:name>
+ </tm:topic>
+
+ <tm:topic id="frankfurt_am_main">
+ <tm:subjectIdentifier href="http://some.where/psis/city/frankfurt_am_main"/>
+ <tm:instanceOf><tm:topicRef href="#metropolis"/></tm:instanceOf>
+ <tm:name>
+ <tm:type><tm:topicRef href="#region-name"/></tm:type>
+ <tm:value>Frankfurt am Main</tm:value>
+ </tm:name>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#region-population"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedLong">659021</tm:resourceData>
+ </tm:occurrence>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#located-in"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#container"/></tm:type>
+ <tm:topicRef href="#germany"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#containee"/></tm:type>
+ <tm:topicRef href="#frankfurt_am_main"/>
+ </tm:role>
+ </tm:association>
+
+ <tm:topic id="marbach_am_neckar">
+ <tm:subjectIdentifier href="http://some.where/psis/city/marbach_am_neckar"/>
+ <tm:instanceOf><tm:topicRef href="#city"/></tm:instanceOf>
+ <tm:name>
+ <tm:type><tm:topicRef href="#region-name"/></tm:type>
+ <tm:value>Marbach am Neckar</tm:value>
+ </tm:name>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#region-population"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedLong">15601</tm:resourceData>
+ </tm:occurrence>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#located-in"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#container"/></tm:type>
+ <tm:topicRef href="#germany"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#containee"/></tm:type>
+ <tm:topicRef href="#marbach_am_neckar"/>
+ </tm:role>
+ </tm:association>
+
+ <tm:topic id="lubowitz">
+ <tm:subjectIdentifier href="http://some.where/psis/city/lubowitz"/>
+ <tm:instanceOf><tm:topicRef href="#city"/></tm:instanceOf>
+ <tm:name>
+ <tm:type><tm:topicRef href="#region-name"/></tm:type>
+ <tm:value>Lubowitz</tm:value>
+ </tm:name>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#region-population"/></tm:type>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#unsignedLong">365</tm:resourceData>
+ </tm:occurrence>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#located-in"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#container"/></tm:type>
+ <tm:topicRef href="#poland"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#containee"/></tm:type>
+ <tm:topicRef href="#lubowitz"/>
+ </tm:role>
+ </tm:association>
+
+ <tm:topic id="eichendorff">
+ <tm:subjectIdentifier href="http://some.where/psis/author/eichendorff"/>
+ <tm:instanceOf><tm:topicRef href="#author"/></tm:instanceOf>
+ <tm:name>
+ <tm:type><tm:topicRef href="#first-name"/></tm:type>
+ <tm:value>Joseph Karl Benedikt</tm:value>
+ </tm:name>
+ <tm:name>
+ <tm:type><tm:topicRef href="#last-name"/></tm:type>
+ <tm:value>von Eichendorff</tm:value>
+ </tm:name>
+ </tm:topic>
+
<tm:topic id="goethe">
<tm:subjectIdentifier href="http://some.where/psis/author/goethe"/> <!-- must have a psi of this form -->
<tm:subjectIdentifier href="http://some.where/psis/persons/goethe"/> <!-- can own psis of any form -->
@@ -1627,6 +2767,18 @@
</tm:occurrence>
</tm:topic>
+ <tm:association>
+ <tm:type><tm:topicRef href="#born-in"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#place"/></tm:type>
+ <tm:topicRef href="#frankfurt_am_main"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#writer"/></tm:type>
+ <tm:topicRef href="#goethe"/>
+ </tm:role>
+ </tm:association>
+
<tm:topic id="schiller">
<tm:subjectIdentifier href="http://some.where/psis/author/schiller"/> <!-- must have a psi of this form -->
<tm:instanceOf><tm:topicRef href="#author"/></tm:instanceOf> <!-- must be an instanceOf author -->
@@ -1644,15 +2796,23 @@
</tm:occurrence>
</tm:topic>
+ <tm:association>
+ <tm:type><tm:topicRef href="#born-in"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#place"/></tm:type>
+ <tm:topicRef href="#marbach_am_neckar"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#writer"/></tm:type>
+ <tm:topicRef href="#schiller"/>
+ </tm:role>
+ </tm:association>
+
<tm:topic id="zauberlehrling">
<tm:subjectIdentifier href="http://some.where/psis/poem/zauberlehrling"/> <!-- must have a psi of this form -->
<tm:subjectIdentifier href="http://some.where/psis/der_zauberlehrling"/> <!-- can own psis of any form -->
<tm:instanceOf>
- <tm:topicRef href="#poem"/><!--
- <tm:topicRef href="#author"/>
- <tm:topicRef href="#zauberlehrling"/>
- <tm:topicRef href="#topictype-constraint"/>-->
- </tm:instanceOf> <!-- must be an instanceOf poem -->
+ <tm:topicRef href="#poem"/></tm:instanceOf> <!-- must be an instanceOf poem -->
<tm:name>
<tm:type><tm:topicRef href="#title"/></tm:type> <!-- must have a name of the type title -->
<tm:value>Der Zauberlehrling</tm:value>
@@ -1826,10 +2986,6 @@
</tm:occurrence>
</tm:topic>
- <!-- some assocaitions between goethe and some of his poems,
- currently there are no associations between the topic schiller
- and any other topic, because there are no topic representing
- a poem of schiller -->
<tm:association>
<tm:type><tm:topicRef href="#written-by"/></tm:type>
<tm:role>
@@ -1854,4 +3010,187 @@
</tm:role>
</tm:association>
+ <tm:topic id="resignation">
+ <tm:subjectIdentifier href="http://some.where/psis/poem/resignation"/> <!-- must have a psi of this form -->
+ <tm:instanceOf><tm:topicRef href="#poem"/></tm:instanceOf> <!-- must be an instanceOf poem -->
+ <tm:name>
+ <tm:type><tm:topicRef href="#title"/></tm:type> <!-- must have a name of the type title -->
+ <tm:value>Resignation - Eine Phantasie</tm:value>
+ </tm:name>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#poem-content"/></tm:type> <!-- must have an occurrence of the type poem-content with the scope de or en -->
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">Auch ich war in Arkadien geboren,
+Auch mir hat die Natur
+An meiner Wiege Freude zugeschworen,
+Auch ich war in Arkadien geboren,
+Doch Tränen gab der kurze Lenz mir nur.
+
+Des Lebens Mai blüht einmal und nicht wieder,
+Mir hat er abgeblüht.
+Der stille Gott - o weinet, meine Brüder -
+Der stille Gott taucht meine Fackel nieder,
+Und die Erscheinung flieht.
+
+Da steh ich schon auf deiner Schauerbrücke,
+Ehrwürdge Geistermutter - Ewigkeit.
+Empfange meinen Vollmachtbrief zum Glücke,
+Ich bring ihn unerbrochen dir zurücke,
+Mein Lauf ist aus. Ich weiß von keiner Seligkeit.
+
+Vor deinem Thron erheb ich meine Klage,
+Verhüllte Richterin.
+Auf jenem Stern ging eine frohe Sage,
+Du thronest hier mit des Gerichtes Waage
+Und nennest dich Vergelterin.
+
+Hier - spricht man - warten Schrecken auf den Bösen,
+Und Freuden auf den Redlichen.
+Des Herzens Krümmen werdest du entblößen,
+Der Vorsicht Rätsel werdest du mir lösen
+Und Rechnung halten mit dem Leidenden.
+
+Hier öffne sich die Heimat dem Verbannten,
+Hier endige des Dulders Dornenbahn.
+Ein Götterkind, das sie mir Wahrheit nannten,
+Die meisten flohen, wenige nur kannten,
+Hielt meines Lebens raschen Zügel an.
+
+»Ich zahle dir in einem andern Leben,
+Gib deine Jugend mir!
+Nichts kann ich dir als diese Weisung geben.«
+Ich nahm die Weisung auf das andre Leben,
+Und meiner Jugend Freuden gab ich ihr.
+
+»Gib mir das Weib, so teuer deinem Herzen,
+Gib deine Laura mir.
+Jenseits der Gräber wuchern deine Schmerzen.« -
+Ich riß sie blutend aus dem wunden Herzen
+Und weinte laut und gab sie ihr.
+
+»Du siehst die Zeit nach jenen Ufern fliegen,
+Die blühende Natur
+Bleibt hinter ihr - ein welker Leichnam - liegen.
+Wenn Erd und Himmel trümmernd auseinanderfliegen,
+Daran erkenne den erfüllten Schwur.«
+
+»Die Schuldverschreibung lautet an die Toten«,
+Hohnlächelte die Welt,
+»Die Lügnerin, gedungen von Despoten,
+Hat für die Wahrheit Schatten dir geboten,
+Du bist nicht mehr, wenn dieser Schein verfällt.«
+
+Frech witzelte das Schlangenheer der Spötter:
+»Vor einem Wahn, den nur Verjährung weiht,
+Erzitterst du? Was sollen deine Götter,
+Des kranken Weltplans schlau erdachte Retter,
+Die Menschenwitz des Menschen Notdurft leiht?
+
+Ein Gaukelspiel, ohnmächtigen Gewürmen
+Vom Mächtigen gegönnt,
+Schreckfeuer, angesteckt auf hohen Türmen,
+Die Phantasie des Träumers zu bestürmen,
+Wo des Gesetzes Fackel dunkel brennt.
+
+Was heißt die Zukunft, die uns Gräber decken?
+Die Ewigkeit, mit der du eitel prangst?
+Ehrwürdig nur, weil schlaue Hüllen sie verstecken,
+Der Riesenschatten unsrer eignen Schrecken
+Im hohlen Spiegel der Gewissensangst;
+
+Ein Lügenbild lebendiger Gestalten,
+Die Mumie der Zeit,
+Vom Balsamgeist der Hoffnung in den kalten
+Behausungen des Grabes hingehalten,
+Das nennt dein Fieberwahn - Unsterblichkeit?
+
+Für Hoffnungen - Verwesung straft sie Lügen -
+Gabst du gewisse Güter hin?
+Sechstausend Jahre hat der Tod geschwiegen,
+Kam je ein Leichnam aus der Gruft gestiegen,
+Der Meldung tat von der Vergelterin?" -
+
+Ich sah die Zeit nach deinen Ufern fliegen,
+Die blühende Natur
+Blieb hinter ihr, ein welker Leichnam, liegen,
+Kein Toter kam aus seiner Gruft gestiegen,
+Und fest vertraut ich auf den Götterschwur.
+
+All meine Freuden hab ich dir geschlachtet,
+Jetzt werf ich mich vor deinen Richterthron.
+Der Menge Spott hab ich beherzt verachtet,
+Nur deine Güter hab ich groß geachtet,
+Vergelterin, ich fodre meinen Lohn.
+
+"Mit gleicher Liebe lieb ich meine Kinder!"
+Rief unsichtbar ein Genius.
+"Zwei Blumen", rief er, "- hört es, Menschenkinder -
+Zwei Blumen blühen für den weisen Finder,
+Sie heißen Hoffnung und Genuß.
+
+Wer dieser Blumen eine brach, begehre
+Die andre Schwester nicht.
+Genieße, wer nicht glauben kann. Die Lehre
+Ist ewig wie die Welt. Wer glauben kann, entbehre.
+Die Weltgeschichte ist das Weltgericht.
+
+Du hast gehofft, dein Lohn ist abgetragen,
+Dein Glaube war dein zugewognes Glück.
+Du konntest deine Weisen fragen,
+Was man von der Minute ausgeschlagen,
+Gibt keine Ewigkeit zurück."</tm:resourceData>
+ </tm:occurrence>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#writer"/></tm:type>
+ <tm:topicRef href="#schiller"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#written"/></tm:type>
+ <tm:topicRef href="#resignation"/>
+ </tm:role>
+ </tm:association>
+
+ <tm:topic id="mondnacht">
+ <tm:subjectIdentifier href="http://some.where/psis/poem/mondnacht"/> <!-- must have a psi of this form -->
+ <tm:instanceOf><tm:topicRef href="#poem"/></tm:instanceOf> <!-- must be an instanceOf poem -->
+ <tm:name>
+ <tm:type><tm:topicRef href="#title"/></tm:type> <!-- must have a name of the type title -->
+ <tm:value>Mondnacht</tm:value>
+ </tm:name>
+ <tm:occurrence>
+ <tm:type><tm:topicRef href="#poem-content"/></tm:type> <!-- must have an occurrence of the type poem-content with the scope de or en -->
+ <tm:scope><tm:topicRef href="#de"/></tm:scope>
+ <tm:resourceData datatype="http://www.w3.org/2001/XMLSchema#string">Es war, als hätt' der Himmel
+Die Erde still geküsst,
+Dass sie im Blütenschimmer
+Von ihm nun träumen müsst'.
+
+Die Luft ging durch die Felder,
+Die Ähren wogten sacht,
+Es rauschten leis' die Wälder,
+So sternklar war die Nacht.
+
+Und meine Seele spannte
+Weit ihre Flügel aus,
+Flog durch die stillen Lande,
+Als flöge sie nach Haus.</tm:resourceData>
+ </tm:occurrence>
+ </tm:topic>
+
+ <tm:association>
+ <tm:type><tm:topicRef href="#written-by"/></tm:type>
+ <tm:role>
+ <tm:type><tm:topicRef href="#writer"/></tm:type>
+ <tm:topicRef href="#eichendorff"/>
+ </tm:role>
+ <tm:role>
+ <tm:type><tm:topicRef href="#written"/></tm:type>
+ <tm:topicRef href="#mondnacht"/>
+ </tm:role>
+ </tm:association>
+
</tm:topicMap>
More information about the Isidorus-cvs
mailing list