isidorus-cvs
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
July 2011
- 1 participants
- 156 discussions

[isidorus-cvs] r696 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets
by lgiessmann@common-lisp.net 31 Jul '11
by lgiessmann@common-lisp.net 31 Jul '11
31 Jul '11
Author: lgiessmann
Date: Sun Jul 31 09:19:10 2011
New Revision: 696
Log:
gdl-frontend: Widgets: fixed and extended the test.gdl.jtm file
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Sun Jul 31 07:33:54 2011 (r695)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Sun Jul 31 09:19:10 2011 (r696)
@@ -32,11 +32,17 @@
{"subject_identifiers":["[doc:test-schema]"], "instance_of":["si:[gdl:Schema]"], "names":[{"value": "Test GDL Schema", "type":"si:[gdl:schema-name]"}]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
{"subject_identifiers":["[doc:person-name]"], "instance_of":["si:[tmcl:name-type]"]},
+ {"subject_identifiers":["[tmcl:allowed]"], "instance_of":["si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[tmcl:allowed-reifier]"], "instance_of":["si:[tmcl:association-type]"]},
+ {"subject_identifiers":["[tmcl:allows]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[doc:poet-name]"]},
+ {"subject_identifiers":["[doc:unused-person-name-reifier]"], "instance_of":["si:[doc:Reifier-Type]"]},
+ {"subject_identifiers":["[doc:Reifier-Type]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[doc:musician-name]"]},
{"subject_identifiers":["[doc:director-name]"]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
{"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]","si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[tmcl:reifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[tmcl:constrained]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[tmcl:constrained-statement]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:role-type]"]},
@@ -102,6 +108,7 @@
{"subject_identifiers":["[doc:default-tm-value-person-name-type-constraint]"], "instance_of":["si:[gdl:Default-TM-Instance-Value]"]},
{"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
{"subject_identifiers":["[doc:person-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
+ {"subject_identifiers":["[doc:person-name-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
{"subject_identifiers":["[doc:person-name-regexp-constraint]"], "instance_of":["si:[tmcl:regular-expression-constraint]"], "occurrences":[{"type":"si:[tmcl:regexp]", "value":"^[A-Z][a-z]+ [A-Z][a-z]+$"}]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-check-box]"], "instance_of":["si:[gdl:Check-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_check_box_id"},{"type":"si:[gdl:content-orientation]", "value":"vertical"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin]", "value":"30pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
@@ -227,6 +234,7 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Poet]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Musician]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:regular-expression-constraint]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:reifier-constraint]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -284,5 +292,7 @@
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]},
{"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"},{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"}]},
{"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:Person]"}]},
- {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-regexp-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"}]}
+ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-regexp-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"}]},
+ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-reifier-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"}]},
+ {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allowed]", "player":"si:[doc:Reifier-Type]"},{"type":"si:[tmcl:allows]", "player":"si:[doc:person-name-reifier-constraint]"}]}
]}
\ No newline at end of file
1
0

