isidorus-cvs
  Threads by month 
                
            - ----- 2025 -----
 - November
 - October
 - September
 - August
 - July
 - June
 - May
 - April
 - March
 - 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
 
- 1037 discussions
 
                        
                            
                                
                            
                            [isidorus-cvs] r1029 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 10:06:49 2011
New Revision: 1029
Log:
gdl-frontend: Widgets: implemented the gdlt:Datatype semantics for generating content entered in GdlVisibleObject
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 09:56:05 2011	(r1028)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 10:06:49 2011	(r1029)
@@ -2858,7 +2858,29 @@
 	// handles the getContent call for a Datatye value
 	// handles the getContent call for scope topics
 	private void getDatatypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
-		// TODO: implement
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+
+		Construct owner = null;
+		TopicMapsTypes ownerType = null;
+		if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
+			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+			if(variants.size() != 0){
+				owner = variants.get(0);
+				variants.get(0).setValue(variants.get(0).getValue(), variants.get(0).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)));
+				ownerType = TopicMapsTypes.Variant;
+			}
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){
+			Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType);
+			if(occs.length() != 0){
+				owner = occs.get(0);
+				occs.get(0).setValue(occs.get(0).getValue(), occs.get(0).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)));
+				ownerType = TopicMapsTypes.Occurrence;
+			}
+		} else {
+			throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + " or " + PSIs.TMCL.tmclOccurrenceConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		}		
+		contents.add(new Pair<Object, TopicMapsTypes>(owner, ownerType));
 	}
 	
 	
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1028 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 09:56:05 2011
New Revision: 1028
Log:
gdl-frontend: Widgets: implemented the gdlt:Type semantics for generating content entered in GdlVisibleObject
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 09:18:46 2011	(r1027)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 09:56:05 2011	(r1028)
@@ -14,6 +14,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TypedStub;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.Widgets.button.GdlActionButton;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
@@ -2854,15 +2855,53 @@
 	}
 	
 	
+	// handles the getContent call for a Datatye value
 	// handles the getContent call for scope topics
-	private void getDatatypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+	private void getDatatypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
 		// TODO: implement
 	}
 	
 	
+	// handles the getContent call for a type topic
 	// handles the getContent call for scope topics
-	private void getTypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
-		// TODO: implement
+	private void getTypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		Topic oldType = null;
+		Construct owner = null;
+		TopicMapsTypes ownerType = null;
+		if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+			if(!(carrier instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+			oldType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Name> names = ((Topic)carrier).getNames(oldType);
+			if(names.length() != 0) owner = names.get(0);
+			ownerType = TopicMapsTypes.Name;
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+			if(!(carrier instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+			oldType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Occurrence> occs = ((Topic)carrier).getOccurrences(oldType);
+			if(occs.length() != 0) owner = occs.get(0);
+			ownerType = TopicMapsTypes.Occurrence;
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
+			if(!(carrier instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+			oldType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()).getFirst();
+			Topic assocType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Role> roles = ((Topic)carrier).getRolesPlayed(oldType, assocType);
+			if(roles.length() != 0) owner = roles.get(0).getParent();
+			ownerType = TopicMapsTypes.Association;
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclAssociationRoleConstraint)){
+			if(!(carrier instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+			oldType = TmHelper.getConstraintRoleOfConstraint(this.getRootConstraint());
+			Topic assocType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Role> roles = ((Topic)carrier).getRolesPlayed(oldType, assocType);
+			if(roles.length() != 0) owner = roles.get(0);
+			ownerType = TopicMapsTypes.Role;
+		} else {
+			String constraints = PSIs.TMCL.tmclTopicNameConstraint + ", " + PSIs.TMCL.tmclTopicOccurrenceConstraint + ", " + PSIs.TMCL.tmclTopicRoleConstraint + ", " + PSIs.TMCL.tmclAssociationRoleConstraint;
+			throw new ExecutionException("The topic " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to the following root constraints: " + constraints);
+		}
+
+		Topic newType = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+		if(!newType.equals(oldType))((TypedStub) owner).setType(newType);
+		contents.add(new Pair<Object, TopicMapsTypes>(owner, ownerType));
 	}
 	
 		
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1027 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 09:18:46 2011
New Revision: 1027
Log:
gdl-frontend: Widgets: implemented the tmcl:reifier-constraint semantics for generating content entered in GdlVisibleObject
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 07:10:16 2011	(r1026)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 09:18:46 2011	(r1027)
@@ -10,6 +10,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Reifiable;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.ReifiableStub;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
+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.TopicMaps.TopicMapsModel.TopicMapsTypes;
@@ -1960,7 +1961,12 @@
 				if(occs.length() != 0) reifier = occs.get(0).getReifier();
 			}
 		} else if(this.receivedData instanceof Association){
-			if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+			if(((Association)this.receivedData).getType().equals(type)){
+				reifier = ((Association)this.receivedData).getReifier();
+			} else {
+				JsArray<Role> roles = ((Association)this.receivedData).getRoles(type);
+				if(roles.length() != 0) reifier = roles.get(0).getReifier();
+			}
 		} else {
 			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
 		}
@@ -1984,7 +1990,7 @@
 				if(occs.length() != 0) scope = occs.get(0).getScope();
 			}
 		} else if(this.receivedData instanceof Association){
-			if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+			if(((Association)this.receivedData).getType().equals(type)) scope = ((Association)this.receivedData).getScope();
 		} else {
 			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
 		}
@@ -2757,21 +2763,94 @@
 					variant.addTheme(newScope);
 				}
 			}
-
 			contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
 		}
 	}
 	
 	
 	// handles the getContent call for scope topics
