[isidorus-cvs] r1010 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Oct 19 19:16:20 UTC 2011


Author: lgiessmann
Date: Wed Oct 19 12:16:19 2011
New Revision: 1010

Log:
gdl-frontend: Widgets: implemented the tmcl:variant-name-constraint semantics for retrieving data

Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
   trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
   trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 19 05:07:18 2011	(r1009)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 19 12:16:19 2011	(r1010)
@@ -1979,7 +1979,22 @@
 			if(str == null) str = "";
 			this.addSubItem(str);
 		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
-			// TODO: implement: variant-name-constraint
+			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+			
+			Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Name> names = ((Topic)this.receivedData).getNames(nameType);
+			Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); 
+			JsArray<Variant> variants = names.get(0).getVariants();
+			
+			if(variants.get(0).getScope().length() != 0){
+				JsArray<Topic> scopes = variants.get(0).getScope();
+				int i = 0;
+				for( ; i != scopes.length(); ++i) if(scopes.get(i).equals(scope)) break;
+				
+				if(i != scopes.length()){
+					for(i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+				}
+			}
 		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
 			Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
 			

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Wed Oct 19 05:07:18 2011	(r1009)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Wed Oct 19 12:16:19 2011	(r1010)
@@ -38,6 +38,7 @@
 		public final static String tmclAllowed = tmcl + "allowed";
 		public final static String tmclAllowedReifier = tmcl + "allowed-reifier";
 		public final static String tmclConstrainedScope = tmcl + "constrained-scope";
+		public final static String tmclConstrainedScopeTopic = tmcl + "constrained-scope-topic";
 		public final static String tmclSubjectIdentifierConstraint = tmcl + "subject-identifier-constraint";
 		public final static String tmclSubjectLocatorConstraint = tmcl + "subject-locator-constraint";
 		public final static String tmclItemIdentifierConstraint = tmcl + "item-identifier-constraint";

Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Oct 19 05:07:18 2011	(r1009)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Oct 19 12:16:19 2011	(r1010)
@@ -856,6 +856,21 @@
 	}
 	
 	
+	// returns a topic  that can e used as scope topic
+	public static Topic getConstrainedScopeTopic(Topic constraintTopic) throws InvalidGdlSchemaException{
+		if(constraintTopic == null) return null;
+
+		TopicMap tm = constraintTopic.getTopicMap();
+		Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm);
+		Topic constrainedScopeTopicAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedScopeTopic, tm);
+		Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm);
+		ArrayList<Topic> constrainedScopeTopics = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constrainedScopeTopicAssocType, null, constrainedRoleType);
+		
+		if(constrainedScopeTopics.size() != 1) throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraintTopic) + " must be bound exactly once to a statement topic via a " + PSIs.TMCL.tmclConstrainedScopeTopic + " association, but is: " + constrainedScopeTopics.size());
+		else return constrainedScopeTopics.get(0);
+	}
+	
+	
 	// returns the topic that plays the role of tmcl:constrained in an association
 	// of the type tmcl:constrained-topic-type that is bound to the passed topic
 	// constraint-Topic that plays the role of tmcl:constraint

Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm	Wed Oct 19 05:07:18 2011	(r1009)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm	Wed Oct 19 12:16:19 2011	(r1010)
@@ -225,7 +225,12 @@
             {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"430px"}, {"type":"si:[gdl:left]", "value":"10px"}]},
             {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]},
             {"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]},
-            
+
+			{"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]},
+            {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"470px"}, {"type":"si:[gdl:left]", "value":"10px"}]},
+            {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]},
+            {"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]},
+                        
             
             
             
@@ -418,7 +423,13 @@
  				  {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-scope-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]},
  				  {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]},
  				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-ii-constraint]"}]},
- 				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-ii-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]}
+ 				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-ii-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]},
+                  
+                  {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]},
+ 				  {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]},
+ 				  {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]},
+ 				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-reifier-constraint]"}]},
+ 				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]}
                   
                   
                   

Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt	Wed Oct 19 05:07:18 2011	(r1009)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt	Wed Oct 19 12:16:19 2011	(r1010)
@@ -4,15 +4,15 @@
   ==> item-identifier-constraint         ***
   ==> topic-name-constraint              ***
     ==> regular-expression-constraint    ***
-    ==> Type                              **
+    ==> Type                             ***
     ==> scope-constraint                 ***
     ==> reifier-constraint               ***
     ==> item-identifier-constraint       ***
     ==> variant-name-constraint          ***
-      ==> Datatype                        **
-      ==> Variant-Name-Scope              **
-      ==> Variant-Name-Identifiers        **
-      ==> Variant-Name-Reifier             *
+      ==> Datatype                       ***
+      ==> Variant-Name-Scope             ***
+      ==> Variant-Name-Identifiers       ***
+      ==> Variant-Name-Reifier           ***
   
   
 ==> Endpoint                             *




More information about the Isidorus-cvs mailing list