[isidorus-cvs] r695 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 31 Jul '11
by lgiessmann@common-lisp.net 31 Jul '11
31 Jul '11
Author: lgiessmann
Date: Sun Jul 31 07:33:54 2011
New Revision: 695
Log:
gdl-frontend: Widgets: implemented the method TmHelper.getTmValuesForReifierConstraint()
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Sun Jul 31 07:05:43 2011 (r694)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Sun Jul 31 07:33:54 2011 (r695)
@@ -34,6 +34,9 @@
public final static String tmclTopicOccurrenceConstraint = tmcl + "topic-occurrence-constraint";
public final static String tmclTopicRoleConstraint = tmcl + "topic-role-constraint";
public final static String tmclAssociationRoleConstraint = tmcl + "association-role-constraint";
+ public final static String tmclAllows = tmcl + "allows";
+ public final static String tmclAllowed = tmcl + "allowed";
+ public final static String tmclAllowedReifier = tmcl + "allowed-reifier";
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Sun Jul 31 07:05:43 2011 (r694)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Sun Jul 31 07:33:54 2011 (r695)
@@ -758,22 +758,30 @@
// returns the topic that can be used to satisfy the passed role-player-constraint.
- public static ArrayList<Topic> getTmValuesForReifierConstraint(Topic reifierConstraint){
+ public static ArrayList<Topic> getTmValuesForReifierConstraint(Topic reifierConstraint) throws InvalidGdlSchemaException{
ArrayList<Topic> result = new ArrayList<Topic>();
if(reifierConstraint == null) return result;
- // TODO: implement
-
+
+ TopicMap tm = reifierConstraint.getTopicMap();
+ Topic allowsRoleType = getTopicByPsi(GdlPsis.TMCL.tmclAllows, tm);
+ Topic allowedRoleType = getTopicByPsi(GdlPsis.TMCL.tmclAllowed, tm);
+ Topic allowedReifierAssocType = getTopicByPsi(GdlPsis.TMCL.tmclAllowedReifier, tm);
+ Topic topicType = getTopicByPsi(GdlPsis.TMCL.tmclTopictype, tm);
+ ArrayList<Topic> reifierTypes = getOtherPlayerOfBinaryAssociation(reifierConstraint, allowsRoleType, allowedReifierAssocType, null, topicType, allowedRoleType);
+
+ if(reifierTypes.size() != 1){
+ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(reifierConstraint) + " must be bound to exaclty one topic type that is used as reifier, but is: " + reifierTypes.size());
+ } else {
+ JsArray<Topic> allTopics = tm.getTopics();
+ for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), reifierTypes.get(0))) result.add(allTopics.get(i));
+ }
return result;
}
// returns the topic that can be used to satisfy the passed role-player-constraint.
- public static ArrayList<Topic> getTmValuesForRolePlayerConstraint(Topic rolePlayerConstraint){
- ArrayList<Topic> result = new ArrayList<Topic>();
- if(rolePlayerConstraint == null) return result;
- // TODO: implement
-
- return result;
+ public static ArrayList<Topic> getTmValuesForRolePlayerConstraint(Topic rolePlayerConstraint) throws ExecutionException{
+ throw new ExecutionException("this method is currently not implemented");
}
@@ -814,22 +822,14 @@
// returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
- public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint){
- ArrayList<Topic> result = new ArrayList<Topic>();
- if(variantNameReifierConstraint == null) return result;
- // TODO: implement
-
- return result;
+ public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException {
+ throw new ExecutionException("this mehtod is currently not implemented");
}
// returns the topic that can be used to satisfy the passed variant-name-scope-constraint.
- public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint){
- ArrayList<Topic> result = new ArrayList<Topic>();
- if(variantNameScopeConstraint == null) return result;
- // TODO: implement
-
- return result;
+ public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException{
+ throw new ExecutionException("this method is currently not implemented");
}
1
0

[isidorus-cvs] r694 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text
by lgiessmann@common-lisp.net 31 Jul '11
by lgiessmann@common-lisp.net 31 Jul '11
31 Jul '11
Author: lgiessmann
Date: Sun Jul 31 07:05:43 2011
New Revision: 694
Log:
gdl-frontend: Widgets: implemented the method TmHelper.getTmValuesForTypeConstraint()
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Sun Jul 31 02:09:48 2011 (r693)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Sun Jul 31 07:05:43 2011 (r694)
@@ -32,6 +32,8 @@
public final static String tmclScopeConstraint = tmcl + "scope-constraint";
public final static String tmclTopicNameConstraint = tmcl + "topic-name-constraint";
public final static String tmclTopicOccurrenceConstraint = tmcl + "topic-occurrence-constraint";
+ public final static String tmclTopicRoleConstraint = tmcl + "topic-role-constraint";
+ public final static String tmclAssociationRoleConstraint = tmcl + "association-role-constraint";
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Sun Jul 31 02:09:48 2011 (r693)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Sun Jul 31 07:05:43 2011 (r694)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
@@ -49,7 +50,7 @@
// returns the topic that can be used to satisfy the constraint, that is
// bound to the element's value group instance. Note, this method
// returns all topics of a topic map that can be used for a defined constraint
- public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException;
+ public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException, ExecutionException;
// returns a regular expression that must be satisfied to satisfy the
// constraint, that is bound to the element's value group instance
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Sun Jul 31 02:09:48 2011 (r693)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Sun Jul 31 07:05:43 2011 (r694)
@@ -11,6 +11,7 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis.TMDM;
+import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
@@ -146,6 +147,21 @@
}
+ // returns true if the passed topic subtype is a subtype of the passed
+ // topic supertype
+ public static boolean isSupertypeOf(Topic subtype, Topic supertype){
+ return getAllSuperTypes(subtype, null).contains(supertype);
+ }
+
+
+ // returns true if the passed topic subtype is a subtype of the passed
+ // topic supertype, that is represented by the supertype psi
+ public static boolean isSupertypeOf(Topic subtype, String supertype){
+ if(subtype == null) return false;
+ return isSupertypeOf(subtype, getTopicByPsi(supertype, subtype.getTopicMap()));
+ }
+
+
// returns the direct supertypes of the passed topic
public static ArrayList<Topic> getDirectSuperTypes(Topic top){
ArrayList<Topic> result = new ArrayList<Topic>();
@@ -709,7 +725,7 @@
// returns the topic that can be used to satisfy the passed constraint.
- public static ArrayList<Topic> getTmValuesForConstraint(Topic constraint, Topic valueGroup) throws InvalidGdlSchemaException {
+ public static ArrayList<Topic> getTmValuesForConstraint(Topic constraint, Topic valueGroup) throws InvalidGdlSchemaException, ExecutionException {
ArrayList<Topic> result = new ArrayList<Topic>();
if(constraint == null || valueGroup == null) return result;
@@ -762,19 +778,35 @@
// returns the topic that can be used to satisfy the passed type-constraint.
- public static ArrayList<Topic> getTmValuesForTypeConstraint(Topic typeConstraint, Topic valueGroup) throws InvalidGdlSchemaException {
+ public static ArrayList<Topic> getTmValuesForTypeConstraint(Topic typeConstraint, Topic valueGroup) throws InvalidGdlSchemaException, ExecutionException {
ArrayList<Topic> result = new ArrayList<Topic>();
if(typeConstraint == null || valueGroup == null) return result;
Topic rootConstraint = getRootConstraintOfValueGroup(valueGroup, typeConstraint);
if(rootConstraint == null) return result;
-
+
if(isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclTopicNameConstraint) || isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclTopicOccurrenceConstraint)){
-
- } else if(true /* TODO: association */){
-
- } else if(true /* TODO: role */){
-
+ TopicMap tm = rootConstraint.getTopicMap();
+ Topic constraintRoleType = getTopicByPsi(GdlPsis.TMCL.tmclConstraint, tm);
+ Topic constrainedRoleType = getTopicByPsi(GdlPsis.TMCL.tmclConstrained, tm);
+ Topic nameType = getTopicByPsi(GdlPsis.TMCL.tmclNameType, tm);
+ Topic occurrenceType = getTopicByPsi(GdlPsis.TMCL.tmclOccurrenceType, tm);
+ Topic constrainedStatementAssocType = getTopicByPsi(GdlPsis.TMCL.tmclConstrainedStatement, tm);
+ ArrayList<Topic> nameTypeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedStatementAssocType, null, nameType, constrainedRoleType);
+ ArrayList<Topic> occurrenceTypeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedStatementAssocType, null, occurrenceType, constrainedRoleType);
+ ArrayList<Topic> typeTopics = Utils.union(nameTypeTopics, occurrenceTypeTopics);
+
+ if(typeTopics.size() != 1){
+ throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(rootConstraint) + " must be bound extactly once to an occurrence or name type, but is: " + typeTopics.size());
+ } else {
+ // get subtypes of typeTopic
+ JsArray<Topic> allTopics = tm.getTopics();
+ for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), typeTopics.get(0))) result.add(allTopics.get(i));
+ }
+ } else if(isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclAssociationRoleConstraint)){
+ throw new ExecutionException(GdlPsis.TMCL.tmclAssociationRoleConstraint + " is not implemented yet");
+ } else if(isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclTopicRoleConstraint)){
+ throw new ExecutionException(GdlPsis.TMCL.tmclTopicRoleConstraint + " is not implemented yet");
}
return result;
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Sun Jul 31 02:09:48 2011 (r693)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Sun Jul 31 07:05:43 2011 (r694)
@@ -929,7 +929,7 @@
@Override
- public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException {
+ public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException, ExecutionException {
return TmHelper.getTmValuesForConstraint(this.getConstraint(), this.getValueGroup());
}
1
0

[isidorus-cvs] r693 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/text war/gdl_widgets
by lgiessmann@common-lisp.net 31 Jul '11
by lgiessmann@common-lisp.net 31 Jul '11
31 Jul '11
Author: lgiessmann
Date: Sun Jul 31 02:09:48 2011
New Revision: 693
Log:
gdl-frontend: Widgets: implemented the method TmHelper.getDefaultLiteralValue(), TmHelper.getTmValues(), TmHelper.getLiteralValues()
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Sun Jul 31 02:09:48 2011 (r693)
@@ -8,4 +8,5 @@
* GdlListBox
* Implement TopicMaps data consumption
* Implement TopicMaps data generation
+* Implement HiddenValue
* Fix css-pseudo-class-handlers (=> Buttons)
\ No newline at end of file
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Sun Jul 31 02:09:48 2011 (r693)
@@ -7,17 +7,31 @@
// some psis of the TMDM
public class TMDM{
- public final static String supertype = "http://psi.topicmaps.org/iso13250/model/supertype";
- public final static String subtype = "http://psi.topicmaps.org/iso13250/model/subtype";
- public final static String supertypeSubtype = "http://psi.topicmaps.org/iso13250/model/supertype-subtype";
+ public final static String tmdm = "http://psi.topicmaps.org/iso13250/model/";
+ public final static String supertype = tmdm + "supertype";
+ public final static String subtype = tmdm + "subtype";
+ public final static String supertypeSubtype = tmdm + "supertype-subtype";
}
// some psis of the TMCL
public class TMCL {
- public final static String topictype = "http://psi.topicmaps.org/tmcl/topic-type";
- public final static String constraint = "http://psi.topicmaps.org/tmcl/constraint";
+ public final static String tmcl = "http://psi.topicmaps.org/tmcl/";
+ public final static String tmclTopictype = tmcl + "topic-type";
+ public final static String tmclNameType = tmcl + "name-type";
+ public final static String tmclOccurrenceType = tmcl + "occurrence-type";
+ public final static String tmclConstraint = tmcl + "constraint";
+ public final static String tmclConstrained = tmcl + "constrained";
+ public final static String tmclConstrainedStatement = tmcl + "constrained-statement";
+ public final static String tmclRegularExpressionConstraint = tmcl + "regular-expression-constraint";
+ public final static String tmclRegexp = tmcl + "regexp";
+ public final static String tmclCardMin = tmcl + "card-min";
+ public final static String tmclCardMax = tmcl + "card-max";
+ public final static String tmclReifierConstraint = tmcl + "reifier-constraint";
+ public final static String tmclScopeConstraint = tmcl + "scope-constraint";
+ public final static String tmclTopicNameConstraint = tmcl + "topic-name-constraint";
+ public final static String tmclTopicOccurrenceConstraint = tmcl + "topic-occurrence-constraint";
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Sun Jul 31 02:09:48 2011 (r693)
@@ -31,12 +31,13 @@
// i.e. is is one value of getDefaultTmValue(), getDefaultLiteralValue()
public Topic getDefaultValue() throws InvalidGdlSchemaException;
- // returns all possible topics that can be used as values for this value group,
- // i.e. if no tm-values are bound to this value-group, all possible values are
- // generated by examining the tmcl:constraint
+ // returns all possible topics that can be used as values for this value group.
+ // Note, since gdl:Default-TM-Value is treated as a usual value,
+ // default vaues are also returned by this function
public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException;
- // returns all possible literals that can be used as values for this value group
+ // returns all possible literals that can be used as values for this value group.
+ // Note, default literal values are also returned by this function
public ArrayList<Topic> getLiteralValues() throws InvalidGdlSchemaException;
// returns the literal value that is set on an item
@@ -44,4 +45,13 @@
// returns the topic map construct that is set on an item
public Construct getSetTmValue() throws InvalidGdlSchemaException;
+
+ // returns the topic that can be used to satisfy the constraint, that is
+ // bound to the element's value group instance. Note, this method
+ // returns all topics of a topic map that can be used for a defined constraint
+ public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException;
+
+ // returns a regular expression that must be satisfied to satisfy the
+ // constraint, that is bound to the element's value group instance
+ public String getLiteralValueForConstraint() throws InvalidGdlSchemaException;
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Sun Jul 31 02:09:48 2011 (r693)
@@ -10,10 +10,7 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.ScopedStub;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
-import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis.AssociationType;
-import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis.RoleType;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis.TMDM;
-import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis.TopicType;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
@@ -272,27 +269,6 @@
}
- // returns all topics that are instances of tm-value, which are also bound to this
- // topic via a gdl:tm-binding association
- public static ArrayList<Topic> getTmValues(Topic top){
- ArrayList<Topic> result = new ArrayList<Topic>();
- if(top == null) return result;
- TopicMap tm = top.getTopicMap();
- Topic descriptor = getTopicByPsi(RoleType.gdlDescriptor, tm);
- Topic tmBinding = getTopicByPsi(AssociationType.gdlTmBinding, tm);
- Topic tmValue = getTopicByPsi(TopicType.gdlTmValue, tm);
-
- JsArray<Role> roles = top.getRolesPlayed(descriptor, tmBinding);
- for(int i = 0; i != roles.length(); ++i){
- Association parent = roles.get(i).getParent();
- if(parent.getRoles().length() == 2 && parent.getRoles(descriptor).length() == 1 &&
- isInstanceOf(parent.getRoles(descriptor).get(0).getPlayer(), tmValue))
- result.add(parent.getRoles(descriptor).get(0).getPlayer());
- }
- return result;
- }
-
-
// returns the associations that are bound to the topic "topic" and have the passed scope and roles
public static ArrayList<Association> getAssociationsOfTopic(Topic topic, Topic roleType, Topic assocType, ArrayList<Topic> scope, ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes){
ArrayList<Association> result = new ArrayList<Association>();
@@ -620,7 +596,7 @@
Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
Topic descriptorType = getTopicByPsi(GdlPsis.TopicType.gdlDescriptor, tm);
Topic tmBindingAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlTmBinding, tm);
- Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
+ Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.tmclConstraint, tm);
Topic tmConstructRoleType = getTopicByPsi(GdlPsis.RoleType.gdlTmConstruct, tm);
ArrayList<Topic> tmclConstraints = getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, tmBindingAssocType, null, tmclConstraintType, tmConstructRoleType);
@@ -643,15 +619,14 @@
Topic localCurrentConstraint = currentConstraint == null ? getConstraintOfValueGroup(valueGroup) : currentConstraint;
TopicMap tm = valueGroup.getTopicMap();
- Topic tmclConstraint = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
+ Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.tmclConstraint, tm);
- if(isInstanceOf(localCurrentConstraint, tmclConstraint)) return tmclConstraint;
+ if(isInstanceOf(localCurrentConstraint, tmclConstraintType)) return localCurrentConstraint;
else {
// get next constraint and invoke this method recursively
Topic descriptorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
Topic tmBindingAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlTmBinding, tm);
Topic tmConstructRoleType = getTopicByPsi(GdlPsis.RoleType.gdlTmConstruct, tm);
- Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
Topic gdlDescriptor = getTopicByPsi(GdlPsis.TopicType.gdlDescriptor, tm);
ArrayList<Topic> nextTmclConstraints = getOtherPlayerOfBinaryAssociation(localCurrentConstraint, descriptorRoleType, tmBindingAssocType, null, tmclConstraintType, tmConstructRoleType);
@@ -662,12 +637,12 @@
if(nextTmclConstraints.size() == 1) return nextTmclConstraints.get(0);
else if(nextGdlConstraints.size() == 1) return getRootConstraintOfValueGroup(valueGroup, nextGdlConstraints.get(0));
- else throw new InvalidGdlSchemaException("the value group " + getAnyIdOfTopic(valueGroup) + " must be bound to exaclty on root constraint of the type " + GdlPsis.TMCL.constraint + " but is unbound");
+ else throw new InvalidGdlSchemaException("the value group " + getAnyIdOfTopic(valueGroup) + " must be bound to exaclty on root constraint of the type " + GdlPsis.TMCL.tmclConstraint + " but is unbound");
}
}
- // returns the topic that represent the default tm value for the passed value group
+ // returns the topic that represents the default tm value for the passed value group
public static Topic getDefaultTmValue(Topic valueGroup) throws InvalidGdlSchemaException {
if(valueGroup == null) return null;
@@ -681,19 +656,196 @@
if(defaultTmValues.size() == 1) return defaultTmValues.get(0);
else if(defaultTmValues.size() == 0) return null;
- else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(valueGroup) + " must be bound none or once to a DefaultTmValue, but is: " + defaultTmValues.size());
+ else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(valueGroup) + " must be bound none or once to a " + GdlPsis.TopicType.gdlDefaultTmValue + ", but is: " + defaultTmValues.size());
}
+ // returns the topic that represents the default literal value for the passed value group
public static Topic getDefaultLiteralValue(Topic valueGroup) throws InvalidGdlSchemaException{
+ if(valueGroup == null) return null;
+
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic valueBindingAssocTopic = getTopicByPsi(GdlPsis.AssociationType.gdlValueBinding, tm);
+ Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+ Topic valueRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValue, tm);
+ Topic defaultLiteralValueType = getTopicByPsi(GdlPsis.TopicType.gdlDefaultLiteralValue, tm);
+
+ ArrayList<Topic> defaultTmValues = getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, valueBindingAssocTopic, null, defaultLiteralValueType, valueRoleType);
+
+ if(defaultTmValues.size() == 1) return defaultTmValues.get(0);
+ else if(defaultTmValues.size() == 0) return null;
+ else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(valueGroup) + " must be bound none or once to a " + GdlPsis.TopicType.gdlDefaultLiteralValue + ", but is: " + defaultTmValues.size());
+ }
+
+
+ // returns the topics that represent the tm values for the passed value group
+ public static ArrayList<Topic> getTmValues(Topic valueGroup) throws InvalidGdlSchemaException {
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(valueGroup == null) return result;
+
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic valueBindingAssocTopic = getTopicByPsi(GdlPsis.AssociationType.gdlValueBinding, tm);
+ Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+ Topic valueRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValue, tm);
+ Topic tmValueType = getTopicByPsi(GdlPsis.TopicType.gdlTmValue, tm);
+
+ return getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, valueBindingAssocTopic, null, tmValueType, valueRoleType);
+ }
+
+
+ // returns the topics that represent the literal value for the passed value group
+ public static ArrayList<Topic> getLiteralValues(Topic valueGroup){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(valueGroup == null) return result;
+
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic valueBindingAssocTopic = getTopicByPsi(GdlPsis.AssociationType.gdlValueBinding, tm);
+ Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+ Topic valueRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValue, tm);
+ Topic literalValueType = getTopicByPsi(GdlPsis.TopicType.gdlLiteralValue, tm);
+
+ return getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, valueBindingAssocTopic, null, literalValueType, valueRoleType);
+ }
+
+
+ // returns the topic that can be used to satisfy the passed constraint.
+ public static ArrayList<Topic> getTmValuesForConstraint(Topic constraint, Topic valueGroup) throws InvalidGdlSchemaException {
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(constraint == null || valueGroup == null) return result;
+
+ if(isInstanceOf(constraint, GdlPsis.TopicType.gdlType)){
+ return getTmValuesForTypeConstraint(constraint, valueGroup);
+ } else if(isInstanceOf(constraint, GdlPsis.TopicType.gdlVariantNameReifier)){
+ return getTmValuesForVariantNameReifierConstraint(constraint);
+ } else if(isInstanceOf(constraint, GdlPsis.TopicType.gdlVariantNameScope)){
+ return getTmValuesForVariantNameScopeConstraint(constraint);
+ } else if(isInstanceOf(constraint, GdlPsis.TopicType.gdlRolePlayer)){
+ return getTmValuesForRolePlayerConstraint(constraint);
+ } else if(isInstanceOf(constraint, GdlPsis.TMCL.tmclReifierConstraint)){
+ return getTmValuesForReifierConstraint(constraint);
+ } else if(isInstanceOf(constraint, GdlPsis.TMCL.tmclScopeConstraint)){
+ return getTmValuesForScopeConstraint(constraint);
+ }
+
+ return result;
+ }
+
+
+ // returns the topic that can be used to satisfy the passed role-player-constraint.
+ public static ArrayList<Topic> getTmValuesForScopeConstraint(Topic scopeConstraint){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(scopeConstraint == null) return result;
// TODO: implement
- return null;
+
+ return result;
}
- public static ArrayList<Topic> getTmValue(Topic valueGroup) throws InvalidGdlSchemaException {
+ // returns the topic that can be used to satisfy the passed role-player-constraint.
+ public static ArrayList<Topic> getTmValuesForReifierConstraint(Topic reifierConstraint){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(reifierConstraint == null) return result;
// TODO: implement
- // TODO: if no tm-values are set, examine the tmcl constraint
- return null;
+
+ return result;
+ }
+
+
+ // returns the topic that can be used to satisfy the passed role-player-constraint.
+ public static ArrayList<Topic> getTmValuesForRolePlayerConstraint(Topic rolePlayerConstraint){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(rolePlayerConstraint == null) return result;
+ // TODO: implement
+
+ return result;
+ }
+
+
+ // returns the topic that can be used to satisfy the passed type-constraint.
+ public static ArrayList<Topic> getTmValuesForTypeConstraint(Topic typeConstraint, Topic valueGroup) throws InvalidGdlSchemaException {
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(typeConstraint == null || valueGroup == null) return result;
+
+ Topic rootConstraint = getRootConstraintOfValueGroup(valueGroup, typeConstraint);
+ if(rootConstraint == null) return result;
+
+ if(isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclTopicNameConstraint) || isInstanceOf(rootConstraint, GdlPsis.TMCL.tmclTopicOccurrenceConstraint)){
+
+ } else if(true /* TODO: association */){
+
+ } else if(true /* TODO: role */){
+
+ }
+
+ return result;
+ }
+
+
+ // returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
+ public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(variantNameReifierConstraint == null) return result;
+ // TODO: implement
+
+ return result;
+ }
+
+
+ // returns the topic that can be used to satisfy the passed variant-name-scope-constraint.
+ public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint){
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(variantNameScopeConstraint == null) return result;
+ // TODO: implement
+
+ return result;
+ }
+
+
+ // returns the regular expression for a constraint. If no regular-expression constraint is set for the
+ // constrained-statement of the passed constraint, the value ".*" is returned
+ public static String getLiteralValueForConstraint(Topic constraint) throws InvalidGdlSchemaException {
+ String result = ".*";
+ if(constraint == null) return result;
+
+ TopicMap tm = constraint.getTopicMap();
+ Topic constraintRoleType = getTopicByPsi(GdlPsis.TMCL.tmclConstraint, tm);
+ Topic constrainedStatementAssocType = getTopicByPsi(GdlPsis.TMCL.tmclConstrainedStatement, tm);
+ Topic constrainedRoleType = getTopicByPsi(GdlPsis.TMCL.tmclConstrained, tm);
+ Topic nameType = getTopicByPsi(GdlPsis.TMCL.tmclNameType, tm);
+ Topic occurrenceType = getTopicByPsi(GdlPsis.TMCL.tmclOccurrenceType, tm);
+ ArrayList<Topic> nameTypes = getOtherPlayerOfBinaryAssociation(constraint, constraintRoleType, constrainedStatementAssocType, null, nameType, constrainedRoleType);
+ ArrayList<Topic> occurrenceTypes = getOtherPlayerOfBinaryAssociation(constraint, constraintRoleType, constrainedStatementAssocType, null, occurrenceType, constrainedRoleType);
+ ArrayList<Topic> nameOrOccurrenceTypes = Utils.union(nameTypes, occurrenceTypes);
+
+ if(nameOrOccurrenceTypes.size() == 0){
+ return result;
+ } else if(nameOrOccurrenceTypes.size() > 1){
+ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraint) + " must be bound maximum once to a topic via a " + GdlPsis.TMCL.tmclConstrainedStatement + ", but is: " + nameOrOccurrenceTypes.size());
+ } else {
+ Topic regularExpressionConstraintType = getTopicByPsi(GdlPsis.TMCL.tmclRegularExpressionConstraint, tm);
+ ArrayList<Topic> regularExpressionConstraints = getOtherPlayerOfBinaryAssociation(nameOrOccurrenceTypes.get(0), constrainedRoleType, constrainedStatementAssocType, null, regularExpressionConstraintType, constraintRoleType);
+
+ if(regularExpressionConstraints.size() == 0) {
+ return ".*";
+ } else if(regularExpressionConstraints.size() == 1){
+ Topic regexpOccurrenceType = getTopicByPsi(GdlPsis.TMCL.tmclRegexp, tm);
+ Occurrence rex = getSingleOccurrence(regularExpressionConstraints.get(0), regexpOccurrenceType);
+ return rex.getValue();
+ } else {
+ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(nameOrOccurrenceTypes.get(0)) + " must be bound maximum once to a " + GdlPsis.TMCL.tmclRegularExpressionConstraint + ", but is: " + regularExpressionConstraints.size());
+ }
+ }
+ }
+
+
+ // return the occurrence of the passed type, if the topic contains more than one such occurrences,
+ // this function throws a InvalidgdlSchemaException
+ public static Occurrence getSingleOccurrence(Topic topic, Topic occurrenceType) throws InvalidGdlSchemaException {
+ if(topic == null) return null;
+
+ JsArray<Occurrence> occs = topic.getOccurrences(occurrenceType);
+ if(occs.length() > 1) throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(topic) + " must contains maximum one occurrence of the type " + getAnyIdOfTopic(occurrenceType) + ", but conaints: " + occs.length());
+ else if(occs.length() == 0) return null;
+ else return occs.get(0);
}
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java Sun Jul 31 02:09:48 2011 (r693)
@@ -23,6 +23,17 @@
}
+ // returns an ArrayList that is a union of fst and snd
+ public static <T> ArrayList<T> union(ArrayList<T> fst, ArrayList<T> snd){
+ ArrayList<T> result = new ArrayList<T>();
+
+ if(fst != null) for (T t : fst) if(!result.contains(t)) result.add(t);
+ if(snd != null) for (T t : fst) if(!result.contains(t)) result.add(t);
+
+ return result;
+ }
+
+
// returns true if the string consists only of digits
public static boolean isDecNumber(String str){
if(str == null) return false;
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Sun Jul 31 02:09:48 2011 (r693)
@@ -45,6 +45,12 @@
protected boolean rootConstraintTopicSet = false;
protected Topic defaultTmValueTopic = null;
protected boolean defaultTmValueTopicSet = false;
+ protected Topic defaultLiteralValueTopic = null;
+ protected boolean defaultLiteralValueTopicSet = false;
+ protected ArrayList<Topic> tmValueTopics = new ArrayList<Topic>();
+ protected boolean tmValueTopicsSet = false;
+ protected ArrayList<Topic> literalValueTopics = new ArrayList<Topic>();
+ protected boolean literalValueTopicsSet = false;
// some constructors
protected GdlText() throws InvalidGdlSchemaException, ExecutionException {
@@ -574,7 +580,6 @@
// cols is only treated if width is not set
if(widthOcc == null) DOM.setElementAttribute(widget.getElement(), "cols", String.valueOf(value));
}
-
// calls the super applies the GdlStyle for every TextArea item of this instance
@@ -867,8 +872,13 @@
@Override
public Topic getDefaultLiteralValue() throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
- return null;
+ if(this.defaultLiteralValueTopicSet){
+ return this.defaultLiteralValueTopic;
+ } else {
+ this.defaultLiteralValueTopic = TmHelper.getDefaultLiteralValue(this.getValueGroup());
+ this.defaultLiteralValueTopicSet = true;
+ return this.defaultLiteralValueTopic;
+ }
}
@@ -882,15 +892,25 @@
@Override
public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
- return null;
+ if(this.tmValueTopicsSet){
+ return this.tmValueTopics;
+ } else {
+ this.tmValueTopics = TmHelper.getTmValues(this.getValueGroup());
+ this.tmValueTopicsSet = true;
+ return this.tmValueTopics;
+ }
}
@Override
public ArrayList<Topic> getLiteralValues() throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
- return null;
+ if(this.literalValueTopicsSet){
+ return this.literalValueTopics;
+ } else {
+ this.literalValueTopics = TmHelper.getLiteralValues(this.getValueGroup());
+ this.literalValueTopicsSet = true;
+ return this.literalValueTopics;
+ }
}
@@ -906,4 +926,16 @@
// TODO Auto-generated method stub
return null;
}
+
+
+ @Override
+ public ArrayList<Topic> getTmValuesForConstraint() throws InvalidGdlSchemaException {
+ return TmHelper.getTmValuesForConstraint(this.getConstraint(), this.getValueGroup());
+ }
+
+
+ @Override
+ public String getLiteralValueForConstraint() throws InvalidGdlSchemaException {
+ return TmHelper.getLiteralValueForConstraint(this.getConstraint());
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 10:18:30 2011 (r692)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Sun Jul 31 02:09:48 2011 (r693)
@@ -28,6 +28,7 @@
{"subject_identifiers":["[gdl:border-width]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[tmcl:card-max]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[tmcl:card-min]"], "instance_of":["si:[tmcl:occurrence-type]"]},
+ {"subject_identifiers":["[tmcl:regexp]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[doc:test-schema]"], "instance_of":["si:[gdl:Schema]"], "names":[{"value": "Test GDL Schema", "type":"si:[gdl:schema-name]"}]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
{"subject_identifiers":["[doc:person-name]"], "instance_of":["si:[tmcl:name-type]"]},
@@ -41,6 +42,7 @@
{"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[gdl:value]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
+ {"subject_identifiers":["[tmcl:regular-expression-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdl:Value-Group]"]},
{"subject_identifiers":["[gdl:Text-Object]"]},
{"subject_identifiers":["[gdl:Type]"]},
@@ -100,6 +102,7 @@
{"subject_identifiers":["[doc:default-tm-value-person-name-type-constraint]"], "instance_of":["si:[gdl:Default-TM-Instance-Value]"]},
{"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
{"subject_identifiers":["[doc:person-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
+ {"subject_identifiers":["[doc:person-name-regexp-constraint]"], "instance_of":["si:[tmcl:regular-expression-constraint]"], "occurrences":[{"type":"si:[tmcl:regexp]", "value":"^[A-Z][a-z]+ [A-Z][a-z]+$"}]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-check-box]"], "instance_of":["si:[gdl:Check-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_check_box_id"},{"type":"si:[gdl:content-orientation]", "value":"vertical"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin]", "value":"30pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-action-button]"], "instance_of":["si:[gdl:Action-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_action_button"}]},
@@ -223,6 +226,7 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Director]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Poet]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Musician]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:regular-expression-constraint]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -279,5 +283,6 @@
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:default-tm-value-person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:Poet]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]},
{"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"},{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"}]},
- {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:Person]"}]}
+ {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:Person]"}]},
+ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-regexp-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"}]}
]}
\ No newline at end of file
1
0