-	private void getScopeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
-		// TODO: implement
+	private void getScopeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+
+		JsArray<Topic> scopes = null;
+		Construct owner = null;
+		TopicMapsTypes ownerType = null;
+		if(carrier instanceof Topic){
+			JsArray<Name> names = ((Topic)carrier).getNames(type);
+			if(names.length() != 0){
+				scopes = names.get(0).getScope();
+				owner = names.get(0);
+				ownerType = TopicMapsTypes.Name;
+			}
+			if(scopes == null){
+				JsArray<Occurrence> occs = ((Topic)carrier).getOccurrences(type);
+				if(occs.length() != 0){
+					scopes = occs.get(0).getScope();
+					owner = occs.get(0);
+					ownerType = TopicMapsTypes.Occurrence;
+				}
+			}
+		} else if(carrier instanceof Association){
+			if(((Association)carrier).getType().equals(type)){
+				scopes = ((Association)carrier).getScope();
+				owner = carrier;
+				ownerType = TopicMapsTypes.Association;
+			}
+		} else {
+			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + carrier.getClass());
+		}
+		
+		Topic newScope = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+		Topic oldScope = null;
+		if(scopes.length() > selectedValueIndex){
+			oldScope = scopes.get(selectedValueIndex);
+			if(!newScope.equals(oldScope)){
+				((ScopedStub)owner).removeTheme(oldScope);
+				((ScopedStub)owner).addTheme(newScope);
+			}
+		} else {
+			((ScopedStub)owner).addTheme(newScope);
+		}
+		contents.add(new Pair<Object, TopicMapsTypes>(owner, ownerType));
 	}
 	
 	
-	// handles the getContent call for scope topics
-	private void getReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
-		// TODO: implement
+	// handles the getContent call for a reifier topic
+	private void getReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+
+		Construct owner = null;
+		TopicMapsTypes ownerType = null;
+		if(carrier instanceof Topic){
+			JsArray<Name> names = ((Topic)carrier).getNames(type);
+			if(names.length() != 0){
+				owner = names.get(0);
+				ownerType = TopicMapsTypes.Name;
+			} else {
+				JsArray<Occurrence> occs = ((Topic)carrier).getOccurrences(type);
+				if(occs.length() != 0){
+					owner = occs.get(0);
+					ownerType = TopicMapsTypes.Occurrence;
+				}
+			}
+		} else if(carrier instanceof Association){
+			if(((Association)carrier).getType().equals(type)){
+				owner = carrier;
+				ownerType = TopicMapsTypes.Association;
+			} else {
+				JsArray<Role> roles = ((Association)carrier).getRoles(type);
+				if(roles.length() != 0){
+					owner = roles.get(0);
+					ownerType = TopicMapsTypes.Role;
+				}
+			}
+		} else {
+			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + carrier.getClass());
+		}
+		
+		Topic newReifier = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+		if(!newReifier.equals(((ReifiableStub)owner).getReifier())) ((ReifiableStub)owner).setReifier(newReifier);
+		contents.add(new Pair<Object, TopicMapsTypes>(owner, ownerType));
 	}
 	
 	
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1026 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 07:10:16 2011
New Revision: 1026
Log:
gdl-frontend: Widgets: refactored GdlVisibleObject.getContent(...)
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/TestClass.java
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 26 05:02:37 2011	(r1025)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 07:10:16 2011	(r1026)
@@ -2762,6 +2762,30 @@
 		}
 	}
 	
+	
+	// handles the getContent call for scope topics
+	private void getScopeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		// TODO: implement
+	}
+	
+	
+	// handles the getContent call for scope topics
+	private void getReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		// TODO: implement
+	}
+	
+	
+	// handles the getContent call for scope topics
+	private void getDatatypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		// TODO: implement
+	}
+	
+	
+	// handles the getContent call for scope topics
+	private void getTypeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		// TODO: implement
+	}
+	
 		
 	// returns the actual data that is hold by this instance
 	public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
@@ -2782,13 +2806,13 @@
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
 				this.getVariantNameContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
-				// TODO: implement
+				this.getScopeContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
-				// TODO: implement
+				this.getReifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){
-				// TODO: implement
+				this.getDatatypeContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
-				// TODO: implement
+				this.getTypeContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
 				this.getVariantNameScopeContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Wed Oct 26 05:02:37 2011	(r1025)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Wed Oct 26 07:10:16 2011	(r1026)
@@ -2,8 +2,10 @@
 
 import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
@@ -71,6 +73,10 @@
 							Window.alert(((Name)construct.getFirst()).getValue() + " >> " + construct.getSecond());
 						} else if(construct.getSecond().equals(TopicMapsTypes.Variant)){
 							Window.alert(TmHelper.getAnyIdOfTopic(((Variant)construct.getFirst()).getReifier()) + " >> " + construct.getSecond());
+						} else if(construct.getSecond().equals(TopicMapsTypes.Association)){
+							Window.alert((Association)construct.getFirst() + " >> " + construct.getSecond());
+						} else if(construct.getSecond().equals(TopicMapsTypes.Role)){
+							Window.alert((Role)construct.getFirst() + " >> " + construct.getSecond());
 						} else {
 							Window.alert(construct.getFirst() + " >> " + construct.getSecond());
 						}
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1025 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 05:02:37 2011
New Revision: 1025
Log:
gdl-frontend: Widgets: implemented the gdlt:Variant-Name-Scope semantics for generating content entered in GdlVisibleObject
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 04:53:30 2011	(r1024)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 05:02:37 2011	(r1025)
@@ -2737,6 +2737,31 @@
 		contents.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
 	}
 	
