[isidorus-cvs] r1006 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Tue Oct 18 12:10:30 UTC 2011
Author: lgiessmann
Date: Tue Oct 18 05:10:29 2011
New Revision: 1006
Log:
gdl-frontend: Widgets: implemented the gdlt:Type semantics for retrieving data
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/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 18 03:19:08 2011 (r1005)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 05:10:29 2011 (r1006)
@@ -2,9 +2,6 @@
import java.util.ArrayList;
-
-import org.apache.commons.codec.language.RefinedSoundex;
-
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
@@ -1979,7 +1976,27 @@
}
}
} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
- // TODO: implement: Type
+ 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)){
// TODO: implement: Datatype
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
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 18 03:19:08 2011 (r1005)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 18 05:10:29 2011 (r1006)
@@ -22,6 +22,7 @@
import us.isidor.gdl.anaToMia.Widgets.view.GdlView;
import com.google.gwt.core.client.JsArray;
+import com.google.gwt.user.client.Window;
public class TmHelper {
@@ -180,6 +181,7 @@
JsArray<Role> validRoles = top.getRolesPlayed(subtype, supertypeSubtype);
for(int i = 0; i != validRoles.length(); ++i){
Association parent = validRoles.get(i).getParent();
+ Window.alert(">> " + parent.getRoles().length() + " >> " + parent.getRoles(supertype).length());
if(parent.getRoles().length() == 2 && parent.getRoles(supertype).length() == 1)result.add(parent.getRoles(supertype).get(0).getPlayer());
}
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 18 03:19:08 2011 (r1005)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Tue Oct 18 05:10:29 2011 (r1006)
@@ -116,6 +116,10 @@
{"subject_identifiers":["[gdlt:Descriptor]"], "instance_of":["si:[tmcl:topic-type]"]},
{"subject_identifiers":["[gdlt:Visible-Object]"]},
{"subject_identifiers":["[gdlt:Type]"]},
+ {"subject_identifiers":["[gdlt:Datatype]"]},
+ {"subject_identifiers":["[gdlt:Variant-Name-Scope]"]},
+ {"subject_identifiers":["[gdlt:Variant-Name-Identifiers]"]},
+ {"subject_identifiers":["[gdlt:Variant-Name-Reifier]"]},
{"subject_identifiers":["[gdl:id]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[gdl:padding-left]"], "instance_of":["si:[tmcl:occurrence-type]"]},
{"subject_identifiers":["[gdl:border-style]"], "instance_of":["si:[tmcl:occurrence-type]"]},
@@ -225,6 +229,30 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:variant-name-constraint]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[types:Scope-Type]"},{"type":"si:[tmdm:subtype]", "player":"si:[types:Language]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[types:Scope-Type]"},{"type":"si:[tmdm:subtype]", "player":"si:[types:Priority]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Visible-Object]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Visible-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:View]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:View]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Topic-View]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Topic-View]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Default-Topic-View]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Default-Topic-View]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Default-Editor-Topic-View]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Descriptor]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:TM-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Literal-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Default-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:TM-Single-Type-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:TM-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Default-Literal-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Literal-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Default-Literal-Value]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Default-Value]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Visible-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Text-Object]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Text-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Text]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Position]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Value-Group]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Text-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Action-Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Delete-Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Type]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Datatype]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Variant-Name-Scope]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Variant-Name-Identifiers]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Variant-Name-Reifier]"}]},
{"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-psi-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]},
More information about the Isidorus-cvs
mailing list