[isidorus-cvs] r692 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/text war/gdl_widgets
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 10:18:30 2011
New Revision: 692
Log:
gdl-frontend: Widgets: fixed and extended the test.gdl.jtm file
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Jul 28 08:22:27 2011 (r691)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Jul 28 10:18:30 2011 (r692)
@@ -1,4 +1,3 @@
-* peson-name-constraint: create a person topic type, bind the person-name to this topic type, set the default-tm-value
* Implement all IHasValueGroup to:
* GdlText
* GdlInfo
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 08:22:27 2011 (r691)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 10:18:30 2011 (r692)
@@ -57,8 +57,6 @@
// TODO: create a text element for each TM-elem
this.createNewTextArea().setText("Text"); // TODO: remove only for debugging
this.setNthButtons();
-
- Window.alert(TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " >> " + TmHelper.getAnyIdOfTopic(this.getDefaultTmValue())); // TODO: remove
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 08:22:27 2011 (r691)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 10:18:30 2011 (r692)
@@ -35,13 +35,18 @@
{"subject_identifiers":["[doc:musician-name]"]},
{"subject_identifiers":["[doc:director-name]"]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
- {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
+ {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]","si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[tmcl:constrained]"], "instance_of":["si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[tmcl:constrained-statement]"], "instance_of":["si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:role-type]"]},
+ {"subject_identifiers":["[gdl:value]"], "instance_of":["si:[tmcl:role-type]"]},
{"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdl:Value-Group]"]},
{"subject_identifiers":["[gdl:Text-Object]"]},
{"subject_identifiers":["[gdl:Type]"]},
{"subject_identifiers":["[gdl:Position]"]},
{"subject_identifiers":["[gdl:position]"], "instance_of":["si:[tmcl:association-type]"]},
+ {"subject_identifiers":["[gdl:value-binding]"], "instance_of":["si:[tmcl:association-type]"]},
{"subject_identifiers":["[doc:value-group-person-name]"], "instance_of":["si:[gdl:Value-Group]"]},
{"subject_identifiers":["[gdl:margin-left]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[gdl:border-style]"], "instance_of":["si:[tmcl:occurrence-type]"]},
@@ -92,7 +97,7 @@
{"subject_identifiers":["[gdl:Title]"]},
{"subject_identifiers":["[gdl:Reference]"]},
{"subject_identifiers":["[gdl:List]"]},
- {"subject_identifiers":["[doc:default-tm-value-person-name-type-constraint]"], "instance_of":["si:[gdl:Default-TM-Instance-Value]"]},
+ {"subject_identifiers":["[doc:default-tm-value-person-name-type-constraint]"], "instance_of":["si:[gdl:Default-TM-Instance-Value]"]},
{"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
{"subject_identifiers":["[doc:person-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
@@ -163,9 +168,10 @@
{"subject_identifiers":["[doc:default-creator-topic-view-2]"], "instance_of":["si:[gdl:Default-Creator-Topic-View]"], "names":[{"value": "Def. Creator View 2", "type":"si:[gdl:view-name]"}], "occurrences":[{"type":"si:[gdl:id]", "value":"default_creator_topic_view_2_id", "datatype":"[xsd:ID]"}]},
{"subject_identifiers":["[doc:default-editor-topic-view]"], "instance_of":["si:[gdl:Default-Editor-Topic-View]"], "names":[{"value": "Def. Editor View", "type":"si:[gdl:view-name]"}], "occurrences":[{"type":"si:[gdl:id]", "value":"default_editor_topic_view_id", "datatype":"[xsd:ID]"}]},
{"subject_identifiers":["[doc:special-creator-topic-view]"], "instance_of":["si:[gdl:Special-Creator-Topic-View]"], "names":[{"value": "Spec. Creator View", "type":"si:[gdl:view-name]"}], "occurrences":[{"type":"si:[gdl:id]", "value":"special_creator_topic_view_id", "datatype":"[xsd:ID]"}]},
- {"subject_identifiers":["[doc:Poet]"], "instance_of":["si:[tmcl:topic-type]"]},
- {"subject_identifiers":["[doc:Musician]"], "instance_of":["si:[tmcl:topic-type]"]},
- {"subject_identifiers":["[doc:Director]"], "instance_of":["si:[tmcl:topic-type]"]}
+ {"subject_identifiers":["[doc:Person]"], "instance_of":["si:[tmcl:topic-type]"]},
+ {"subject_identifiers":["[doc:Poet]"]},
+ {"subject_identifiers":["[doc:Musician]"]},
+ {"subject_identifiers":["[doc:Director]"]}
],
"associations":[{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Visible-Object]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Visible-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:View]"}]},
@@ -185,9 +191,10 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-Literal-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Value]"}]},
- {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Type-Value]"}]},
- {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Single-Type-Value]"}]},
- {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Multiple-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Single-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Multiple-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Instance-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Instance-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Multiple-Type-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Visible-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Text-Object]"}]},
@@ -213,6 +220,9 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:musician-name]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:poet-name]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:director-name]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Director]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Poet]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:Person]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:Musician]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -264,5 +274,10 @@
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-reference]"},{"type":"si:[gdl:containee]", "player":"si:[doc:info-1]"}]},
{"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:descriptor]", "player":"si:[doc:text-1]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-type-constraint]"}]},
- {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]}
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]},
+ {"type":"si:[gdl:value-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:value]", "player":"si:[doc:default-tm-value-person-name-type-constraint]"}]},
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:default-tm-value-person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:Poet]"}]},
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]},
+ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constrained]", "player":"si:[doc:person-name]"},{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"}]},
+ {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[doc:person-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[doc:Person]"}]}
]}
\ No newline at end of file
1
0