+	
+	// handles the getContent call for scope topics of variant-names
+	private void getVariantNameScopeContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
+		ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());		
+		if(possibleVariants.size() != 0){
+			Variant variant = possibleVariants.get(0);
+			JsArray<Topic> scopes = variant.getScope();
+			
+			if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
+
+			if(scopes.length() > selectedValueIndex){
+				Topic oldScope = scopes.get(selectedValueIndex);
+				Topic newScope = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+				
+				if(!oldScope.equals(newScope)){
+					variant.removeTheme(oldScope);
+					variant.addTheme(newScope);
+				}
+			}
+
+			contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
+		}
+	}
+	
 		
 	// returns the actual data that is hold by this instance
 	public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
@@ -2765,7 +2790,7 @@
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
 				// TODO: implement
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
-				// TODO: implement
+				this.getVariantNameScopeContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
 				this.getVariantReifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1024 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 04:53:30 2011
New Revision: 1024
Log:
gdl-frontend: Widgets: refactored GdlVisibleObject.getContent(...)
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 04:49:24 2011	(r1023)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 04:53:30 2011	(r1024)
@@ -2497,6 +2497,7 @@
 	
 	// handles the getContent call for subject identifiers and subject locators
 	private void getTopicIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
 		JsArray<Locator> identifiers = null;
 			
 		ArrayList<Locator> filteredIdentifiers = null;
@@ -2601,6 +2602,7 @@
 
 	// handles the getContent call for item identifiers of variant-names
 	private void getVariantIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
 		ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());		
 		if(possibleVariants.size() != 0){
 			Variant variant = possibleVariants.get(0);
@@ -2628,6 +2630,7 @@
 	
 	// handles the getContent call for item identifiers of variant-names
 	private void getVariantReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
 		ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());		
 		if(possibleVariants.size() != 0){
 			Variant variant = possibleVariants.get(0);
@@ -2641,6 +2644,7 @@
 	
 	// handles the getContent call for occurrence and name values
 	private void getTopicCharacteristicContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
 		Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
 		
 		boolean isOccConstraint = true;
@@ -2708,6 +2712,8 @@
 	
 	// handles the getContent call for role players
 	private void getRolePlayerContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Association carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!(carrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + carrier.getClass());
+		
 		if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint))throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
 		Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
 		Topic roleType = roleAndPlayerType.getFirst();
@@ -2741,19 +2747,14 @@
 
 		for (int idx = 0; idx != this.getSelectedValues().size(); ++idx){
 			if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
-				if(!(localCarrier instanceof Topic) || !(localCarrier instanceof Reifiable)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic or a Reifiable, but is: " + localCarrier.getClass());
 				this.getItemIdentifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getTopicIdentifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getTopicIdentifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getVariantNameContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
 				// TODO: implement
@@ -2766,16 +2767,12 @@
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
 				// TODO: implement
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getVariantReifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getVariantIdentifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
-				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
-				if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass());
 				this.getRolePlayerContent(result, validate, (Association)localCarrier, idx);
 			} else {
 				throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported");
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1023 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 04:49:24 2011
New Revision: 1023
Log:
gdl-frontend: Widgets: implemented the tmcl:variant-name-constraint semantics for generating content entered in GdlVisibleObject
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 03:06:05 2011	(r1022)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 04:49:24 2011	(r1023)
@@ -2682,37 +2682,27 @@
 	
 	// handles the getContent call for subject identifiers and subject locators
 	private void getVariantNameContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
-		// TODO: implement
-		
-		/*JsArray<Locator> identifiers = null;
-			
-		ArrayList<Locator> filteredIdentifiers = null;
-		boolean isPsiConstraint = false;
-		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
-			isPsiConstraint = true;
-			identifiers = carrier.getSubjectIdentifiers();
-			filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
-			identifiers = carrier.getSubjectLocators();
-			filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
-		} else {
-			throw new ExecutionException("Only the constraints " + PSIs.TMCL.tmclSubjectIdentifierConstraint + " and " + PSIs.TMCL.tmclSubjectLocatorConstraint + " are supported by the function getTopicIdentifierContent");
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+
+		ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
+
+		Variant changedVariant = null;
+		if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex)); 
+
+		if(variants.size() > selectedValueIndex){
+			changedVariant = variants.get(selectedValueIndex);
+			changedVariant.setValue(this.getSelectedValues().get(selectedValueIndex));
+		}else {
+			Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
+			JsArray<Name> names = carrier.getNames(nameType);
+			Name owner = names.get(0);
+			Topic scope = TmHelper.getConstrainedScopeTopic(this.getConstraint());
+			@SuppressWarnings("unchecked")
+			JsArray<Topic> scopes = (JsArray<Topic>) JsArray.createArray();
+			scopes.push(scope);
+			changedVariant = owner.createVariant(this.getSelectedValues().get(selectedValueIndex), scopes);
 		}
-		
-		Locator changedIdentifier = null;
-		if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
-		
-		if(filteredIdentifiers.size() > selectedValueIndex){
-			changedIdentifier = filteredIdentifiers.get(selectedValueIndex);
-			if(isPsiConstraint) carrier.removeSubjectIdentifier(changedIdentifier);
-			else carrier.removeSubjectLocator(changedIdentifier);
-		}
-		
-		changedIdentifier = carrier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex));
-		if(isPsiConstraint) carrier.addSubjectIdentifier(changedIdentifier);
-		else carrier.addSubjectLocator(changedIdentifier);
-		contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
-		*/
+		contents.add(new Pair<Object, TopicMapsTypes>(changedVariant, TopicMapsTypes.Variant));
 	}
 	
 	
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1022 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 03:06:05 2011
New Revision: 1022
Log:
gdl-frontend: Widgets: refactored GdlVisibleObject.setReceivedData(...) and parted it to smaller sub-methods
Modified:
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
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 26 02:11:12 2011	(r1021)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 03:06:05 2011	(r1022)
@@ -1891,218 +1891,292 @@
 	// of this control
 	public abstract void fixValue();
 
+	
+	// sets the item-identifier-fields for the received data
+	private void setReceivedItemIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Reifiable) || !(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass());
+		
+		// get type
+		Topic constrainedTopicType = TmHelper.getConstrainedTopicType(this.getConstraint());
 
-	// sets the fields for the received data
-	protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException {
-		if(receivedData == null) return;
-
-		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
-			if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
-
-			Pattern rex = new Pattern(this.getLiteralValueForConstraint());
-			for(int i = 0; i != ((Topic)receivedData).getSubjectIdentifiers().length(); ++i){
-				String psi = ((Topic)receivedData).getSubjectIdentifiers().get(i).getReference();
-				if(rex.matches(psi)){
-					this.addSubItem(psi);
-				}
+		int typeIdx = -1;
+		JsArray<Topic> types = null;
+		if((this.receivedData instanceof Topic)){
+			types = ((Topic)this.receivedData).getTypes();
+			if(types.length() != 0){
+				for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break;
 			}
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
-			if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		}
 
+		if((this.receivedData instanceof Topic) && types != null && typeIdx != types.length()){
 			Pattern rex = new Pattern(this.getLiteralValueForConstraint());
-			for(int i = 0; i != ((Topic)receivedData).getSubjectLocators().length(); ++i){
-				String sl = ((Topic)receivedData).getSubjectLocators().get(i).getReference();
-				if(rex.matches(sl)){
-					this.addSubItem(sl);
+			Topic top = (Topic)this.receivedData;
+			for(int i = 0; i != top.getItemIdentifiers().length(); ++i){
+				String ii = top.getItemIdentifiers().get(i).getReference();
+				if(rex.matches(ii)){
+					this.addSubItem(ii);
 				}
 			}
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
-			if(!(this.receivedData instanceof Reifiable) || !(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass());
-
-			// get type
-			Topic constrainedTopicType = TmHelper.getConstrainedTopicType(this.getConstraint());
+		} else {			
+			// search for the topic type
+			Reifiable ref = null;
 
-			int typeIdx = -1;
-			JsArray<Topic> types = null;
-			if((this.receivedData instanceof Topic)){
-				types = ((Topic)this.receivedData).getTypes();
-				if(types.length() != 0){
-					for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break;
+			// search for the characteristics type
+			if(this.receivedData instanceof Topic){
+				JsArray<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
+				if(names.length() != 0){
+					ref = names.get(0);
+				} else {
+					JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
+					if(occs.length() != 0) ref = occs.get(0);
 				}
+			} else if(this.receivedData instanceof Association){
+				JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
+				if(roles.length() != 0) ref = roles.get(0);
 			}
 
-			if((this.receivedData instanceof Topic) && types != null && typeIdx != types.length()){
-				Pattern rex = new Pattern(this.getLiteralValueForConstraint());
-				Topic top = (Topic)this.receivedData;
-				for(int i = 0; i != top.getItemIdentifiers().length(); ++i){
-					String ii = top.getItemIdentifiers().get(i).getReference();
-					if(rex.matches(ii)){
-						this.addSubItem(ii);
-					}
-				}
-			} else {			
-				// search for the topic type
-				Reifiable ref = null;
-	
-				// search for the characteristics type
-				if(this.receivedData instanceof Topic){
-					JsArray<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
-					if(names.length() != 0){
-						ref = names.get(0);
-					} else {
-						JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
-						if(occs.length() != 0) ref = occs.get(0);
-					}
-				} else if(this.receivedData instanceof Association){
-					JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
-					if(roles.length() != 0) ref = roles.get(0);
+			// search for item-identifiers of the found topic type or characteristics
+			Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+			for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
+				String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
+				if(rex.matches(ii)){
+					this.addSubItem(ii);
 				}
+			}
+		}
+	}
 	
-				// search for item-identifiers of the found topic type or characteristics
-				Pattern rex = new Pattern(this.getLiteralValueForConstraint());
-				for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
-					String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
-					if(rex.matches(ii)){
-						this.addSubItem(ii);
-					}
-				}
+	
+	// sets the reifier-fields for the received data
+	private void setReceivedReifier() throws InvalidGdlSchemaException, ExecutionException {
+		Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+
+		Topic reifier = null;
+		if(this.receivedData instanceof Topic){
+			JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
+			if(names.length() != 0) reifier = names.get(0).getReifier();
+			if(reifier == null){
+				JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
+				if(occs.length() != 0) reifier = occs.get(0).getReifier();
 			}
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
-			if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		} else if(this.receivedData instanceof Association){
+			if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+		} else {
+			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+		}
 
-			Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
-			for(int i = 0; i != ((Topic)this.receivedData).getNames(nameType).length(); ++i)
-				this.addSubItem(((Topic)this.receivedData).getNames(nameType).get(i).getValue());
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
-			if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		String str = this.getTopicRepresentation(reifier, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
+		if(str == null) str = "";
+		this.addSubItem(str);
+	}
+	
 
-			Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint());
-			for(int i = 0; i != ((Topic)this.receivedData).getOccurrences(occurrenceType).length(); ++i)
-				this.addSubItem(((Topic)this.receivedData).getOccurrences(occurrenceType).get(i).getValue());
-		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
-			Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+	// sets the scope-fields for the received data
+	private void setReceivedScope() throws InvalidGdlSchemaException, ExecutionException {
+		Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
 
-			Topic reifier = null;
-			if(this.receivedData instanceof Topic){
-				JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
-				if(names.length() != 0) reifier = names.get(0).getReifier();
-				if(reifier == null){
-					JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
-					if(occs.length() != 0) reifier = occs.get(0).getReifier();
-				}
-			} else if(this.receivedData instanceof Association){
-				if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
-			} else {
-				throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+		JsArray<Topic> scope = null;
+		if(this.receivedData instanceof Topic){
+			JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
+			if(names.length() != 0) scope = names.get(0).getScope();
+			if(scope == null){
+				JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
+				if(occs.length() != 0) scope = occs.get(0).getScope();
 			}
+		} else if(this.receivedData instanceof Association){
+			if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+		} else {
+			throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+		}
 
-			String str = this.getTopicRepresentation(reifier, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
-			if(str == null) str = "";
-			this.addSubItem(str);
-		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
-			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		if(scope != null){
+			for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+		}
+	}
+	
+	
+	// sets the type-fields for the received data
+	private void setReceivedType() throws InvalidGdlSchemaException, ExecutionException {
+		Topic type = null;
+		if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+			type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+			type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
+			if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+			type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclAssociationRoleConstraint)){
+			if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+			type = TmHelper.getConstraintRoleOfConstraint(this.getRootConstraint());
+		} else {
+			String constraints = PSIs.TMCL.tmclTopicNameConstraint + ", " + PSIs.TMCL.tmclTopicOccurrenceConstraint + ", " + PSIs.TMCL.tmclTopicRoleConstraint + ", " + PSIs.TMCL.tmclAssociationRoleConstraint;
+			throw new ExecutionException("The topic " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to the following root constraints: " + constraints);
+		}
 
-			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
-			if(variants.size() != 0){
-				for (Variant variant : variants) {
-					 this.addSubItem(variant.getValue());
-				}
-			}
-			else{
-				this.addSubItem("");
-			}
-		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
-			Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+		String str = this.getTopicRepresentation(type, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
+		if(str == null) str = "";
+		this.addSubItem(str);
+	}
+	
+	
+	// sets the variant-name-scope-fields for the received data
+	private void setReceivedVariantNameScope() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		
+		ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+		if(variants.size() != 0){
+			for(int i = 0; i != variants.get(0).getScope().length(); ++i) this.addSubItem(this.getTopicRepresentation(variants.get(0).getScope().get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+		}
+	}
+	
+	
+	// sets the variant-name-reifier-fields for the received data
+	private void setReceivedVariantNameReifier() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		
+		ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+		if(variants.size() != 0 && variants.get(0).getReifier() != null){
+			this.addSubItem(this.getTopicRepresentation(variants.get(0).getReifier(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));	
+		}
+	}
+	
+	
+	// sets the subject-identifier and subjetc-locator-fields for the received data
+	private void setReceivedTopicIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
 
-			JsArray<Topic> scope = null;
-			if(this.receivedData instanceof Topic){
-				JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
-				if(names.length() != 0) scope = names.get(0).getScope();
-				if(scope == null){
-					JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
-					if(occs.length() != 0) scope = occs.get(0).getScope();
-				}
-			} else if(this.receivedData instanceof Association){
-				if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
-			} else {
-				throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+		Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+		
+		JsArray<Locator> identifiers = null;
+		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+			identifiers = ((Topic)receivedData).getSubjectIdentifiers();
+		}else {
+			identifiers = ((Topic)receivedData).getSubjectLocators();
+		}
+		
+		for(int i = 0; i != identifiers.length(); ++i){
+			String id = identifiers.get(i).getReference();
+			if(rex.matches(id)){
+				this.addSubItem(id);
 			}
+		}
+	}
+	
+	
+	// sets the variant-name-fields for the received data
+	private void setReceivedVariantName() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
 
-			if(scope != null){
-				for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+		ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
+		if(variants.size() != 0){
+			for (Variant variant : variants) {
+				 this.addSubItem(variant.getValue());
 			}
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
-			if(!(receivedData instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + receivedData.getClass());
-			if(this.getRootConstraint() == null || !TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but ist bound to the root topic: " + (this.getRootConstraint() == null ? "null" : TmHelper.getAnyIdOfTopic(this.getRootConstraint())));
+		}
+		else{
+			this.addSubItem("");
+		}	
+	}
+	
+	
+	// sets the role-player-fields for the received data
+	private void setReceivedRolePlayer() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(receivedData instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + receivedData.getClass());
+		if(this.getRootConstraint() == null || !TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but ist bound to the root topic: " + (this.getRootConstraint() == null ? "null" : TmHelper.getAnyIdOfTopic(this.getRootConstraint())));
 
-			Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());	
-			JsArray<Role> assocRoles = ((Association)this.receivedData).getRoles(roleAndPlayerType.getFirst());
-			for(int i = 0; i != assocRoles.length(); ++i){
-				if(TmHelper.isInstanceOf(assocRoles.get(i).getPlayer(), roleAndPlayerType.getSecond())){
-					this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
-				}
+		Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());	
+		JsArray<Role> assocRoles = ((Association)this.receivedData).getRoles(roleAndPlayerType.getFirst());
+		for(int i = 0; i != assocRoles.length(); ++i){
+			if(TmHelper.isInstanceOf(assocRoles.get(i).getPlayer(), roleAndPlayerType.getSecond())){
+				this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
 			}
-		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
-			Topic type = null;
-			if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
-				if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
-				type = TmHelper.getConstrainedStatement(this.getRootConstraint());
-			} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
-				if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
-				type = TmHelper.getConstrainedStatement(this.getRootConstraint());
-			} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
-				if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
-				type = TmHelper.getConstrainedStatement(this.getRootConstraint());
-			} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclAssociationRoleConstraint)){
-				if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
-				type = TmHelper.getConstraintRoleOfConstraint(this.getRootConstraint());
-			} else {
-				String constraints = PSIs.TMCL.tmclTopicNameConstraint + ", " + PSIs.TMCL.tmclTopicOccurrenceConstraint + ", " + PSIs.TMCL.tmclTopicRoleConstraint + ", " + PSIs.TMCL.tmclAssociationRoleConstraint;
-				throw new ExecutionException("The topic " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to the following root constraints: " + constraints);
-			}
-
-			String str = this.getTopicRepresentation(type, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
-			if(str == null) str = "";
-			this.addSubItem(str);
-		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){
-			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		}
+	}
+	
+	
+	// sets the variant-name-identifiers-fields for the received data
+	private void setReceivedVariantNameIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+		if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		
+		ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+		if(variants.size() != 0){
+			for(int i = 0; i != variants.get(0).getItemIdentifiers().length(); ++i) this.addSubItem(variants.get(0).getItemIdentifiers().get(i).getReference());
+		}
+	}
+	
+	
+	// sets the datatype-fields for the received data
+	private void setReceivedDatatype() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
 
-			if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
-				ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
-				if(variants.size() != 0){
-					this.addSubItem(variants.get(0).getDatatype().getReference());
-				}
-			} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){
-				Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint());
-				JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType);
-				if(occs.length() != 0) this.addSubItem(occs.get(0).getDatatype().getReference());
-			} else {
-				throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + " or " + PSIs.TMCL.tmclOccurrenceConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-			}
-		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
-			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
-			if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-			
+		if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
 			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
 			if(variants.size() != 0){
-				for(int i = 0; i != variants.get(0).getItemIdentifiers().length(); ++i) this.addSubItem(variants.get(0).getItemIdentifiers().get(i).getReference());
+				this.addSubItem(variants.get(0).getDatatype().getReference());
 			}
+		} else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){
+			Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+			JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType);
+			if(occs.length() != 0) this.addSubItem(occs.get(0).getDatatype().getReference());
+		} else {
+			throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + " or " + PSIs.TMCL.tmclOccurrenceConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		}
+	}
+	
+	
+	// sets the name- and occurrence-fields for the received data
+	private void setReceivedTopicCharacteristics() throws InvalidGdlSchemaException, ExecutionException {
+		if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+
+		Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
+		
+		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+			for(int i = 0; i != ((Topic)this.receivedData).getNames(characteristicType).length(); ++i)
+				this.addSubItem(((Topic)this.receivedData).getNames(characteristicType).get(i).getValue());
+		} else {
+			for(int i = 0; i != ((Topic)this.receivedData).getOccurrences(characteristicType).length(); ++i)
+				this.addSubItem(((Topic)this.receivedData).getOccurrences(characteristicType).get(i).getValue());
+		}
+	}
+	
+	
+	// sets the fields for the received data
+	protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException {
+		if(receivedData == null) return;
+
+		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+			this.setReceivedTopicIdentifiers();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
+			this.setReceivedTopicIdentifiers();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
+			this.setReceivedItemIdentifiers();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+			this.setReceivedTopicCharacteristics();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+			this.setReceivedTopicCharacteristics();
+		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
+			this.setReceivedReifier();
+		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
+			this.setReceivedVariantName();
+		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
+			this.setReceivedScope();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
+			this.setReceivedRolePlayer();
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
+			this.setReceivedType();
+		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){
+			this.setReceivedDatatype();
+		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
+			this.setReceivedVariantNameIdentifiers();
 		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
-			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
-			if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-			
-			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
-			if(variants.size() != 0 && variants.get(0).getReifier() != null){
-				this.addSubItem(this.getTopicRepresentation(variants.get(0).getReifier(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));	
-			}
+			this.setReceivedVariantNameReifier();
 		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
-			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
-			if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ",  but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-			
-			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
-			if(variants.size() != 0){
-				for(int i = 0; i != variants.get(0).getScope().length(); ++i) this.addSubItem(this.getTopicRepresentation(variants.get(0).getScope().get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
-			}
+			this.setReceivedVariantNameScope();
 		} else {
 			throw new InvalidGdlSchemaException("The constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not suported to be bound to the value group instance " + TmHelper.getAnyIdOfTopic(this.getValueGroup()));
 		}
@@ -2393,7 +2467,6 @@
 	}
 
 
-
 	// returns the actual topics that are set as possible tm-values
 	private ArrayList<Topic> getRawTmValues() throws InvalidGdlSchemaException{
 		if(this.rawTmValuesSet){
@@ -2606,6 +2679,68 @@
 		contents.add(new Pair<Object, TopicMapsTypes>(changedConstruct, isOccConstraint ? TopicMapsTypes.Occurrence : TopicMapsTypes.Name));
 	}
 	
+	
+	// handles the getContent call for subject identifiers and subject locators
+	private void getVariantNameContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		// TODO: implement
+		
+		/*JsArray<Locator> identifiers = null;
+			
+		ArrayList<Locator> filteredIdentifiers = null;
+		boolean isPsiConstraint = false;
+		if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+			isPsiConstraint = true;
+			identifiers = carrier.getSubjectIdentifiers();
+			filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
+		} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
+			identifiers = carrier.getSubjectLocators();
+			filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
+		} else {
+			throw new ExecutionException("Only the constraints " + PSIs.TMCL.tmclSubjectIdentifierConstraint + " and " + PSIs.TMCL.tmclSubjectLocatorConstraint + " are supported by the function getTopicIdentifierContent");
+		}
+		
+		Locator changedIdentifier = null;
+		if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
+		
+		if(filteredIdentifiers.size() > selectedValueIndex){
+			changedIdentifier = filteredIdentifiers.get(selectedValueIndex);
+			if(isPsiConstraint) carrier.removeSubjectIdentifier(changedIdentifier);
+			else carrier.removeSubjectLocator(changedIdentifier);
+		}
+		
+		changedIdentifier = carrier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex));
+		if(isPsiConstraint) carrier.addSubjectIdentifier(changedIdentifier);
+		else carrier.addSubjectLocator(changedIdentifier);
+		contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+		*/
+	}
+	
+	
+	// handles the getContent call for role players
+	private void getRolePlayerContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Association carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint))throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+		Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
+		Topic roleType = roleAndPlayerType.getFirst();
+		Topic playerType = roleAndPlayerType.getSecond();
+
+		JsArray<Role> typedRoles = carrier.getRoles(roleType);
+		ArrayList<Role> roles = new ArrayList<Role>();
+		for(int i = 0; i != typedRoles.length(); ++i)
+			if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i));
+
+		Role changedRole = null;
+
+		Topic player = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+		if(validate) this.validateTmValue(player);
+		if(roles.size() > selectedValueIndex){
+			changedRole = roles.get(selectedValueIndex);
+			changedRole.setPlayer(player);
+		} else {
+			changedRole = carrier.createRole(roleType, player);
+		}
+		contents.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
+	}
+	
 		
 	// returns the actual data that is hold by this instance
 	public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