[isidorus-cvs] r691 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/text war/gdl_widgets
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 08:22:27 2011
New Revision: 691
Log:
gdl-frontend: Widgets: implemented the method TmHelper.getDefaultTmValue() that returns the topic that represents the tm-default-value; extended the test.gdl.jtm file
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Jul 28 08:22:27 2011 (r691)
@@ -1,3 +1,4 @@
+* peson-name-constraint: create a person topic type, bind the person-name to this topic type, set the default-tm-value
* Implement all IHasValueGroup to:
* GdlText
* GdlInfo
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 28 08:22:27 2011 (r691)
@@ -189,6 +189,7 @@
public final static String gdlTmBinding = gdl + "tm-binding";
public final static String gdlViewBinding = gdl + "view-binding";
public final static String gdlTopicViewBinding = gdl + "topic-view-binding";
+ public final static String gdlValueBinding = gdl + "value-binding";
}
@@ -205,6 +206,7 @@
public final static String gdlValueGroup = gdl + "value-group";
public final static String gdlTmValue = gdl + "tm-value";
public final static String gdlActionButton = gdl + "action-button";
+ public final static String gdlValue = gdl + "value";
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 08:22:27 2011 (r691)
@@ -31,7 +31,9 @@
// i.e. is is one value of getDefaultTmValue(), getDefaultLiteralValue()
public Topic getDefaultValue() throws InvalidGdlSchemaException;
- // returns all possible topics that can be used as values for this value group
+ // returns all possible topics that can be used as values for this value group,
+ // i.e. if no tm-values are bound to this value-group, all possible values are
+ // generated by examining the tmcl:constraint
public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException;
// returns all possible literals that can be used as values for this value group
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 08:22:27 2011 (r691)
@@ -665,4 +665,35 @@
else throw new InvalidGdlSchemaException("the value group " + getAnyIdOfTopic(valueGroup) + " must be bound to exaclty on root constraint of the type " + GdlPsis.TMCL.constraint + " but is unbound");
}
}
+
+
+ // returns the topic that represent the default tm value for the passed value group
+ public static Topic getDefaultTmValue(Topic valueGroup) throws InvalidGdlSchemaException {
+ if(valueGroup == null) return null;
+
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic valueBindingAssocTopic = getTopicByPsi(GdlPsis.AssociationType.gdlValueBinding, tm);
+ Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+ Topic valueRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValue, tm);
+ Topic defaultTmValueType = getTopicByPsi(GdlPsis.TopicType.gdlDefaultTmValue, tm);
+
+ ArrayList<Topic> defaultTmValues = getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, valueBindingAssocTopic, null, defaultTmValueType, valueRoleType);
+
+ if(defaultTmValues.size() == 1) return defaultTmValues.get(0);
+ else if(defaultTmValues.size() == 0) return null;
+ else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(valueGroup) + " must be bound none or once to a DefaultTmValue, but is: " + defaultTmValues.size());
+ }
+
+
+ public static Topic getDefaultLiteralValue(Topic valueGroup) throws InvalidGdlSchemaException{
+ // TODO: implement
+ return null;
+ }
+
+
+ public static ArrayList<Topic> getTmValue(Topic valueGroup) throws InvalidGdlSchemaException {
+ // TODO: implement
+ // TODO: if no tm-values are set, examine the tmcl constraint
+ return null;
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 08:22:27 2011 (r691)
@@ -43,6 +43,8 @@
protected boolean constraintTopicSet = false;
protected Topic rootConstraintTopic = null;
protected boolean rootConstraintTopicSet = false;
+ protected Topic defaultTmValueTopic = null;
+ protected boolean defaultTmValueTopicSet = false;
// some constructors
protected GdlText() throws InvalidGdlSchemaException, ExecutionException {
@@ -55,6 +57,8 @@
// TODO: create a text element for each TM-elem
this.createNewTextArea().setText("Text"); // TODO: remove only for debugging
this.setNthButtons();
+
+ Window.alert(TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " >> " + TmHelper.getAnyIdOfTopic(this.getDefaultTmValue())); // TODO: remove
}
@@ -817,29 +821,34 @@
@Override
public Topic getValueGroup() throws InvalidGdlSchemaException {
- if(!this.valueGroupTopicSet) this.valueGroupTopic = TmHelper.getValueGroupOf(this.tmRepresentative);
- return this.valueGroupTopic;
+ if(this.valueGroupTopicSet){
+ return this.valueGroupTopic;
+ } else {
+ this.valueGroupTopic = TmHelper.getValueGroupOf(this.tmRepresentative);
+ this.valueGroupTopicSet = true;
+ return this.valueGroupTopic;
+ }
}
@Override
public Topic getConstraint() throws InvalidGdlSchemaException {
- Topic valueGroup = this.getValueGroup();
- if(valueGroup != null) this.constraintTopic = TmHelper.getConstraintOfValueGroup(valueGroup);
- this.constraintTopicSet = true;
- return this.constraintTopic;
+ if(this.constraintTopicSet){
+ return this.constraintTopic;
+ } else {
+ this.constraintTopic = TmHelper.getConstraintOfValueGroup(this.getValueGroup());
+ this.constraintTopicSet = true;
+ return this.constraintTopic;
+ }
}
@Override
public Topic getRootConstraint() throws InvalidGdlSchemaException {
- Topic valueGroup = this.getValueGroup();
- this.rootConstraintTopicSet = true;
- if(valueGroup == null) {
- this.rootConstraintTopicSet = true;
- return null;
+ if(this.rootConstraintTopicSet){
+ return this.rootConstraintTopic;
} else {
- this.rootConstraintTopic = TmHelper.getRootConstraintOfValueGroup(valueGroup, this.getConstraint());
+ this.rootConstraintTopic = TmHelper.getRootConstraintOfValueGroup(this.getValueGroup(), this.getConstraint());
this.rootConstraintTopicSet = true;
return this.rootConstraintTopic;
}
@@ -848,8 +857,13 @@
@Override
public Topic getDefaultTmValue() throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
- return null;
+ if(this.defaultTmValueTopicSet){
+ return this.defaultTmValueTopic;
+ } else {
+ this.defaultTmValueTopic = TmHelper.getDefaultTmValue(this.getValueGroup());
+ this.defaultTmValueTopicSet = true;
+ return this.defaultTmValueTopic;
+ }
}
@@ -862,7 +876,9 @@
@Override
public Topic getDefaultValue() throws InvalidGdlSchemaException {
- return this.getDefaultLiteralValue() == null ? this.getDefaultTmValue() : this.getDefaultLiteralValue();
+ if(this.getDefaultLiteralValue() != null && this.getDefaultTmValue() != null) throw new InvalidGdlSchemaException("the topic " + TmHelper.getAnyIdOfTopic(this.getValueGroup()) + " must be bound to maximal one " + GdlPsis.TopicType.gdlDefaultValue + ", but is: 2");
+ else if(this.getDefaultLiteralValue() != null) return this.getDefaultLiteralValue();
+ else return this.getDefaultTmValue();
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 06:35:52 2011 (r690)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 08:22:27 2011 (r691)
@@ -30,6 +30,11 @@
{"subject_identifiers":["[tmcl:card-min]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[doc:test-schema]"], "instance_of":["si:[gdl:Schema]"], "names":[{"value": "Test GDL Schema", "type":"si:[gdl:schema-name]"}]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
+ {"subject_identifiers":["[doc:person-name]"], "instance_of":["si:[tmcl:name-type]"]},
+ {"subject_identifiers":["[doc:poet-name]"]},
+ {"subject_identifiers":["[doc:musician-name]"]},
+ {"subject_identifiers":["[doc:director-name]"]},
+ {"subject_identifiers":["[gdl:Visible-Object]"]},
{"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdl:Value-Group]"]},
@@ -63,6 +68,21 @@
{"subject_identifiers":["[gdl:Button]"]},
{"subject_identifiers":["[gdl:Action-Button]"]},
{"subject_identifiers":["[gdl:Input-Button]"]},
+ {"subject_identifiers":["[gdl:Value]"]},
+ {"subject_identifiers":["[gdl:Default-Value]"]},
+ {"subject_identifiers":["[gdl:Input-Button]"]},
+ {"subject_identifiers":["[gdl:Literal-Value]"]},
+ {"subject_identifiers":["[gdl:TM-Value]"]},
+ {"subject_identifiers":["[gdl:TM-Type-Value]"]},
+ {"subject_identifiers":["[gdl:TM-Single-Type-Value]"]},
+ {"subject_identifiers":["[gdl:TM-Multiple-Type-Value]"]},
+ {"subject_identifiers":["[gdl:TM-Instance-Value"]},
+ {"subject_identifiers":["[gdl:Default-Literal-Value]"]},
+ {"subject_identifiers":["[gdl:Default-TM-Value]"]},
+ {"subject_identifiers":["[gdl:Default-TM-Type-Value]"]},
+ {"subject_identifiers":["[gdl:Default-TM-Single-Type-Value]"]},
+ {"subject_identifiers":["[gdl:Default-TM-Multiple-Type-Value]"]},
+ {"subject_identifiers":["[gdl:Default-TM-Instance-Value]"]},
{"subject_identifiers":["[gdl:Delete-Button]"]},
{"subject_identifiers":["[gdl:Create-Button]"]},
{"subject_identifiers":["[gdl:Radio-Button]"]},
@@ -72,6 +92,7 @@
{"subject_identifiers":["[gdl:Title]"]},
{"subject_identifiers":["[gdl:Reference]"]},
{"subject_identifiers":["[gdl:List]"]},
+ {"subject_identifiers":["[doc:default-tm-value-person-name-type-constraint]"], "instance_of":["si:[gdl:Default-TM-Instance-Value]"]},
{"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
{"subject_identifiers":["[doc:person-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
@@ -98,7 +119,6 @@
{"subject_identifiers":["[doc:pos-of-unit-1-text]"], "instance_of":["si:[gdl:Position]"]},
{"subject_identifiers":["[doc:reference-1]"], "instance_of":["si:[gdl:Reference]"], "occurrences":[{"type":"si:[gdl:id]", "value":"reference_1_id", "datatype":"[xsd:ID]"}, {"type":"si:[gdl:margin-left]", "value":"200px"}, {"type":"si:[gdl:background-color]", "value":"yellow"}]},
{"subject_identifiers":["[doc:list-box-1]"], "instance_of":["si:[gdl:List-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"list_box_1_id", "datatype":"[xsd:ID]"}]},
- {"subject_identifiers":["[gdl:Value]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[doc:pos-of-title-1]"], "instance_of":["si:[gdl:Position]"]},
{"subject_identifiers":["[doc:pos-of-text-1]"], "instance_of":["si:[gdl:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"relative"}, {"type":"si:[gdl:top]", "value":"40px"}, {"type":"si:[gdl:left]", "value": "5%"}]},
{"subject_identifiers":["[doc:pos-of-reference-1]"], "instance_of":["si:[gdl:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"static"}]},
@@ -111,7 +131,6 @@
{"subject_identifiers":["[gdl:bottom]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[gdl:left]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[gdl:content-orientation]"], "instance_of":["si:[tmcl:occurrence-type]"]},
- {"subject_identifiers":["[gdl:TM-Value]"]},
{"subject_identifiers":["[gdl:Unit]"]},
{"subject_identifiers":["[gdl:Nth-Element]"]},
{"subject_identifiers":["[gdl:nth-value]"], "instance_of":["si:[tmcl:occurrence-type]"]},
@@ -157,6 +176,18 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-Topic-View]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Editor-Topic-View]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Special-Topic-View]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Special-Creator-Topic-View]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Literal-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Single-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Multiple-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Instance-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-Literal-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Single-Type-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Default-TM-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Default-TM-Multiple-Type-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Instance-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:TM-Multiple-Type-Value]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Visible-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Text-Object]"}]},
@@ -179,6 +210,9 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Value-Group]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Type]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:musician-name]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:poet-name]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[doc:person-name]"},{"type":"si:[tmdm:subtype]", "player":"si:[doc:director-name]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
1
0

[isidorus-cvs] r690 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 06:35:52 2011
New Revision: 690
Log:
gdl-frontend: Widgets: implemented the method GdlText.getDefaultValue()
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 04:44:52 2011 (r689)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 06:35:52 2011 (r690)
@@ -20,17 +20,22 @@
// root constraint
public Topic getRootConstraint() throws InvalidGdlSchemaException;
- // returns all topics that are set as default values for this value group
- public ArrayList<Topic> getDefaultTmValues() throws InvalidGdlSchemaException;
+ // returns the topic that represents the default value
+ public Topic getDefaultTmValue() throws InvalidGdlSchemaException;
- // returns the literal default value for this value group
- public String getDefaultLiteralValue() throws InvalidGdlSchemaException;
+ // returns the topic that represents the literal default value
+ // for this value group
+ public Topic getDefaultLiteralValue() throws InvalidGdlSchemaException;
+
+ // returns the topic that is the default value of this value group,
+ // i.e. is is one value of getDefaultTmValue(), getDefaultLiteralValue()
+ public Topic getDefaultValue() throws InvalidGdlSchemaException;
// returns all possible topics that can be used as values for this value group
public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException;
// returns all possible literals that can be used as values for this value group
- public ArrayList<String> getLiteralValues() throws InvalidGdlSchemaException;
+ public ArrayList<Topic> getLiteralValues() throws InvalidGdlSchemaException;
// returns the literal value that is set on an item
public String getSetLiteralValue() throws InvalidGdlSchemaException;
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 04:44:52 2011 (r689)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 06:35:52 2011 (r690)
@@ -847,18 +847,23 @@
@Override
- public ArrayList<Topic> getDefaultTmValues()
- throws InvalidGdlSchemaException {
+ public Topic getDefaultTmValue() throws InvalidGdlSchemaException {
// TODO Auto-generated method stub
return null;
}
@Override
- public String getDefaultLiteralValue() throws InvalidGdlSchemaException {
+ public Topic getDefaultLiteralValue() throws InvalidGdlSchemaException {
// TODO Auto-generated method stub
return null;
}
+
+
+ @Override
+ public Topic getDefaultValue() throws InvalidGdlSchemaException {
+ return this.getDefaultLiteralValue() == null ? this.getDefaultTmValue() : this.getDefaultLiteralValue();
+ }
@Override
@@ -869,8 +874,7 @@
@Override
- public ArrayList<String> getLiteralValues()
- throws InvalidGdlSchemaException {
+ public ArrayList<Topic> getLiteralValues() throws InvalidGdlSchemaException {
// TODO Auto-generated method stub
return null;
}
1
0

[isidorus-cvs] r689 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/text war/gdl_widgets
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 04:44:52 2011
New Revision: 689
Log:
gdl-frontend: Widgets: implemented the static method TmHelper.getRootConstraintOfValueGroup(Topic valueGroup) that can be used by all visible elements to retrieve the bound tmcl contraint instance to their gdl:Value-Group instance
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 03:31:02 2011 (r688)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 04:44:52 2011 (r689)
@@ -633,4 +633,36 @@
else if (gdlConstraints.size() == 1) return gdlConstraints.get(0);
else return null;
}
+
+
+ // returns the root constraint of a gdl:Value-Group instance, i.e. a tmcl constraint.
+ // E.g. a value group may be bound to a gdl:Type constraint and this constraint may be bound
+ // to a tmcl:constraint, the root constraint is the instance of the tmcl:constraint
+ public static Topic getRootConstraintOfValueGroup(Topic valueGroup, Topic currentConstraint) throws InvalidGdlSchemaException {
+ if(valueGroup == null) return null;
+
+ Topic localCurrentConstraint = currentConstraint == null ? getConstraintOfValueGroup(valueGroup) : currentConstraint;
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic tmclConstraint = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
+
+ if(isInstanceOf(localCurrentConstraint, tmclConstraint)) return tmclConstraint;
+ else {
+ // get next constraint and invoke this method recursively
+ Topic descriptorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
+ Topic tmBindingAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlTmBinding, tm);
+ Topic tmConstructRoleType = getTopicByPsi(GdlPsis.RoleType.gdlTmConstruct, tm);
+ Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
+ Topic gdlDescriptor = getTopicByPsi(GdlPsis.TopicType.gdlDescriptor, tm);
+
+ ArrayList<Topic> nextTmclConstraints = getOtherPlayerOfBinaryAssociation(localCurrentConstraint, descriptorRoleType, tmBindingAssocType, null, tmclConstraintType, tmConstructRoleType);
+ ArrayList<Topic> nextGdlConstraints = getOtherPlayerOfBinaryAssociation(localCurrentConstraint, descriptorRoleType, tmBindingAssocType, null, gdlDescriptor, tmConstructRoleType);
+
+ if(nextTmclConstraints.size() > 1 || nextGdlConstraints.size() > 1 || (nextTmclConstraints.size() == 1 && nextGdlConstraints.size() == 1))
+ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(localCurrentConstraint) + " can be bound only to one constraint, but is " + (nextTmclConstraints.size() + nextGdlConstraints.size()));
+
+ if(nextTmclConstraints.size() == 1) return nextTmclConstraints.get(0);
+ else if(nextGdlConstraints.size() == 1) return getRootConstraintOfValueGroup(valueGroup, nextGdlConstraints.get(0));
+ else throw new InvalidGdlSchemaException("the value group " + getAnyIdOfTopic(valueGroup) + " must be bound to exaclty on root constraint of the type " + GdlPsis.TMCL.constraint + " but is unbound");
+ }
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 03:31:02 2011 (r688)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 04:44:52 2011 (r689)
@@ -39,6 +39,10 @@
protected ArrayList<HandlerRegistration> passwordKeyPressRegistrations = null;
protected Topic valueGroupTopic = null;
protected boolean valueGroupTopicSet = false;
+ protected Topic constraintTopic = null;
+ protected boolean constraintTopicSet = false;
+ protected Topic rootConstraintTopic = null;
+ protected boolean rootConstraintTopicSet = false;
// some constructors
protected GdlText() throws InvalidGdlSchemaException, ExecutionException {
@@ -821,14 +825,24 @@
@Override
public Topic getConstraint() throws InvalidGdlSchemaException {
Topic valueGroup = this.getValueGroup();
- return valueGroup == null ? null : TmHelper.getConstraintOfValueGroup(valueGroup);
+ if(valueGroup != null) this.constraintTopic = TmHelper.getConstraintOfValueGroup(valueGroup);
+ this.constraintTopicSet = true;
+ return this.constraintTopic;
}
@Override
public Topic getRootConstraint() throws InvalidGdlSchemaException {
- // TODO Auto-generated method stub
- return null;
+ Topic valueGroup = this.getValueGroup();
+ this.rootConstraintTopicSet = true;
+ if(valueGroup == null) {
+ this.rootConstraintTopicSet = true;
+ return null;
+ } else {
+ this.rootConstraintTopic = TmHelper.getRootConstraintOfValueGroup(valueGroup, this.getConstraint());
+ this.rootConstraintTopicSet = true;
+ return this.rootConstraintTopic;
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 03:31:02 2011 (r688)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 04:44:52 2011 (r689)
@@ -26,8 +26,12 @@
{"subject_identifiers":["[gdl:view-name]"], "instance_of":["si:[tmcl:name-type]"]},
{"subject_identifiers":["[gdl:Descriptor]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdl:border-width]"], "instance_of":["si:[tmcl:occurrence-type]"]},
+ {"subject_identifiers":["[tmcl:card-max]"], "instance_of":["si:[tmcl:occurrence-type]"]},
+ {"subject_identifiers":["[tmcl:card-min]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[doc:test-schema]"], "instance_of":["si:[gdl:Schema]"], "names":[{"value": "Test GDL Schema", "type":"si:[gdl:schema-name]"}]},
{"subject_identifiers":["[gdl:Visible-Object]"]},
+ {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
+ {"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdl:Value-Group]"]},
{"subject_identifiers":["[gdl:Text-Object]"]},
{"subject_identifiers":["[gdl:Type]"]},
@@ -69,6 +73,7 @@
{"subject_identifiers":["[gdl:Reference]"]},
{"subject_identifiers":["[gdl:List]"]},
{"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
+ {"subject_identifiers":["[doc:person-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-check-box]"], "instance_of":["si:[gdl:Check-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_check_box_id"},{"type":"si:[gdl:content-orientation]", "value":"vertical"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin]", "value":"30pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-action-button]"], "instance_of":["si:[gdl:Action-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_action_button"}]},
@@ -173,6 +178,7 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Create-Button]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Value-Group]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Type]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -223,5 +229,6 @@
{"type":"si:[gdl:button-position]", "roles":[{"type":"si:[gdl:nth-element]", "player":"si:[doc:nth-elem-del-btn]"},{"type":"si:[gdl:action-button]", "player":"si:[doc:unit-1-text-delete-button]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-reference]"},{"type":"si:[gdl:containee]", "player":"si:[doc:info-1]"}]},
{"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:descriptor]", "player":"si:[doc:text-1]"}]},
- {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-type-constraint]"}]}
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-type-constraint]"}]},
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:person-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-constraint]"}]}
]}
\ No newline at end of file
1
0