@@ -2628,7 +2763,8 @@
 				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
-				// TODO: implement
+				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
+				this.getVariantNameContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
 				// TODO: implement
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
@@ -2650,27 +2786,7 @@
 				this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
 				if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass());
-				if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint))throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-				Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
-				Topic roleType = roleAndPlayerType.getFirst();
-				Topic playerType = roleAndPlayerType.getSecond();
-
-				JsArray<Role> typedRoles = ((Association)localCarrier).getRoles(roleType);
-				ArrayList<Role> roles = new ArrayList<Role>();
-				for(int i = 0; i != typedRoles.length(); ++i)
-					if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i));
-
-				Role changedRole = null;
-
-				Topic player = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(idx), this.getValueGroup());
-				if(validate) this.validateTmValue(player);
-				if(roles.size() > idx){
-					changedRole = roles.get(idx);
-					changedRole.setPlayer(player);
-				} else {
-					changedRole = ((Association)localCarrier).createRole(roleType, player);
-				}
-				result.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
+				this.getRolePlayerContent(result, validate, (Association)localCarrier, idx);
 			} else {
 				throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported");
 			}
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1021 - in trunk/src/anaToMia/GDL_Widgets:	src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets
                        
                        
by lgiessmann@common-lisp.net 26 Oct '11
                    by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
                    
                        Author: lgiessmann
Date: Wed Oct 26 02:11:12 2011
New Revision: 1021
Log:
gdl-frontend: Widgets: implemented additional functionality for the gdlt:Variant-Name-Scope and gdlt:Variant-Name-Reifier semantics for generating content entered in GdlVisibleObject
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/TmHelper.java
   trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
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	Tue Oct 25 09:29:07 2011	(r1020)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Oct 26 02:11:12 2011	(r1021)
@@ -2560,7 +2560,7 @@
 			Variant variant = possibleVariants.get(0);
 			Topic reifier = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
 			
-			if(reifier != null) variant.setReifier(reifier);
+			if(reifier != null && !variant.getReifier().equals(reifier)) variant.setReifier(reifier);
 			contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
 		}
 	}
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	Tue Oct 25 09:29:07 2011	(r1020)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Oct 26 02:11:12 2011	(r1021)
@@ -1139,7 +1139,7 @@
 	}
 	
 	
-	// returns the topic that can be used to satisfy the passed type-constraint.
+	// returns the topics that can be used to satisfy the passed type-constraint.
 	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;
@@ -1180,7 +1180,7 @@
 	}
 	
 	
-	// returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
+	// returns the topics that can be used to satisfy the passed variant-name-reifier-constraint.
 	public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException {
 		ArrayList<Topic> result = new ArrayList<Topic>();
 		if(variantNameReifierConstraint == null) return result;
@@ -1199,9 +1199,8 @@
 
 			// get subtypes of typeTopic
 			JsArray<Topic> allTopics = tm.getTopics();
-			for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
+			for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
 		}