[isidorus-cvs] r688 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/text war/gdl_widgets
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 03:31:02 2011
New Revision: 688
Log:
gdl-frontend: Widgets: implemented the static method TmHelper.getValueConstraintOfValueGroup(Topic valueGroup) that can be used by all visible elements to retrieve the bound tmcl or gdl contraint instance to their gdl:Value-Group instance
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 28 02:23:24 2011 (r687)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Thu Jul 28 03:31:02 2011 (r688)
@@ -17,6 +17,7 @@
// some psis of the TMCL
public class TMCL {
public final static String topictype = "http://psi.topicmaps.org/tmcl/topic-type";
+ public final static String constraint = "http://psi.topicmaps.org/tmcl/constraint";
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 02:23:24 2011 (r687)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java Thu Jul 28 03:31:02 2011 (r688)
@@ -12,6 +12,13 @@
// returns the constraint that is bound to the value group topic
public Topic getConstraint() throws InvalidGdlSchemaException;
+
+ // returns the constraint that is at the root position, e.g.
+ // a value-group is bound to gdl:Type and the gdl:Type is bound
+ // to a tmcl:name-constraint. in this case the gdl:Type is specified
+ // as the constraint and tmcl:name-constraint is set as the
+ // root constraint
+ public Topic getRootConstraint() throws InvalidGdlSchemaException;
// returns all topics that are set as default values for this value group
public ArrayList<Topic> getDefaultTmValues() throws InvalidGdlSchemaException;
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 02:23:24 2011 (r687)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Jul 28 03:31:02 2011 (r688)
@@ -610,4 +610,27 @@
else if(valueGroups.size() == 0) return null;
else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(visibleElement) + " must be bound none or once to a value group, but is: " + valueGroups.size());
}
+
+
+ // returns the direct constraint a value group is bound to
+ public static Topic getConstraintOfValueGroup(Topic valueGroup) throws InvalidGdlSchemaException{
+ if(valueGroup == null) return null;
+
+ TopicMap tm = valueGroup.getTopicMap();
+ Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+ Topic descriptorType = getTopicByPsi(GdlPsis.TopicType.gdlDescriptor, tm);
+ Topic tmBindingAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlTmBinding, tm);
+ Topic tmclConstraintType = getTopicByPsi(GdlPsis.TMCL.constraint, tm);
+ Topic tmConstructRoleType = getTopicByPsi(GdlPsis.RoleType.gdlTmConstruct, tm);
+ ArrayList<Topic> tmclConstraints = getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, tmBindingAssocType, null, tmclConstraintType, tmConstructRoleType);
+
+ ArrayList<Topic> gdlConstraints = getOtherPlayerOfBinaryAssociation(valueGroup, valueGroupRoleType, tmBindingAssocType, null, descriptorType, tmConstructRoleType);
+
+ if(tmclConstraints.size() > 1 || gdlConstraints.size() > 1 || (tmclConstraints.size() == 1 && gdlConstraints.size() == 1))
+ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(valueGroup) + " can be bound only to one constraint, but is " + (tmclConstraints.size() + gdlConstraints.size()));
+
+ if(tmclConstraints.size() == 1) return tmclConstraints.get(0);
+ else if (gdlConstraints.size() == 1) return gdlConstraints.get(0);
+ else return null;
+ }
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 02:23:24 2011 (r687)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 28 03:31:02 2011 (r688)
@@ -820,6 +820,13 @@
@Override
public Topic getConstraint() throws InvalidGdlSchemaException {
+ Topic valueGroup = this.getValueGroup();
+ return valueGroup == null ? null : TmHelper.getConstraintOfValueGroup(valueGroup);
+ }
+
+
+ @Override
+ public Topic getRootConstraint() throws InvalidGdlSchemaException {
// TODO Auto-generated method stub
return null;
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 02:23:24 2011 (r687)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm Thu Jul 28 03:31:02 2011 (r688)
@@ -30,6 +30,7 @@
{"subject_identifiers":["[gdl:Visible-Object]"]},
{"subject_identifiers":["[gdl:Value-Group]"]},
{"subject_identifiers":["[gdl:Text-Object]"]},
+ {"subject_identifiers":["[gdl:Type]"]},
{"subject_identifiers":["[gdl:Position]"]},
{"subject_identifiers":["[gdl:position]"], "instance_of":["si:[tmcl:association-type]"]},
{"subject_identifiers":["[doc:value-group-person-name]"], "instance_of":["si:[gdl:Value-Group]"]},
@@ -67,6 +68,7 @@
{"subject_identifiers":["[gdl:Title]"]},
{"subject_identifiers":["[gdl:Reference]"]},
{"subject_identifiers":["[gdl:List]"]},
+ {"subject_identifiers":["[doc:person-name-type-constraint]"], "instance_of":["si:[gdl:Type]"]},
{"subject_identifiers":["[doc:unit-1-radio-button]"], "instance_of":["si:[gdl:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_radio_button_id"},{"type":"si:[gdl:content-orientation]", "value":"horizontal"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin-left]", "value":"15pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-check-box]"], "instance_of":["si:[gdl:Check-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"unit_1_check_box_id"},{"type":"si:[gdl:content-orientation]", "value":"vertical"}, {"type":"si:[gdl:background-color]", "value": "lime"}, {"type":"si:[gdl:margin]", "value":"30pt"}, {"type":"si:[gdl:font-size]", "value":"8pt"}]},
{"subject_identifiers":["[doc:unit-1-action-button]"], "instance_of":["si:[gdl:Action-Button]"], "occurrences":[{"type":"si:[gdl:id]","value":"unit_1_action_button"}]},
@@ -170,6 +172,7 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Delete-Button]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Create-Button]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Value-Group]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Type]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -219,5 +222,6 @@
{"type":"si:[gdl:button-position]", "roles":[{"type":"si:[gdl:nth-element]", "player":"si:[doc:nth-elem-crt-btn]"},{"type":"si:[gdl:action-button]", "player":"si:[doc:unit-1-text-create-button]"}]},
{"type":"si:[gdl:button-position]", "roles":[{"type":"si:[gdl:nth-element]", "player":"si:[doc:nth-elem-del-btn]"},{"type":"si:[gdl:action-button]", "player":"si:[doc:unit-1-text-delete-button]"}]},
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-reference]"},{"type":"si:[gdl:containee]", "player":"si:[doc:info-1]"}]},
- {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:descriptor]", "player":"si:[doc:text-1]"}]}
+ {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:descriptor]", "player":"si:[doc:text-1]"}]},
+ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:tm-construct]", "player":"si:[doc:person-name-type-constraint]"}]}
]}
\ No newline at end of file
1
0

[isidorus-cvs] r687 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 28 Jul '11
by lgiessmann@common-lisp.net 28 Jul '11
28 Jul '11
Author: lgiessmann
Date: Thu Jul 28 02:23:24 2011
New Revision: 687
Log:
gdl-frontend: Widgets: fixed a bug when setting GdlButton's setPosition in GdlVisibleObject
Modified:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 28 02:20:26 2011 (r686)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 28 02:23:24 2011 (r687)
@@ -115,6 +115,7 @@
ButtonableObject btn = new ButtonableObject(widget);
this.subElements.add(btn);
this.containerPanel.add(btn);
+ this.setNthButtons();
return btn;
}
1
0