-		
 		return result;
 	}
 	
@@ -1225,7 +1224,7 @@
 
 			// get subtypes of typeTopic
 			JsArray<Topic> allTopics = tm.getTopics();
-			for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
+			for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
 		}
 		
 		return result;
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	Tue Oct 25 09:29:07 2011	(r1020)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm	Wed Oct 26 02:11:12 2011	(r1021)
@@ -419,7 +419,8 @@
  				  {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-scope-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-scope-text]"}]},
  				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-scope-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-scope-constraint]"}]},
  				  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-scope-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]},
-                                               
+				  {"type":"si:[tmcl:constrained-scope]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-variant-name-scope-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Scope-Type]"}]},
+                                                                 
                   {"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-iis-text]"}]},
  				  {"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]"}]},
@@ -431,6 +432,8 @@
  				  {"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]"}]},
+ 				  {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]},
+ 				  
                   
                   {"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-editor-commit-button]"}]},
  				  {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-editor-commit-button-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-editor-commit-button]"}]}
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0
                            
                          
                          
                            
    
                          
                        
                    
                        
                            
                                
                            
                            [isidorus-cvs] r1020 -	trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
                        
                        
by lgiessmann@common-lisp.net 25 Oct '11
                    by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
                    
                        Author: lgiessmann
Date: Tue Oct 25 09:29:07 2011
New Revision: 1020
Log:
gdl-frontend: Widgets: updated the GDL-Schema => gdlt:Variant-Name-Scope and gdlt:Variant-Name-Reifier, so it is possible to select the corresponding topic types of these constraints directly in the schema instance
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/TestClass.java
   trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
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	Tue Oct 25 06:23:37 2011	(r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Tue Oct 25 09:29:07 2011	(r1020)
@@ -2003,8 +2003,14 @@
 			if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
 
 			ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
-			if(variants.size() != 0) this.addSubItem(variants.get(0).getValue());
-			else this.addSubItem("");
+			if(variants.size() != 0){
+				for (Variant variant : variants) {
+					 this.addSubItem(variant.getValue());
+				}
+			}
+			else{
+				this.addSubItem("");
+			}
 		} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
 			Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
 
@@ -2547,6 +2553,19 @@
 	}
 	
 	
+	// handles the getContent call for item identifiers of variant-names
+	private void getVariantReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+		ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());		
+		if(possibleVariants.size() != 0){
+			Variant variant = possibleVariants.get(0);
+			Topic reifier = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+			
+			if(reifier != null) variant.setReifier(reifier);
+			contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
+		}
+	}
+	
+	
 	// handles the getContent call for occurrence and name values
 	private void getTopicCharacteristicContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
 		Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
@@ -2621,7 +2640,8 @@
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
 				// TODO: implement
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
-				// TODO: implement
+				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
+				this.getVariantReifierContent(result, validate, (Topic)localCarrier, idx);
 			} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
 				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				this.getVariantIdentifierContent(result, validate, (Topic)localCarrier, idx);
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Tue Oct 25 06:23:37 2011	(r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Tue Oct 25 09:29:07 2011	(r1020)
@@ -4,6 +4,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
 import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback;
@@ -68,6 +69,8 @@
 							Window.alert(((Occurrence)construct.getFirst()).getValue() + " >> " + construct.getSecond());
 						} else if(construct.getSecond().equals(TopicMapsTypes.Name)){
 							Window.alert(((Name)construct.getFirst()).getValue() + " >> " + construct.getSecond());
+						} else if(construct.getSecond().equals(TopicMapsTypes.Variant)){
+							Window.alert(TmHelper.getAnyIdOfTopic(((Variant)construct.getFirst()).getReifier()) + " >> " + construct.getSecond());
 						} else {
 							Window.alert(construct.getFirst() + " >> " + construct.getSecond());
 						}
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	Tue Oct 25 06:23:37 2011	(r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Tue Oct 25 09:29:07 2011	(r1020)
@@ -1181,16 +1181,54 @@
 	
 	
 	// returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
-	public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException {
-		// TODO: implement
-		throw new ExecutionException("this mehtod is currently not implemented");
+	public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException {
+		ArrayList<Topic> result = new ArrayList<Topic>();
+		if(variantNameReifierConstraint == null) return result;
+		
+		TopicMap tm = variantNameReifierConstraint.getTopicMap();
+		Topic allowedRoleType = getTopicByPsi(PSIs.TMCL.tmclAllowed, tm);
+		Topic allowsRoleType = getTopicByPsi(PSIs.TMCL.tmclAllows, tm);
+		Topic allowedReifierAssocType = getTopicByPsi(PSIs.TMCL.tmclAllowedReifier, tm);
+		ArrayList<Topic> reifierTypeTopics = getOtherPlayerOfBinaryAssociation(variantNameReifierConstraint, allowsRoleType, allowedReifierAssocType, null, allowedRoleType);
+		
+		if(reifierTypeTopics.size() != 1){
+			throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameReifierConstraint) + " must be bound extactly once to a topic type, but is: " + reifierTypeTopics.size());
+		} else {
+			// add the direct specified type
+			result.add(reifierTypeTopics.get(0));
+
+			// get subtypes of typeTopic
+			JsArray<Topic> allTopics = tm.getTopics();
+			for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
+		}
+		
+		return result;
 	}
 	
 	
 	// returns the topic that can be used to satisfy the passed variant-name-scope-constraint.
-	public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException{
-		// TODO: implement
-		throw new ExecutionException("this method is currently not implemented");
+	public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException, InvalidGdlSchemaException{
+		ArrayList<Topic> result = new ArrayList<Topic>();
+		if(variantNameScopeConstraint == null) return result;
+		
+		TopicMap tm = variantNameScopeConstraint.getTopicMap();
+		Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm);
+		Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm);
+		Topic constrainedScopeAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedScope, tm);
+		ArrayList<Topic> scopeTypeTopics = getOtherPlayerOfBinaryAssociation(variantNameScopeConstraint, constraintRoleType, constrainedScopeAssocType, null, constrainedRoleType);
+		
+		if(scopeTypeTopics.size() != 1){
+			throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameScopeConstraint) + " must be bound extactly once to a topic type, but is: " + scopeTypeTopics.size());
+		} else {
+			// add the direct specified type
+			result.add(scopeTypeTopics.get(0));
+
+			// get subtypes of typeTopic
+			JsArray<Topic> allTopics = tm.getTopics();
+			for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
+		}
+		
+		return result;
 	}
 	
 	
                    
                  
                  
                          
                            
                            1
                            
                          
                          
                            
                            0