From lgiessmann at common-lisp.net Mon Oct 10 09:27:34 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 10 Oct 2011 02:27:34 -0700 Subject: [isidorus-cvs] r998 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base button environment Message-ID: Author: lgiessmann Date: Mon Oct 10 02:27:34 2011 New Revision: 998 Log: gdl-frontend: Widgets: removed GdlCreateButton - is a duplicate of GdlCommitButton Deleted: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCreateButton.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Fri Sep 30 11:53:47 2011 (r997) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Mon Oct 10 02:27:34 2011 (r998) @@ -118,7 +118,6 @@ public final static String gdlCheckBox = gdlt + "Check-Box"; public final static String gdlActionButton = gdlt + "Action-Button"; public final static String gdlValidateButton = gdlt + "Validate-Button"; - public final static String gdlCreateButton = gdlt + "Create-Button"; public final static String gdlDeleteButton = gdlt + "Delete-Button"; public final static String gdlCommitButton = gdlt + "Commit-Button"; } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java Fri Sep 30 11:53:47 2011 (r997) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java Mon Oct 10 02:27:34 2011 (r998) @@ -19,7 +19,6 @@ import us.isidor.gdl.anaToMia.Widgets.button.GdlActionButton; import us.isidor.gdl.anaToMia.Widgets.button.GdlCheckBox; import us.isidor.gdl.anaToMia.Widgets.button.GdlCommitButton; -import us.isidor.gdl.anaToMia.Widgets.button.GdlCreateButton; import us.isidor.gdl.anaToMia.Widgets.button.GdlDeleteButton; import us.isidor.gdl.anaToMia.Widgets.button.GdlRadioButton; import us.isidor.gdl.anaToMia.Widgets.button.GdlValidateButton; @@ -64,8 +63,6 @@ return new GdlCheckBox(tmRepresentative, receivedData, gdlParent); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.GDL.TopicType.gdlValidateButton)){ return new GdlValidateButton(tmRepresentative, receivedData, gdlParent); - }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.GDL.TopicType.gdlCreateButton)){ - return new GdlCreateButton(tmRepresentative, receivedData, gdlParent); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.GDL.TopicType.gdlDeleteButton)){ return new GdlDeleteButton(tmRepresentative, receivedData, gdlParent); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.GDL.TopicType.gdlCommitButton)){ From lgiessmann at common-lisp.net Thu Oct 13 13:21:35 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 13 Oct 2011 06:21:35 -0700 Subject: [isidorus-cvs] r999 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base Message-ID: Author: lgiessmann Date: Thu Oct 13 06:21:32 2011 New Revision: 999 Log: gdl-frontend: Widgets: started to implement the constriant support for: reifier-constraint, variant-name-constraint, scope-constraint, Type, Datatype, Variant-Name-Identifiers, Variant-Name-Refier, Variant-Name-Scope Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Mon Oct 10 02:27:34 2011 (r998) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Oct 13 06:21:32 2011 (r999) @@ -18,10 +18,10 @@ - + - + Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Mon Oct 10 02:27:34 2011 (r998) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 13 06:21:32 2011 (r999) @@ -3,7 +3,7 @@ and all referenced topics must be exported as stubs * implement validation * implement the handling of default-values -* Implement TopicMaps data consumption -* Implement TopicMaps data generation * Implement HiddenValue +* Finalise Text and List-Box +* Implement all other elements * Fix css-pseudo-class-handlers \ No newline at end of file Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Oct 10 02:27:34 2011 (r998) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Oct 13 06:21:32 2011 (r999) @@ -1937,6 +1937,12 @@ 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)){ + // TODO: implement: reifier-constraint + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ + // TODO: implement: variant-name-constraint + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ + // TODO: implement: scope-constraint } 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()))); @@ -1948,8 +1954,19 @@ this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); } } + } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){ + // TODO: implement: Type + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ + // TODO: implement: Datatype + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){ + // TODO: implement: Variant-Name-Identifiers + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ + // TODO: implement: Variant-Name-Reifier + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ + // TODO: implement: Variant-Name-Scope + } 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())); } - // TODO: implement type, variant, datatype, associations, roles, ... constraints } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Oct 10 02:27:34 2011 (r998) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Oct 13 06:21:32 2011 (r999) @@ -1,10 +1,21 @@ package us.isidor.gdl.anaToMia.Widgets.base; -import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadScreenPanel; - +import java.util.ArrayList; +import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; +import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes; +import us.isidor.gdl.anaToMia.Widgets.isidorus.CommitCallback; +import us.isidor.gdl.anaToMia.Widgets.isidorus.DeleteCallback; +import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.user.client.Timer; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.TextAreaElement; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.RootPanel; @@ -14,20 +25,7 @@ GdlPanel gdlPanel = null; @Override - public void onModuleLoad() { - final LoadScreenPanel lsp = new LoadScreenPanel("Title", "message"); - RootPanel.get().add(lsp); - - Timer t = new Timer() { - @Override - public void run() { - lsp.removeFromParent(); - } - }; - - t.schedule(5000); - - /* + public void onModuleLoad() { try{ RootPanel.get("GWT_Content").add(mainPanel); mainPanel.setBorderWidth(1); @@ -44,7 +42,7 @@ //Pair requestedTopicToEdit = new Pair("http://textgrid.org/serviceregistry/hash-object/Test Environment 1/test1", TopicIdentifierTypes.SubjectIdentifier); gdlPanel = new GdlPanel(null, requestedTopicsToCreate); - gdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() { + GdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() { @Override public void onClick(ClickEvent event) { Element elem = DOM.getElementById("hash_object_text_key_id__GDL_0"); @@ -56,9 +54,9 @@ mainPanel.add(gdlPanel); gdlPanel.setTmEngine(new JtmsTmEngine()); - gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback()); - gdlPanel.setCommitCallback(new CommitCallback()); - gdlPanel.setDeleteCallback(new DeleteCallback()); + gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback(null)); + gdlPanel.setCommitCallback(new CommitCallback(null)); + gdlPanel.setDeleteCallback(new DeleteCallback(null)); Button requestButton = new Button("load schema"); requestButton.addClickHandler(new ClickHandler() { @@ -73,6 +71,5 @@ e.printStackTrace(); Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage()); } - */ } } From lgiessmann at common-lisp.net Thu Oct 13 14:56:24 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 13 Oct 2011 07:56:24 -0700 Subject: [isidorus-cvs] r1000 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets Message-ID: Author: lgiessmann Date: Thu Oct 13 07:56:23 2011 New Revision: 1000 Log: gdl-frontend: Widgets: started to implement a new GDL-Schema Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/TextGrid_TMCL_2010-05-03_required.jtm Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Thu Oct 13 07:56:23 2011 (r1000) @@ -0,0 +1,115 @@ +{"version":"1.1", + + "prefixes":{"tmcl":"http://psi.topicmaps.org/tmcl/", + "tmdm":"http://psi.topicmaps.org/iso13250/model/", + "model":"http://services.org/serviceregistry/model/", + "srv":"http://textgrid.org/serviceregistry/"}, + + "item_type":"topicmap", + + "topics": [{"subject_identifiers":["[tmcl:topic-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:name-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:occurrence-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:role-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:association-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + + + {"subject_identifiers":["[tmcl:card-min]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:card-max]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:regexp]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:datatype]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]", "si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:subject-identifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:subject-locator-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:item-identifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-occurrence-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:regular-expression-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:occurrence-datatype-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:association-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:constrained]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:constrained-statement]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:constrained-role]"], "instance_of":["si:[tmcl:association-type]"]}, + + + {"subject_identifiers":["[tmdm:supertype]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmdm:subtype]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmdm:supertype-subtype]"], "instance_of":["si:[tmcl:association-type]"]}, + + + +==> Service + ==> subject-identifier-constraint + ==> subject-locator-constraint + ==> item-identifier-constraint + ==> topic-name-constraint + ==> regular-expression-constraint + ==> Type + ==> scope-constraint + ==> reifier-constraint + ==> item-identifier-constraint + ==> variant-name-constraint + ==> Datatype + ==> Variant-Name-Scope + ==> Variant-Name-Identifiers + ==> Variant-Name-Reifier + ==> topic-occurrence-constraint + ==> regular-expression-constraint + ==> occurrence-datatype-constraint + ==> Datatype + ==> Type + ==> scope-constraint + ==> reifier-constraint + ==> item-identifier-constraint + +==> Endpoint + ==> subject-identifier-constraint + ==> subject-locator-constraint + ==> item-identifier-constraint + ==> topic-name-constraint + ==> regular-expression-constraint + ==> Type + ==> scope-constraint + ==> reifier-constraint + ==> item-identifier-constraint + ==> variant-name-constraint + ==> Datatype + ==> Variant-Name-Scope + ==> Variant-Name-Identifiers + ==> Variant-Name-Reifier + ==> topic-occurrence-constraint + ==> regular-expression-constraint + ==> occurrence-datatype-constraint + ==> Datatype + ==> Type + ==> scope-constraint + ==> reifier-constraint + ==> item-identifier-constraint + +==> has-endpoint + ==> association-role-constraint + ==> topic-role-constraint + ==> item-identifier-constraint + ==> Type + ==> reifier-constraint + ==> scope-constraint + ==> Roles + ==> item-identifier-constraint + ==> reifier-constraint + ==> Type + ==> Role-Player + + ], + + "associations": [{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-identifier-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-locator-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:item-identifier-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-occurrence-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:regular-expression-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-role-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:association-role-constraint]"}]} + ] +} \ No newline at end of file Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/TextGrid_TMCL_2010-05-03_required.jtm ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/TextGrid_TMCL_2010-05-03_required.jtm Thu Oct 13 06:21:32 2011 (r999) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/TextGrid_TMCL_2010-05-03_required.jtm Thu Oct 13 07:56:23 2011 (r1000) @@ -34,8 +34,8 @@ {"subject_identifiers":["[tmcl:constrained-role]"], "instance_of":["si:[tmcl:association-type]"]}, {"subject_identifiers":["[tmdm:supertype]"], "instance_of":["si:[tmcl:role-type]"]}, - {"subject_identifiers":["[tmdm:subtype]"], "instance_of":["si:[tmcl:role-type]"]}, - {"subject_identifiers":["[tmdm:supertype-subtype]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmdm:subtype]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmdm:supertype-subtype]"], "instance_of":["si:[tmcl:association-type]"]}, {"subject_identifiers":["[tgt:Service]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tgt:Hash-Object]"], "instance_of":["si:[tmcl:topic-type]"]}, From lgiessmann at common-lisp.net Mon Oct 17 10:28:31 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 17 Oct 2011 03:28:31 -0700 Subject: [isidorus-cvs] r1001 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Mon Oct 17 03:28:30 2011 New Revision: 1001 Log: gdl-frontend: Widgets: developed the TMCL-definition for the new (test-)GDL-Schema Added: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt 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/GDL_Widgets.gwt.xml ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Thu Oct 13 07:56:23 2011 (r1000) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Mon Oct 17 03:28:30 2011 (r1001) @@ -18,10 +18,10 @@ - + - + Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 13 07:56:23 2011 (r1000) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Mon Oct 17 03:28:30 2011 (r1001) @@ -1,9 +1,8 @@ * implement export of Fragments, e.g. exportJTM11Fragment(ArrayList topics, ArrayList associaitions), e.i. the passed topics and associations must be exported with all characteristics and associations, and all referenced topics must be exported as stubs -* implement validation -* implement the handling of default-values -* Implement TopicMaps data consumption -* Implement TopicMaps data generation -* Implement HiddenValue +* implement all constraints + * TM-generation + * TM-consumption + * TM-validation * Fix css-pseudo-class-handlers \ No newline at end of file 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 Thu Oct 13 07:56:23 2011 (r1000) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Oct 17 03:28:30 2011 (r1001) @@ -1893,7 +1893,7 @@ // sets the fields for the received data protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException { - if(receivedData == null) return; +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()); @@ -1937,6 +1937,12 @@ 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)){ + // TODO: implement: reifier-constraint + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ + // TODO: implement: variant-name-constraint + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ + // TODO: implement: scope-constraint } 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()))); @@ -1948,8 +1954,19 @@ this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); } } + } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){ + // TODO: implement: Type + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ + // TODO: implement: Datatype + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){ + // TODO: implement: Variant-Name-Identifiers + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ + // TODO: implement: Variant-Name-Reifier + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ + // TODO: implement: Variant-Name-Scope + } 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())); } - // TODO: implement type, variant, datatype, associations, roles, ... constraints } Added: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Mon Oct 17 03:28:30 2011 (r1001) @@ -0,0 +1,163 @@ +{"version":"1.1", + + "prefixes":{"tmcl":"http://psi.topicmaps.org/tmcl/", + "tmdm":"http://psi.topicmaps.org/iso13250/model/", + "model":"http://services.org/serviceregistry/model/", + "types":"http://services.org/serviceregistry/model/types", + "srv":"http://service.org/serviceregistry/"}, + + "item_type":"topicmap", + + "topics": [{"subject_identifiers":["[tmcl:topic-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:name-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:occurrence-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:role-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:association-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + + + {"subject_identifiers":["[tmcl:card-min]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:card-max]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:regexp]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:datatype]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]", "si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:subject-identifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:subject-locator-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:item-identifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-occurrence-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:regular-expression-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:occurrence-datatype-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:topic-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:association-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:constrained]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:constrained-statement]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:constrained-role]"], "instance_of":["si:[tmcl:association-type]"]}, + + + {"subject_identifiers":["[tmdm:supertype]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmdm:subtype]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmdm:supertype-subtype]"], "instance_of":["si:[tmcl:association-type]"]}, + + + {"subject_identifiers":["[types:Service]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[types:Endpoint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[model:service-name]"], "instance_of":["si:[tmcl:name-type]"]}, + {"subject_identifiers":["[model:endpoint-address]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[model:has-endpoint]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[model:endpoint]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[model:service]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[types:Scope-Type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[model:symbolic-name]"], "instance_of":["si:[types:Scope-Topic]"]}, + {"subject_identifiers":["[types:Language]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[model:german]"], "instance_of":["si:[types:Language]"]}, + {"subject_identifiers":["[model:english]"], "instance_of":["si:[types:Language]"]}, + {"subject_identifiers":["[types:Priority]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[model:first]"], "instance_of":["si:[types:Priority]"]}, + {"subject_identifiers":["[model:second]"], "instance_of":["si:[types:Priority]"]}, + {"subject_identifiers":["[model:third]"], "instance_of":["si:[types:Priority]"]}, + {"subject_identifiers":["[types:Reifier-Type]"], "instance_of":["si:[tmcl:topic-type]"]}, + + + {"subject_identifiers":["[model:service-psi-constraint]"], "instance_of":["si:[tmcl:subject-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^http://service.org/serviceregistry/psis/service/.+$"}]}, + {"subject_identifiers":["[model:service-sl-constraint]"], "instance_of":["si:[tmcl:subject-locator-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:service-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"*"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:service-name-constraint]"], "instance_of":["si:[tmcl:topic-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:service-name-rex-constraint]"], "instance_of":["si:[tmcl:regular-expression-constraint]"], "occurrences":[{"type":"si:[tmcl:regexp]", "value":"^.+-Service$"}]}, + {"subject_identifiers":["[model:service-name-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"*"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:service-name-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:service-name-scope-constraint]"], "instance_of":["si:[tmcl:scope-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"0"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:service-variant-name-constraint]"], "instance_of":["si:[tmcl:variant-name-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"0"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + + {"subject_identifiers":["[model:endpoint-psi-constraint]"], "instance_of":["si:[tmcl:subject-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^http://service.org/serviceregistry/psis/endpoint/.+$"}]}, + {"subject_identifiers":["[model:endpoint-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:endpoint-address-constraint]"], "instance_of":["si:[tmcl:topic-occurrence-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:endpoint-address-rex-constraint]"], "instance_of":["si:[tmcl:regular-expression-constraint]"], "occurrences":[{"type":"si:[tmcl:regexp]", "value":"^http://.+$"}]}, + {"subject_identifiers":["[model:endpoint-address-dt-constraint]"], "instance_of":["si:[tmcl:occurrence-datatype-constraint]"], "occurrences":[{"type":"si:[tmcl:datatype]", "value":"http://www.w3.org/2001/XMLSchema#anyUri"}]}, + {"subject_identifiers":["[model:endpoint-address-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:endpoint-address-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, + + {"subject_identifiers":["[model:service-has-endpoint-role-constraint]"], "instance_of":["si:[tmcl:topic-role-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}]}, + {"subject_identifiers":["[model:endpoint-has-endpoint-role-constraint]"], "instance_of":["si:[tmcl:topic-role-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:has-endpoint-service-role-constraint]"], "instance_of":["si:[tmcl:association-role-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:has-endpoint-endpoint-role-constraint]"], "instance_of":["si:[tmcl:association-role-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:has-endpoint-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"*"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:has-endpoint-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:has-endpoint-scope-constraint]"], "instance_of":["si:[tmcl:scope-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"0"}]}, + {"subject_identifiers":["[model:service-has-endpoint-scope-required-constraint]"], "instance_of":["si:[tmcl:scope-required-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:endpoint-has-endpoint-scope-required-constraint]"], "instance_of":["si:[tmcl:scope-required-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:card-max]", "value":"1"}]}, + + {"subject_identifiers":["[model:endpoint-role-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:endpoint-role-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, + {"subject_identifiers":["[model:service-role-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, + {"subject_identifiers":["[model:service-role-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]} + ], + + "associations": [{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-identifier-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-locator-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:item-identifier-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-occurrence-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:regular-expression-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-role-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:association-role-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:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-psi-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-sl-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-rex-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:service-name-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-scope-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:constrained-scope]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-name-scope-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Language]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-variant-name-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-variant-name-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service-name]"}]}, + {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-variant-name-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:symbolic-name]"}]}, + + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-psi-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-rex-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-dt-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-constraint-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:endpoint-address-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:endpoint]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:has-endpoint-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-scope-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-scope]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-scope-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Priority]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:first]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:first]"}]}, + + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-role-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, + {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:service-role-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, + {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]} + ] +} \ No newline at end of file Added: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 03:28:30 2011 (r1001) @@ -0,0 +1,42 @@ +==> Service * + ==> subject-identifier-constraint * + ==> subject-locator-constraint * + ==> item-identifier-constraint * + ==> topic-name-constraint * + ==> regular-expression-constraint * + ==> Type + ==> scope-constraint * + ==> reifier-constraint * + ==> item-identifier-constraint * + ==> variant-name-constraint * + ==> Datatype + ==> Variant-Name-Scope + ==> Variant-Name-Identifiers + ==> Variant-Name-Reifier + + +==> Endpoint * + ==> subject-identifier-constraint * + ==> item-identifier-constraint * + ==> topic-occurrence-constraint * + ==> regular-expression-constraint * + ==> occurrence-datatype-constraint * + ==> Datatype + ==> Type + ==> reifier-constraint * + ==> item-identifier-constraint * + + +==> has-endpoint * + ==> association-role-constraint * + ==> topic-role-constraint * + ==> item-identifier-constraint * + ==> Type + ==> reifier-constraint * + ==> scope-constraint * + ==> scope-required-constraint * + ==> Roles + ==> item-identifier-constraint + ==> reifier-constraint + ==> Type + ==> Role-Player \ No newline at end of file From lgiessmann at common-lisp.net Mon Oct 17 15:14:13 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 17 Oct 2011 08:14:13 -0700 Subject: [isidorus-cvs] r1002 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Mon Oct 17 08:14:12 2011 New Revision: 1002 Log: gdl-frontend: Widgets: fixed some bugs in the TMCL-definition for the new (test-)GDL-Schema; implemented a new test-class Added: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Oct 17 03:28:30 2011 (r1001) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Oct 17 08:14:12 2011 (r1002) @@ -1,33 +1,89 @@ package us.isidor.gdl.anaToMia.Widgets.base; - -import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadScreenPanel; - +import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; +import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; +import us.isidor.gdl.anaToMia.Widgets.isidorus.CommitCallback; +import us.isidor.gdl.anaToMia.Widgets.isidorus.DeleteCallback; +import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback; +import us.isidor.gdl.anaToMia.Widgets.environment.IDeleteCallback; +import us.isidor.gdl.anaToMia.Widgets.environment.ILoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; +import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes; import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.user.client.Timer; +import com.google.gwt.dom.client.Element; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.http.client.RequestException; +import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.Button; +import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.dom.client.TextAreaElement; +import java.util.ArrayList; public class TestClass implements EntryPoint{ + public final String MODEL_PREF = "http://services.org/serviceregistry/model/types/"; + public final String SERVICE_PSI = MODEL_PREF + "Service"; + public final String SORT_SERVICE = "http://service.org/serviceregistry/psis/service/sort-service"; + HorizontalPanel mainPanel = new HorizontalPanel(); + GdlPanel gdlPanel = null; + @Override public void onModuleLoad() { - RootPanel.get().setHeight("1500px"); - RootPanel.get().setWidth("2500px"); - Window.enableScrolling(false); - final LoadScreenPanel lsp = new LoadScreenPanel("Title", "message"); - RootPanel.get().add(lsp); - - Timer t = new Timer() { - @Override - public void run() { - lsp.removeFromParent(); - Window.enableScrolling(true); - } - }; - - t.schedule(5000); - - + try{ + RootPanel.get("GWT_Content").add(mainPanel); + mainPanel.setBorderWidth(1); + mainPanel.setPixelSize(1000, 600); + + ArrayList> requestedTopicsToCreate = new ArrayList>(); + requestedTopicsToCreate.add(new Pair(SERVICE_PSI, TopicIdentifierTypes.SubjectIdentifier)); + + Pair requestedTopicToEdit = new Pair(SORT_SERVICE, TopicIdentifierTypes.SubjectIdentifier); + gdlPanel = new GdlPanel(requestedTopicToEdit, null); + + GdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + Element elem = DOM.getElementById("hash_object_text_key_id__GDL_0"); + ((TextAreaElement)elem).setValue(""); + elem = DOM.getElementById("hash_object_text_value_id__GDL_0"); + ((TextAreaElement)elem).setValue(""); + } + }); + + mainPanel.add(gdlPanel); + gdlPanel.setTmEngine(new JtmsTmEngine()); + gdlPanel.setLoadSchemaCallback(new TestLoadSchemaCallback()); + gdlPanel.setCommitCallback(new ICommitCallback() { + @Override + public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine) { + Window.alert("not implemented yet :-("); + } + }); + gdlPanel.setDeleteCallback(new IDeleteCallback() { + @Override + public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId) { + Window.alert("not implemented yet :-("); + } + }); + + Button requestButton = new Button("load schema"); + requestButton.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + gdlPanel.loadSchema(); + } + }); + + mainPanel.add(requestButton); + }catch(Exception e){ + e.printStackTrace(); + Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage()); + } } } Added: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java Mon Oct 17 08:14:12 2011 (r1002) @@ -0,0 +1,122 @@ +package us.isidor.gdl.anaToMia.Widgets.base; + + +import java.util.ArrayList; +import com.google.gwt.core.client.GWT; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.http.client.Request; +import com.google.gwt.http.client.RequestBuilder; +import com.google.gwt.http.client.RequestCallback; +import com.google.gwt.http.client.RequestException; +import com.google.gwt.http.client.Response; +import com.google.gwt.http.client.URL; +import com.google.gwt.user.client.Window; +import us.isidor.gdl.anaToMia.Widgets.base.ButtonDialog; +import us.isidor.gdl.anaToMia.Widgets.base.GdlPanel; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; +import us.isidor.gdl.anaToMia.Widgets.environment.ILoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; +import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes; + + +// this class can be used as a callback that requests the Topic Map data +// addressable by the URI requestUrl +public class TestLoadSchemaCallback implements ILoadSchemaCallback{ + private final String requestUrl = URL.encode(GWT.getModuleBaseURL() + "Service_GDL_Schema.jtm"); + private ArrayList> requestedTopicsToCreate = new ArrayList>(); + private Pair requestedTopicToEdit = null; + private RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, requestUrl); + + + public TestLoadSchemaCallback(){} + + + // this method is invoked as a callback method + @Override + public void loadSchema(GdlPanel panel, Pair requestedTopicToEdit , ArrayList> requestedTopicsToCreate)throws RequestException { + this.requestedTopicsToCreate = requestedTopicsToCreate; + this.requestedTopicToEdit = requestedTopicToEdit; + requestBuilder.sendRequest(null, new RequestCallbackImpl(panel)); + } + + + // this method implements the actual request and a simple error handling + private class RequestCallbackImpl implements RequestCallback{ + private GdlPanel panel = null; + + + @SuppressWarnings("unused") + private RequestCallbackImpl() {} + + + public RequestCallbackImpl(GdlPanel panel){ + this.panel = panel; + } + + + @Override + public void onResponseReceived(Request request, Response response) { + if(Response.SC_OK == response.getStatusCode()){ + try{ + if(panel.getTmEngine() == null || panel.getSchemaTm() == null) throw new ExecutionException("no Topic Maps engine was set yet"); + panel.getTmEngine().importTopicMap(response.getText(), panel.getSchemaTm()); + panel.createView(); + }catch(ExecutionException e){ + Window.alert("Execution Error: " + e.getMessage()); + }catch(Exception e){ + Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncaught error: " + e.getLocalizedMessage()); // TODO: implement smarter error handling + e.printStackTrace(); + } + } else { + final ButtonDialog dialog = new ButtonDialog("Connection Error", "The request to " + requestUrl + " failed\n" + response.getStatusCode() + ": " + response.getStatusText(), "retry", "cancel", null, null); + dialog.setLeftButtonClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + dialog.hide(); + try{ + loadSchema(panel, TestLoadSchemaCallback.this.requestedTopicToEdit, TestLoadSchemaCallback.this.requestedTopicsToCreate); + }catch(Exception e){ + Window.alert("connection to : " + requestUrl + " failed: " + e.getMessage()); + } + } + }); + + dialog.setRightButtonClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + dialog.hide(); + } + }); + + dialog.center(); + } + } + + + @Override + public void onError(Request request, Throwable exception) { + final ButtonDialog dialog = new ButtonDialog("Connection Error", "The request to " + requestUrl + " failed\n" + exception.getMessage(), "retry", "cancel", null, null); + dialog.setLeftButtonClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + dialog.hide(); + try{ + loadSchema(panel, TestLoadSchemaCallback.this.requestedTopicToEdit, TestLoadSchemaCallback.this.requestedTopicsToCreate); + }catch(Exception e){ + Window.alert("connection to : " + requestUrl + " failed: " + e.getMessage()); + } + } + }); + + dialog.setRightButtonClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + dialog.hide(); + } + }); + + dialog.center(); + } + } +} 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 Mon Oct 17 03:28:30 2011 (r1001) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Mon Oct 17 08:14:12 2011 (r1002) @@ -3,7 +3,10 @@ "prefixes":{"tmcl":"http://psi.topicmaps.org/tmcl/", "tmdm":"http://psi.topicmaps.org/iso13250/model/", "model":"http://services.org/serviceregistry/model/", - "types":"http://services.org/serviceregistry/model/types", + "gdl":"http://psi.isidor.us/gdl/", + "gdlt":"http://psi.isidor.us/gdl/types/", + "gdlsrv":"http://service.org/serviceregistry/gdl/", + "types":"http://services.org/serviceregistry/model/types/", "srv":"http://service.org/serviceregistry/"}, "item_type":"topicmap", @@ -12,6 +15,7 @@ {"subject_identifiers":["[tmcl:name-type]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:occurrence-type]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:role-type]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:role-type]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:association-type]"], "instance_of":["si:[tmcl:topic-type]"]}, @@ -19,6 +23,11 @@ {"subject_identifiers":["[tmcl:card-max]"], "instance_of":["si:[tmcl:occurrence-type]"]}, {"subject_identifiers":["[tmcl:regexp]"], "instance_of":["si:[tmcl:occurrence-type]"]}, {"subject_identifiers":["[tmcl:datatype]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[tmcl:allowed-reifier]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:allowed]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:allows]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[tmcl:constrained-scope]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[tmcl:constrained-scope-topic]"], "instance_of":["si:[tmcl:association-type]"]}, {"subject_identifiers":["[tmcl:constraint]"], "instance_of":["si:[tmcl:topic-type]", "si:[tmcl:role-type]"]}, {"subject_identifiers":["[tmcl:subject-identifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:subject-locator-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, @@ -26,9 +35,13 @@ {"subject_identifiers":["[tmcl:topic-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:topic-occurrence-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:regular-expression-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:variant-name-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:occurrence-datatype-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:topic-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:association-role-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:reifier-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:scope-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[tmcl:scope-required-constraint]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:constrained]"], "instance_of":["si:[tmcl:role-type]"]}, {"subject_identifiers":["[tmcl:constrained-statement]"], "instance_of":["si:[tmcl:association-type]"]}, {"subject_identifiers":["[tmcl:constrained-topic-type]"], "instance_of":["si:[tmcl:association-type]"]}, @@ -48,7 +61,7 @@ {"subject_identifiers":["[model:endpoint]"], "instance_of":["si:[tmcl:role-type]"]}, {"subject_identifiers":["[model:service]"], "instance_of":["si:[tmcl:role-type]"]}, {"subject_identifiers":["[types:Scope-Type]"], "instance_of":["si:[tmcl:topic-type]"]}, - {"subject_identifiers":["[model:symbolic-name]"], "instance_of":["si:[types:Scope-Topic]"]}, + {"subject_identifiers":["[model:symbolic-name]"], "instance_of":["si:[types:Scope-Type]"]}, {"subject_identifiers":["[types:Language]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[model:german]"], "instance_of":["si:[types:Language]"]}, {"subject_identifiers":["[model:english]"], "instance_of":["si:[types:Language]"]}, @@ -90,7 +103,70 @@ {"subject_identifiers":["[model:endpoint-role-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, {"subject_identifiers":["[model:endpoint-role-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, {"subject_identifiers":["[model:service-role-ii-constraint]"], "instance_of":["si:[tmcl:item-identifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-min]", "value":"1"}, {"type":"si:[tmcl:regexp]", "value":"^.+$"}]}, - {"subject_identifiers":["[model:service-role-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]} + {"subject_identifiers":["[model:service-role-reifier-constraint]"], "instance_of":["si:[tmcl:reifier-constraint]"], "occurrences":[{"type":"si:[tmcl:card-max]", "value":"1"}]}, + + + {"subject_identifiers":["[gdlt:Schema]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[gdl:schema-name]"], "instance_of":["si:[tmcl:name-type]"]}, + {"subject_identifiers":["[gdlt:Descriptor]"], "instance_of":["si:[tmcl:topic-type]"]}, + {"subject_identifiers":["[gdlt:Visible-Object]"]}, + {"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]"]}, + {"subject_identifiers":["[gdl:cursor]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:width]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:height]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:contains]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:background-color]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:color]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:View]"]}, + {"subject_identifiers":["[gdl:contains]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:tm-binding]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:container]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:descriptor]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:tm-construct]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:value-group]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:ancestor]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:tm-value]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:value]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:value-binding]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:position]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:topic-view-binding]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:view-binding]"], "instance_of":["si:[tmcl:association-type]"]}, + {"subject_identifiers":["[gdl:descendant]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:containee]"], "instance_of":["si:[tmcl:role-type]"]}, + {"subject_identifiers":["[gdl:view-name]"], "instance_of":["si:[tmcl:name-type]"]}, + {"subject_identifiers":["[gdlt:Topic-View]"]}, + {"subject_identifiers":["[gdlt:Default-Topic-View]"]}, + {"subject_identifiers":["[gdlt:Default-Editor-Topic-View]"]}, + {"subject_identifiers":["[gdlt:Value]"]}, + {"subject_identifiers":["[gdlt:TM-Value]"]}, + {"subject_identifiers":["[gdlt:TM-Single-Type-Value]"]}, + {"subject_identifiers":["[gdlt:Literal-Value]"]}, + {"subject_identifiers":["[gdl:literal-value]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:Default-Value]"]}, + {"subject_identifiers":["[gdl:fixed]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:Default-Literal-Value]"]}, + {"subject_identifiers":["[gdlt:Text-Object]"]}, + {"subject_identifiers":["[gdl:font-size]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:Text]"]}, + {"subject_identifiers":["[gdl:readonly]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:Position]"]}, + {"subject_identifiers":["[gdl:position-style]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:top]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:left]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdlt:Value-Group]"]}, + {"subject_identifiers":["[gdlt:Button]"]}, + {"subject_identifiers":["[gdlt:Action-Button]"]}, + {"subject_identifiers":["[gdlt:Delete-Button]"]}, + + {"subject_identifiers":["[gdlsrv:service-schema]"], "instance_of":["si:[gdlt:Schema]"], "names":[{"type":"si:[gdl:schema-name]", "value":"GDL Schema for a Service UI"}]}, + {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"100px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, + {"subject_identifiers":["[gdlsrv:service-editor-view-binding]"], "instance_of":["si:[gdlt:TM-Single-Type-Value]"]}, + + {"subject_identifiers":["[gdlsrv:service-psis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_psis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-psis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"10px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-psis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]} ], "associations": [{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]}, @@ -101,9 +177,13 @@ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:regular-expression-constraint]"}]}, {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-role-constraint]"}]}, {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:association-role-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:scope-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:scope-required-constraint]"}]}, + {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:reifier-constraint]"}]}, + {"type":"si:[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:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-psi-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-sl-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, @@ -126,20 +206,20 @@ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-rex-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-dt-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, - {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-constraint-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, + {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:endpoint-address-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-address-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint-address]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, - {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, - {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, - {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, - {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:service]"}]}, - {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:has-endpoint]"}]}, - {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:endpoint]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-endpoint-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, + {"type":"si:[tmcl:constrained-role]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-service-role-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:has-endpoint-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, @@ -148,16 +228,48 @@ {"type":"si:[tmcl:constrained-scope]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:has-endpoint-scope-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Priority]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, - {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:first]"}]}, + {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:first]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:Endpoint]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:has-endpoint]"}]}, - {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[types:first]"}]}, + {"type":"si:[tmcl:constrained-scope-topic]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-has-endpoint-scope-required-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:first]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-role-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:service-role-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:service]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-ii-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]}, - {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]} + {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, + + + {"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:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-schema]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-default-editor-topic-view]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-editor-view-binding]"},{"type":"si:[gdl:tm-construct]", "player":"si:[types:Service]"}]}, + {"type":"si:[gdl:topic-view-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:tm-value]", "player":"si:[gdlsrv:service-editor-view-binding]"}]}, + + {"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-psis-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-psis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-psis-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-psis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-psis-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-psis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-psi-constraint]"}]} + ] } \ No newline at end of file Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 03:28:30 2011 (r1001) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 08:14:12 2011 (r1002) @@ -1,5 +1,5 @@ -==> Service * - ==> subject-identifier-constraint * +==> Service ** + ==> subject-identifier-constraint ** ==> subject-locator-constraint * ==> item-identifier-constraint * ==> topic-name-constraint * @@ -36,7 +36,7 @@ ==> scope-constraint * ==> scope-required-constraint * ==> Roles - ==> item-identifier-constraint - ==> reifier-constraint + ==> item-identifier-constraint * + ==> reifier-constraint * ==> Type ==> Role-Player \ No newline at end of file From lgiessmann at common-lisp.net Mon Oct 17 15:41:37 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 17 Oct 2011 08:41:37 -0700 Subject: [isidorus-cvs] r1003 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Mon Oct 17 08:41:37 2011 New Revision: 1003 Log: gdl-frontend: Widgets: started to implement a actual GDL-Schema for the new test-schema Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Oct 17 08:14:12 2011 (r1002) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Oct 17 08:41:37 2011 (r1003) @@ -4,19 +4,14 @@ import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; -import us.isidor.gdl.anaToMia.Widgets.isidorus.CommitCallback; -import us.isidor.gdl.anaToMia.Widgets.isidorus.DeleteCallback; -import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback; import us.isidor.gdl.anaToMia.Widgets.environment.IDeleteCallback; -import us.isidor.gdl.anaToMia.Widgets.environment.ILoadSchemaCallback; import us.isidor.gdl.anaToMia.Widgets.environment.Pair; import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.dom.client.Element; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.http.client.RequestException; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; 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 Mon Oct 17 08:14:12 2011 (r1002) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Mon Oct 17 08:41:37 2011 (r1003) @@ -110,6 +110,7 @@ {"subject_identifiers":["[gdl:schema-name]"], "instance_of":["si:[tmcl:name-type]"]}, {"subject_identifiers":["[gdlt:Descriptor]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[gdlt:Visible-Object]"]}, + {"subject_identifiers":["[gdlt:Type]"]}, {"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]"]}, @@ -161,12 +162,29 @@ {"subject_identifiers":["[gdlt:Delete-Button]"]}, {"subject_identifiers":["[gdlsrv:service-schema]"], "instance_of":["si:[gdlt:Schema]"], "names":[{"type":"si:[gdl:schema-name]", "value":"GDL Schema for a Service UI"}]}, - {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"100px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, + {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"300px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, {"subject_identifiers":["[gdlsrv:service-editor-view-binding]"], "instance_of":["si:[gdlt:TM-Single-Type-Value]"]}, {"subject_identifiers":["[gdlsrv:service-psis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_psis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, {"subject_identifiers":["[gdlsrv:service-psis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"10px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, - {"subject_identifiers":["[gdlsrv:service-psis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]} + {"subject_identifiers":["[gdlsrv:service-psis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-sls-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_sls_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-sls-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"30px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-sls-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_iis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"50px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-name-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-name-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"70px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-name-type-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_type_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-name-type-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"90px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-type-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[model:service-name-type-constraint]"], "instance_of":["si:[gdlt:Type]"]} ], "associations": [{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]}, @@ -269,7 +287,28 @@ {"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-psis-text]"}]}, {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-psis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-psis-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-psis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-psis-text]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-psis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-psi-constraint]"}]} + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-psis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-psi-constraint]"}]}, + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-sls-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-sls-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-psis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-sls-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-sls-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-sls-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-sls-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-sls-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-iis-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-sls-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-iis-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-iis-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-iis-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-type-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-type-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-type-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-type-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-type-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-type-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-type-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-constraint]"}]} + ] } \ No newline at end of file Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 08:14:12 2011 (r1002) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 08:41:37 2011 (r1003) @@ -1,10 +1,10 @@ ==> Service ** ==> subject-identifier-constraint ** - ==> subject-locator-constraint * - ==> item-identifier-constraint * - ==> topic-name-constraint * - ==> regular-expression-constraint * - ==> Type + ==> subject-locator-constraint ** + ==> item-identifier-constraint ** + ==> topic-name-constraint ** + ==> regular-expression-constraint ** + ==> Type * ==> scope-constraint * ==> reifier-constraint * ==> item-identifier-constraint * From lgiessmann at common-lisp.net Tue Oct 18 10:17:11 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 18 Oct 2011 03:17:11 -0700 Subject: [isidorus-cvs] r1004 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Tue Oct 18 03:17:10 2011 New Revision: 1004 Log: gdl-frontend: Widgets: implemented the item-identifier-constraints for occurrences and names 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 trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Oct 17 08:41:37 2011 (r1003) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 03:17:10 2011 (r1004) @@ -2,6 +2,9 @@ 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; @@ -111,21 +114,21 @@ protected boolean cardMaxSet = false; protected ArrayList rawTmValues = new ArrayList(); protected boolean rawTmValuesSet = false; - + // some constructors protected GdlVisibleObject() { initWidget(this.mainPanel); DOM.setStyleAttribute(this.mainPanel.getElement(), "overflow", "visible"); } - + public GdlVisibleObject(Topic tmRepresentative, Construct receivedData, GdlVisibleObject gdlParent) throws InvalidGdlSchemaException, ExecutionException{ this(); this.tmRepresentative = tmRepresentative; this.tm = this.tmRepresentative.getTopicMap(); this.gdlParent = gdlParent; - + if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && !(receivedData instanceof Name) && !(receivedData instanceof Variant) && !(receivedData instanceof Occurrence) && !(receivedData instanceof Role) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic, Association, Topic-Name, Name-Variant, Topic-Occurrence or Association-Role, but is: " + receivedData.getClass()); this.receivedData = receivedData; @@ -133,46 +136,46 @@ this.setGdlStyle(); } - + public GdlVisibleObject getGdlParent(){ return this.gdlParent; } - - + + public int getSubElementsCount(){ if(this.subElements == null) return 0; return this.subElements.size(); } - - + + public GdlPanel getRoot(){ return this.getGdlParent().getRoot(); } - - + + // this method takes a string and creates a new sub-element within // an instance of GdlVisibleObject with the passed string value public abstract void addSubItem(String value) throws InvalidGdlSchemaException, ExecutionException; - + // returns the topic that represents this element public Topic getTmRepresentative(){ return this.tmRepresentative; } - - + + // sets all info elements as defined in the GDL public void setInfoElements() throws InvalidGdlSchemaException, ExecutionException{ ArrayList infos = TmHelper.topicContainsInfo(this.tmRepresentative); - + for (Topic info : infos){ GdlInfo elem = (GdlInfo)GdlInstantiator.instantiate(info, this.receivedData, this); this.infoElements.add(elem); elem.setPosition(this); } } - - + + // this method should be invoked if a new sub-element is added to this instance protected ButtonableObject addToContainerPanel(Widget widget) throws ExecutionException, InvalidGdlSchemaException{ this.setContentOrientation(this.getContentOrientation()); @@ -182,8 +185,8 @@ this.setNthButtons(); return btn; } - - + + // removes the passed widget, it's parent, and returns the parent protected ButtonableObject removeFromContainer(Widget widget) throws InvalidGdlSchemaException, ExecutionException { for (Widget elem : this.subElements) { @@ -194,31 +197,31 @@ } } this.setNthButtons(); - + return null; } - - + + // sets all buttons in the sub-elements that are specified by a // gdl:button-position association protected void setNthButtons() throws InvalidGdlSchemaException, ExecutionException { if(this.actionButtonsAndPositions == null) this.actionButtonsAndPositions = TmHelper.topicContainsNthButtons(this.tmRepresentative); - + for(int i = 0; i != this.subElements.size(); ++i){ // search all buttons for the current sub element ArrayList currentButtons = new ArrayList(); for (Pair pair : this.actionButtonsAndPositions) if(pair.getSecond() == i || (i == this.subElements.size() -1 && pair.getSecond() == -1)) currentButtons.add(pair.getFirst()); - + // remove buttons that do not belong to the current sub element anymore ((ButtonableObject)this.subElements.get(i)).removeObsoleteButtons(currentButtons); - + // add buttons that are not bound to the current sub element, but belong to it for (Topic currentButton : currentButtons) if(!((ButtonableObject)this.subElements.get(i)).containsButton(currentButton)) ((ButtonableObject)this.subElements.get(i)).addButton((GdlActionButton)GdlInstantiator.instantiate(currentButton, null, this)); } } - + // a helper method that returns all occurrences of the type bound to the passed PSI @SuppressWarnings("unchecked") @@ -293,7 +296,7 @@ // If no gdl:display occurrence is set, the default value is returned public Display getDisplay() throws InvalidGdlSchemaException { Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlDisplay); - + if(displayOcc != null){ String value = displayOcc.getValue().toLowerCase(); if(value.equals("none")){ @@ -329,7 +332,7 @@ // this property if no gdl:float occurrence is available public Float getFloat() throws InvalidGdlSchemaException { Occurrence floatOcc = getNoneOrOneUnscopedOccurrence(PSIs.GDL.OccurrenceType.gdlFloat); - + if(floatOcc != null){ String value = floatOcc.getValue().toLowerCase(); if(value.equals("none")){ @@ -345,8 +348,8 @@ return Float.NONE; } } - - + + // returns a ClearValue instance of a gdl:clear occurrence or the default value for // this property if no gdl:clear occurrence is available public ClearValue getClear() throws InvalidGdlSchemaException { @@ -362,8 +365,8 @@ return ClearValue.NONE; } } - - + + // returns a ContentOrientationValue instance of a gdl:content-orientation occurrence or the default value for // this property if no gdl:content-orientation occurrence is available public ContentOrientationValue getContentOrientation() throws InvalidGdlSchemaException { @@ -379,8 +382,8 @@ return ContentOrientationValue.VERTICAL; } } - - + + // returns a VerticalAlign instance of a gdl:vertical-align occurrence // or the default value for this property if no gdl:vertical-align occurrence // is available. The styleClass attribute is used as scope for expressing @@ -1225,7 +1228,7 @@ } } - + // sets the id property of this element by using the GWT DOM class public void setId(String id){ if(id != null){ @@ -1258,16 +1261,16 @@ DOM.setStyleAttribute(this.mainPanel.getElement(), "styleFloat", value.getCssName()); } } - - + + // sets the float style property of all sub elements by using the GWT DOM class public void setContentOrientation(ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException { if(value == ContentOrientationValue.HORIZONTAL && this.containerPanel == null) this.containerPanel = new HorizontalPanel(); else if(this.containerPanel == null) this.containerPanel = new VerticalPanel(); - + this.mainPanel.add(this.containerPanel); } - + // sets the clear style property of this element by using the GWT DOM class public void setClear(ClearValue value){ @@ -1275,7 +1278,7 @@ DOM.setStyleAttribute(this.mainPanel.getElement(), "clear", value.getCssValue()); } } - + // sets the vertical-align style property of this element and all it's sub-elements by using the GWT DOM class public void setVerticalAlign(Widget widget, VerticalAlign value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { @@ -1284,7 +1287,7 @@ } } - + // sets the margin style property of this element by using the GWT DOM class public void setMargin(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "margin", value.getCssValue()); @@ -1313,8 +1316,8 @@ public void setMarginLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "marginLeft", value.getCssValue()); } - - + + // sets the border-color style property of this element by using the GWT DOM class public void setBorderColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderColor", value.getCssValue()); @@ -1343,8 +1346,8 @@ public void setBorderLeftColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderLeftColor", value.getCssValue()); } - - + + // sets the border-style style property of this element by using the GWT DOM class public void setBorderStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderStyle", value.getCssValue()); @@ -1374,7 +1377,7 @@ if(value != null) this.setCssProperty(widget, styleClass, "borderLeftStyle", value.getCssValue()); } - + // sets the border-width style property of this element by using the GWT DOM class public void setBorderWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderWidth", value.getCssValue()); @@ -1402,8 +1405,8 @@ public void setBorderLeftWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderLeftWidth", value.getCssValue()); } - - + + // sets the border-radius style property of this element by using the GWT DOM class public void setBorderRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderRadius", value.getCssValue()); @@ -1432,8 +1435,8 @@ public void setBorderTopLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "borderTopLeftRadius", value.getCssValue()); } - - + + // sets the padding style property of this element by using the GWT DOM class public void setPadding(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "padding", value.getCssValue()); @@ -1462,8 +1465,8 @@ public void setPaddingLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "paddingLeft", value.getCssValue()); } - - + + // sets the width style property of this element by using the GWT DOM class public void setWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "width", value.getCssValue()); @@ -1498,8 +1501,8 @@ public void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue()); } - - + + // sets the cursor style property of this element by using the GWT DOM class public void setCursor(Widget widget, CursorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "cursor", value.getCssValue()); @@ -1510,8 +1513,8 @@ public void setBackgroundColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { if(value != null) this.setCssProperty(widget, styleClass, "backgroundColor", value.getCssValue()); } - - + + // sets the passed css style porperty to the passed css value. // If a styleClass is given, the style is applied to either active, hover or focus protected void setCssProperty(String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ @@ -1530,12 +1533,12 @@ throw new InvalidGdlSchemaException("GDL defines only the style classes " + values + ", but found " + styleClass); } } - - + + // sets a given css property and css value of this element's sub element protected void setCssProperty(Widget elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ if(cssValue == null || cssProperty == null) return; - + if(styleClass == null){ DOM.setStyleAttribute(elem.getElement(), cssProperty, cssValue); } else if(styleClass.equals(PSIs.GDL.Scope.gdlActive)){ @@ -1549,12 +1552,12 @@ throw new InvalidGdlSchemaException("GDL defines only the style classes " + values + ", but found " + styleClass); } } - - + + // sets a given css property and css value of this element's sub element protected void setCssProperty(Element elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ if(cssValue == null || cssProperty == null) return; - + if(styleClass == null){ DOM.setStyleAttribute(elem, cssProperty, cssValue); } else if(styleClass.equals(PSIs.GDL.Scope.gdlActive)){ @@ -1568,64 +1571,64 @@ throw new InvalidGdlSchemaException("GDL defines only the style classes " + values + ", but found " + styleClass); } } - - + + // sets all GDL styles that are defined by the topic map representative to tha passed widget public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { String[] styleClasses = new String[]{null, PSIs.GDL.Scope.gdlActive, PSIs.GDL.Scope.gdlFocus, PSIs.GDL.Scope.gdlHover}; for (String styleClass : styleClasses) { this.setVerticalAlign(widget, this.getVerticalAlign(styleClass), styleClass); - + this.setMargin(widget, this.getMargin(styleClass), styleClass); this.setMarginTop(widget, this.getMarginTop(styleClass), styleClass); this.setMarginRight(widget, this.getMarginRight(styleClass), styleClass); this.setMarginBottom(widget, this.getMarginBottom(styleClass), styleClass); this.setMarginLeft(widget, this.getMarginLeft(styleClass), styleClass); - + this.setPadding(widget, this.getPadding(styleClass), styleClass); this.setPaddingTop(widget, this.getPaddingTop(styleClass), styleClass); this.setPaddingRight(widget, this.getPaddingRight(styleClass), styleClass); this.setPaddingBottom(widget, this.getPaddingBottom(styleClass), styleClass); this.setPaddingLeft(widget, this.getPaddingLeft(styleClass), styleClass); - + this.setBorderColor(widget, this.getBorderColor(styleClass), styleClass); this.setBorderTopColor(widget, this.getBorderTopColor(styleClass), styleClass); this.setBorderRightColor(widget, this.getBorderRightColor(styleClass), styleClass); this.setBorderBottomColor(widget, this.getBorderBottomColor(styleClass), styleClass); this.setBorderLeftColor(widget, this.getBorderLeftColor(styleClass), styleClass); - + this.setBorderStyle(widget, this.getBorderStyle(styleClass), styleClass); this.setBorderTopStyle(widget, this.getBorderTopStyle(styleClass), styleClass); this.setBorderRightStyle(widget, this.getBorderRightStyle(styleClass), styleClass); this.setBorderBottomStyle(widget, this.getBorderBottomStyle(styleClass), styleClass); this.setBorderLeftStyle(widget, this.getBorderLeftStyle(styleClass), styleClass); - + this.setBorderWidth(widget, this.getBorderWidth(styleClass), styleClass); this.setBorderTopWidth(widget, this.getBorderTopWidth(styleClass), styleClass); this.setBorderRightWidth(widget, this.getBorderRightWidth(styleClass), styleClass); this.setBorderBottomWidth(widget, this.getBorderBottomWidth(styleClass), styleClass); this.setBorderLeftWidth(widget, this.getBorderLeftWidth(styleClass), styleClass); - + this.setBorderRadius(widget, this.getBorderRadius(styleClass), styleClass); this.setBorderTopRightRadius(widget, this.getBorderTopRightRadius(styleClass), styleClass); this.setBorderBottomRightRadius(widget, this.getBorderBottomRightRadius(styleClass), styleClass); this.setBorderBottomLeftRadius(widget, this.getBorderBottomLeftRadius(styleClass), styleClass); this.setBorderTopLeftRadius(widget, this.getBorderTopLeftRadius(styleClass), styleClass); - + this.setCursor(widget, this.getCursor(styleClass), styleClass); - + this.setWidth(widget, this.getWidth(styleClass), styleClass); this.setMaxWidth(widget, this.getMaxWidth(styleClass), styleClass); this.setMinWidth(widget, this.getMinWidth(styleClass), styleClass); - + this.setHeight(widget, this.getHeight(styleClass), styleClass); this.setMaxHeight(widget, this.getMaxHeight(styleClass), styleClass); this.setMinHeight(widget, this.getMinHeight(styleClass), styleClass); - + this.setBackgroundColor(widget, this.getBackgroundColor(styleClass), styleClass); } } - + // sets all GDL styles that are defined by the topic map representative protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { @@ -1679,8 +1682,8 @@ } return regs; } - - + + // registers a mouse-down handler to all sub-elements of this element @Override public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){ @@ -1690,8 +1693,8 @@ } return regs; } - - + + // registers a mouse-up handler to all sub-elements of this element @Override public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){ @@ -1701,9 +1704,9 @@ } return regs; } - - - + + + // registers a blur handler to all sub-elements of this element @Override public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){ @@ -1713,12 +1716,12 @@ } return regs; } - - + + // adds the passed handler to the list eventHandlers protected void addEventHandler(Widget elem, EventHandler handler){ if(handler == null || elem == null) return; - + for (Pair> item : this.eventHandlers) { if(item.getFirst().equals(elem)){ if(!item.getSecond().contains(handler)){ @@ -1731,8 +1734,8 @@ newHandlerList.add(handler); this.eventHandlers.add(new Pair>(elem, newHandlerList)); } - - + + // remove the passed handler of the list eventHandlers protected void removeEventHandler(Widget elem, EventHandler handler){ for (Pair> item : this.eventHandlers) { @@ -1741,8 +1744,8 @@ } } } - - + + // returns the last handler bound to the passed element. protected EventHandler getLastHandler(Widget elem){ for (Pair> item : this.eventHandlers) { @@ -1753,35 +1756,35 @@ } } } - + return null; } - - + + // applies the styles bound to hover and the passed element protected void onHoverStart(Widget widget){ for (Pair elem : this.hoverCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } } - - + + // applies the styles bound to acitve and the passed element protected void onActiveStart(Widget widget){ for (Pair elem : this.activeCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } } - - + + // applies the styles bound to focus and the passed element protected void onFocusStart(Widget widget){ for (Pair elem : this.focusCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } } - - + + // some handler for applying the css style bound to the pseudo classes hover, active and focus public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { Widget source = (Widget)event.getSource(); @@ -1791,7 +1794,7 @@ } } - + // shall be called when the focus event was fired public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { try{ @@ -1809,7 +1812,7 @@ e.printStackTrace(); } } - + // shall be called to apply the styles of the focus class public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { @@ -1838,7 +1841,7 @@ } } - + // shall be called to apply the styles of the active class public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { Widget source = (Widget)event.getSource(); @@ -1865,16 +1868,16 @@ Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); } } - - + + // removes all GdlInfo elements. They must be remove explicitly, since they are // bound to the root panel/body public void clear(){ for (GdlInfo elem : this.infoElements) elem.removeFromParent(); } - - + + @Override public void onAttach(){ super.onAttach(); @@ -1884,20 +1887,20 @@ e.printStackTrace(); } } - - + + // if this method is called the user cannot change the represented value // of this control public abstract void fixValue(); - - + + // sets the fields for the received data protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException { -if(receivedData == null) return; - + 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(); @@ -1907,7 +1910,7 @@ } } 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()); - + Pattern rex = new Pattern(this.getLiteralValueForConstraint()); for(int i = 0; i != ((Topic)receivedData).getSubjectLocators().length(); ++i){ String sl = ((Topic)receivedData).getSubjectLocators().get(i).getReference(); @@ -1917,23 +1920,41 @@ } } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ if(!(this.receivedData instanceof Reifiable)) 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()); + + // search for the topic type + Reifiable ref = (Reifiable)this.receivedData; + // search for the characteristics type + if(this.receivedData instanceof Topic){ + JsArray names = ((Topic)this.receivedData).getNames(constrainedTopicType); + if(names.length() != 0){ + ref = names.get(0); + } else { + JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); + if(occs.length() != 0) ref = occs.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)receivedData).getItemIdentifiers().length(); ++i){ - String ii = ((Topic)receivedData).getItemIdentifiers().get(i).getReference(); + 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); } } } 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()); - + 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()); - + 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()); @@ -1946,7 +1967,7 @@ } 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()))); - + Pair roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); JsArray assocRoles = ((Association)this.receivedData).getRoles(roleAndPlayerType.getFirst()); for(int i = 0; i != assocRoles.length(); ++i){ @@ -1968,26 +1989,26 @@ throw new InvalidGdlSchemaException("The constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not suported to be bound to the value group instance " + TmHelper.getAnyIdOfTopic(this.getValueGroup())); } } - - + + // sets the field for the set default value or sets at least one empty field (card-min) protected void setDefaultValue() throws InvalidGdlSchemaException, ExecutionException { if(this.getDefaultLiteralValue() != null && this.getDefaultTmValue() != null) throw new InvalidGdlSchemaException("the topic " + TmHelper.getAnyIdOfTopic(this.getValueGroup()) + " must be bound to maximal one " + PSIs.GDL.TopicType.gdlDefaultValue + ", but is: 2"); - + if(this.getDefaultLiteralValue() != null){ TopicMap tm = this.getDefaultLiteralValue().getTopicMap(); Topic occType = TmHelper.getTopicByPsi(PSIs.GDL.OccurrenceType.gdlLiteralValue, tm); JsArray vals = this.getDefaultLiteralValue().getOccurrences(occType); - + if(vals.length() != 1) throw new InvalidGdlSchemaException("the topic " + TmHelper.getAnyIdOfTopic(this.getDefaultLiteralValue()) + " must be bound exactly once to a " + PSIs.GDL.OccurrenceType.gdlLiteralValue + " occurrence, but is: " + vals.length()); - + int minValues = this.getCardMin() == 0 ? 1 : this.getCardMin(); for(int i = 0; i < minValues; ++i) this.addSubItem(vals.get(0).getValue()); if(this.fixedDefaultValue()) this.fixValue(); } else if(this.getDefaultTmValue() != null){ ArrayList values = TmHelper.getValuesForTmValue(this.getDefaultTmValue()); - + if(values.size() != 1) throw new InvalidGdlSchemaException("the default value " + TmHelper.getAnyIdOfTopic(this.getDefaultValue()) + " represetns more than one value"); int minValues = this.getCardMin() == 0 ? 1 : this.getCardMin(); @@ -1998,8 +2019,8 @@ this.addSubItem(""); } } - - + + public int getCardMin() throws InvalidGdlSchemaException { if(this.cardMinSet){ return this.cardMin; @@ -2008,8 +2029,8 @@ return TmHelper.getCardMin(this.getRootConstraint()); } } - - + + public int getCardMax() throws InvalidGdlSchemaException { if(this.cardMaxSet){ return this.cardMax; @@ -2018,8 +2039,8 @@ return TmHelper.getCardMax(this.getRootConstraint()); } } - - + + // returns the topic instance of gdlt:Value-Group that is bound to this // visible element, or null if it is unbound public Topic getValueGroup() throws InvalidGdlSchemaException { @@ -2044,8 +2065,8 @@ return this.constraintTopic; } } - - + + // returns the root (last) constraint that is bound to the value-group // of this element - or null if it is unbound public Topic getRootConstraint() throws InvalidGdlSchemaException { @@ -2083,8 +2104,8 @@ return this.defaultLiteralValueTopic; } } - - + + // returns the topic that represents the default value of // the value-group that is bound to this element - null if it is unbound public Topic getDefaultValue() throws InvalidGdlSchemaException { @@ -2093,17 +2114,17 @@ else return this.getDefaultTmValue(); } - + // returns true if the default value is fixed // otherwise the return value is false public boolean fixedDefaultValue() throws InvalidGdlSchemaException{ Topic defVal = this.getDefaultValue(); - + if(defVal == null) return false; - + TopicMap tm = defVal.getTopicMap(); Occurrence fixedOcc = TmHelper.getSingleOccurrence(defVal, TmHelper.getTopicByPsi(PSIs.GDL.OccurrenceType.gdlFixed, tm)); - + if(fixedOcc != null){ try{ return Boolean.valueOf(fixedOcc.getValue().toLowerCase()); @@ -2114,7 +2135,7 @@ return false; } } - + // returns all topic maps values represented by topics of the type gdlt:Tm-Value // that are valid and declared for the value-group of this element - or @@ -2142,7 +2163,7 @@ } } - + // returns an ArrayList of strings that are set to a value group as literal values public ArrayList getLiterals() throws InvalidGdlSchemaException { if(this.literalsSet){ @@ -2153,7 +2174,7 @@ return this.literals; } } - + // returns the set literal value or null public String getSetLiteralValue() throws InvalidGdlSchemaException { @@ -2195,14 +2216,14 @@ } } - + // returns the display-by schema that is defined for the passed // TM-Value that is bound to this element public Topic getDisplayByOfTmValue(Topic tmValue) throws InvalidGdlSchemaException{ return TmHelper.getDisplayByTopicOf(tmValue); } - - + + // returns the preferred scope that is bound to the value-group of // this element - or an empty ArrayList public ArrayList getPreferredScopeOfValueGroup() throws InvalidGdlSchemaException { @@ -2215,26 +2236,26 @@ } } - + // returns the preferred scope that is bound to the passed TM-Value topic // this element - or an empty ArrayList public ArrayList getPreferredScopeOfTmValue(Topic tmValue) throws InvalidGdlSchemaException{ return TmHelper.getPrefferedScopesForTopicOf(tmValue); } - + // returns the string that represents the topic topicToRepresent corresponding // to the passed displayBy and prefferedScopes arguments public String getTopicRepresentation(Topic topicToRepresent, Topic displayBy, ArrayList preferredScopes) throws InvalidGdlSchemaException { return TmHelper.getTopicRepresentation(topicToRepresent, displayBy, preferredScopes); } - - + + // returns the strings of the control that are entered/selected // returns the strings of the control that are entered/selected public abstract ArrayList getSelectedValues(); - - + + // validates names, occurrences and identifiers for tha passed value private void validateLiteralValue(String selectedValue) throws InvalidContentException, InvalidGdlSchemaException{ ArrayList validLiteralValues = new ArrayList(); @@ -2242,21 +2263,21 @@ if(validLiteralValues.size() == 0) validLiteralValues.add(new Pattern(this.getLiteralValueForConstraint())); int i = 0; for( ; i != validLiteralValues.size(); ++i) if(validLiteralValues.get(i).matches(selectedValue)) break; - + if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-name " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-occurrence " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ - + } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - + } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - + } } - - + + // validates the the tm values of a constraint private void validateTmValue(Topic selectedPlayer) throws InvalidContentException, InvalidGdlSchemaException, ExecutionException { if(this.getRawTmValues().size() != 0 && !this.getRawTmValues().contains(selectedPlayer)){ @@ -2267,9 +2288,9 @@ } } } - - - + + + // returns the actual topics that are set as possible tm-values private ArrayList getRawTmValues() throws InvalidGdlSchemaException{ if(this.rawTmValuesSet){ @@ -2281,32 +2302,32 @@ return this.rawTmValues; } } - - + + // returns the actual data that is hold by this instance public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { ArrayList> result = new ArrayList>(); if(this.getRootConstraint() == null) return result; Construct localCarrier = carrier; if(carrier == null) localCarrier = TmHelper.getNearestTopicOrAssociation(this); - + //TODO: finalise for (int idx = 0; idx != this.getSelectedValues().size(); ++idx){ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - + } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ - + } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - + } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass()); Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray names = ((Topic)localCarrier).getNames(nameType); - + Name changedName = null; if(this.getRootConstraint().equals(this.getConstraint())){ if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - + if(names.length() > idx){ changedName = names.get(idx); changedName.setValue(this.getSelectedValues().get(idx)); @@ -2314,19 +2335,19 @@ changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null); } } // TODO: item-identifier, reifier, variant, ... - + result.add(new Pair(changedName, TopicMapsTypes.Name)); } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ - + } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass()); Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray occurrences = ((Topic)localCarrier).getOccurrences(occurrenceType); - + Occurrence changedOccurrence = null; if(this.getRootConstraint().equals(this.getConstraint())){ if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - + if(occurrences.length() > idx){ changedOccurrence = occurrences.get(idx); changedOccurrence.setValue(this.getSelectedValues().get(idx)); @@ -2334,19 +2355,19 @@ changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null); } } // TODO: item-identifier, reifier, ... - + result.add(new Pair(changedOccurrence, TopicMapsTypes.Occurrence)); } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){ if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass()); Pair roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); Topic roleType = roleAndPlayerType.getFirst(); Topic playerType = roleAndPlayerType.getSecond(); - + JsArray typedRoles = ((Association)localCarrier).getRoles(roleType); ArrayList roles = new ArrayList(); for(int i = 0; i != typedRoles.length(); ++i) if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i)); - + Role changedRole = null; if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){ // TODO: implement @@ -2371,7 +2392,7 @@ throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " is not supported"); } } - + return result; } } 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 Mon Oct 17 08:41:37 2011 (r1003) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 18 03:17:10 2011 (r1004) @@ -857,6 +857,24 @@ } + // returns the topic that plays the role of tmcl:constrained in an association + // of the type tmcl:constrained-topic-type that is bound to the passed topic + // constraint-Topic that plays the role of tmcl:constraint + public static Topic getConstrainedTopicType(Topic constraintTopic) throws InvalidGdlSchemaException{ + if(constraintTopic == null) return null; + + TopicMap tm = constraintTopic.getTopicMap(); + Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm); + Topic constrainedTopicTypeAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedTopicType, tm); + Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm); + + ArrayList constrainedTopicTypes = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constrainedTopicTypeAssocType, null, constrainedRoleType); + + if(constrainedTopicTypes.size() != 1) throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraintTopic) + " must be bound exactly once to a statement topic via a " + PSIs.TMCL.tmclConstrainedTopicType + " association, but is: " + constrainedTopicTypes.size()); + else return constrainedTopicTypes.get(0); + } + + // Returns the role-combination-constraints for the passed association-type public static ArrayList getRoleCombinationConstraints(Topic associationType){ if(associationType == null) return new ArrayList(); 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 Mon Oct 17 08:41:37 2011 (r1003) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Tue Oct 18 03:17:10 2011 (r1004) @@ -7,10 +7,15 @@ "gdlt":"http://psi.isidor.us/gdl/types/", "gdlsrv":"http://service.org/serviceregistry/gdl/", "types":"http://services.org/serviceregistry/model/types/", - "srv":"http://service.org/serviceregistry/"}, + "srv":"http://service.org/serviceregistry/", + "iipref":"http://service.org/serviceregistry/iis/", + "slpref":"http://service.org/serviceregistry/sls/", + "srvpref":"http://service.org/serviceregistry/psis/service/"}, + "item_type":"topicmap", + "topics": [{"subject_identifiers":["[tmcl:topic-type]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:name-type]"], "instance_of":["si:[tmcl:topic-type]"]}, {"subject_identifiers":["[tmcl:occurrence-type]"], "instance_of":["si:[tmcl:topic-type]"]}, @@ -170,23 +175,42 @@ {"subject_identifiers":["[gdlsrv:service-psis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[gdlsrv:service-sls-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_sls_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-sls-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"30px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-sls-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"40px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-sls-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[gdlsrv:service-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_iis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"50px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"70px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[gdlsrv:service-name-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-name-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"70px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"110px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-name-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[gdlsrv:service-name-type-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_type_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-name-type-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"90px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-type-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"150px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-name-type-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, - {"subject_identifiers":["[model:service-name-type-constraint]"], "instance_of":["si:[gdlt:Type]"]} + {"subject_identifiers":["[model:service-name-type-constraint]"], "instance_of":["si:[gdlt:Type]"]}, + + {"subject_identifiers":["[gdlsrv:service-name-scope-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_scope_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-name-scope-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"190px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-scope-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"230px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-name-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_name_iis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"270px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + + + {"subject_identifiers":["[model:sort-service-name-reifier]"], "instance_of":["si:[types:Reifier-Type]"]}, + {"subject_identifiers":["[model:sort-service-variant-name-reifier]"], "instance_of":["si:[types:Reifier-Type]"]}, + {"subject_identifiers":["[srvpref:sort-service]"], "subject_locators":["[slpref:sort-service]"], "item_identifiers":["[iipref:sort-service]"], "instance_of":["si:[types:Service]"], "names":[{"type":"si:[model:service-name]", "scope":["si:[model:english]"], "reifier":"si:[model:sort-service-name-reifier]", "item_identifiers":["[iipref:service-name-ii]"], "value":"Sort-Service", "variants":[{"datatype":"http://www.w3.org/2001/XMLSchema#string", "scope":["si:[model:symbolic-name]"], "reifier":"si:[model:sort-service-variant-name-reifier]", "item_identifiers":["[iipref:sort-service-variant-name-ii]"], "value":"symbolic name of sort-service"}]}]} ], + "associations": [{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:topic-name-constraint]"}]}, {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-identifier-constraint]"}]}, {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[tmcl:constraint]"},{"type":"si:[tmdm:subtype]", "player":"si:[tmcl:subject-locator-constraint]"}]}, @@ -292,12 +316,12 @@ {"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-sls-text]"}]}, {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-sls-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-psis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-sls-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-sls-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-sls-text]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-sls-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-sls-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-sls-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-sl-constraint]"}]}, {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-iis-text]"}]}, {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-sls-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-iis-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-iis-text]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-iis-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-ii-constraint]"}]}, {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-text]"}]}, {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-text]"}]}, @@ -308,7 +332,23 @@ {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-type-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-type-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-type-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-type-text]"}]}, {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-type-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-type-constraint]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-constraint]"}]} + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-name-type-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-constraint]"}]}, + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-scope-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-scope-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-type-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-scope-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-scope-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-scope-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-scope-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-scope-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-reifier-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-scope-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-reifier-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-reifier-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-reifier-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-reifier-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-ii-constraint]"}]} + + ] } \ No newline at end of file Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Mon Oct 17 08:41:37 2011 (r1003) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Tue Oct 18 03:17:10 2011 (r1004) @@ -1,18 +1,18 @@ -==> Service ** - ==> subject-identifier-constraint ** - ==> subject-locator-constraint ** - ==> item-identifier-constraint ** - ==> topic-name-constraint ** - ==> regular-expression-constraint ** - ==> Type * - ==> scope-constraint * - ==> reifier-constraint * - ==> item-identifier-constraint * - ==> variant-name-constraint * - ==> Datatype - ==> Variant-Name-Scope - ==> Variant-Name-Identifiers - ==> Variant-Name-Reifier +==> Service *** + ==> subject-identifier-constraint *** + ==> subject-locator-constraint *** + ==> item-identifier-constraint *** + ==> topic-name-constraint *** + ==> regular-expression-constraint *** + ==> Type ** + ==> scope-constraint *** + ==> reifier-constraint *** + ==> item-identifier-constraint *** + ==> variant-name-constraint * * + ==> Datatype * + ==> Variant-Name-Scope * + ==> Variant-Name-Identifiers * + ==> Variant-Name-Reifier * ==> Endpoint * From lgiessmann at common-lisp.net Tue Oct 18 10:19:08 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 18 Oct 2011 03:19:08 -0700 Subject: [isidorus-cvs] r1005 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 18 03:19:08 2011 New Revision: 1005 Log: gdl-frontend: Widgets: implemented the item-identifier-constraints for associations and association roles 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 Tue Oct 18 03:17:10 2011 (r1004) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 03:19:08 2011 (r1005) @@ -1936,6 +1936,9 @@ JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); if(occs.length() != 0) ref = occs.get(0); } + } else if(this.receivedData instanceof Association){ + JsArray 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 From lgiessmann at common-lisp.net Tue Oct 18 12:10:30 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 18 Oct 2011 05:10:30 -0700 Subject: [isidorus-cvs] r1006 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: 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 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]"}]}, From lgiessmann at common-lisp.net Tue Oct 18 14:39:39 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 18 Oct 2011 07:39:39 -0700 Subject: [isidorus-cvs] r1007 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 18 07:39:38 2011 New Revision: 1007 Log: gdl-frontend: Widgets: implemented the tmcl:scope-constraint semantics for retrieving data Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/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 18 05:10:29 2011 (r1006) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 18 07:39:38 2011 (r1007) @@ -1963,7 +1963,26 @@ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ // TODO: implement: variant-name-constraint } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ - // TODO: implement: scope-constraint + // TODO: implement + Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); + + JsArray scope = null; + if(this.receivedData instanceof Topic){ + JsArray names = ((Topic)this.receivedData).getNames(type); + if(names.length() != 0) scope = names.get(0).getScope(); + if(scope != null){ + JsArray 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()); + } + + if(scope != null){ + for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); + } } 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()))); 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 05:10:29 2011 (r1006) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 18 07:39:38 2011 (r1007) @@ -20,9 +20,7 @@ import us.isidor.gdl.anaToMia.Widgets.view.GdlTopicView; import us.isidor.gdl.anaToMia.Widgets.view.GdlAssociationView.AssociationItem; 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 { @@ -181,7 +179,6 @@ JsArray 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; From lgiessmann at common-lisp.net Wed Oct 19 10:22:42 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 19 Oct 2011 03:22:42 -0700 Subject: [isidorus-cvs] r1008 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Wed Oct 19 03:22:41 2011 New Revision: 1008 Log: gdl-frontend: Widgets: implemented the tmcl:reifier-constraint semantics for retrieving data; fixed a bug in the test-schema Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.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 07:39:38 2011 (r1007) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 19 03:22:41 2011 (r1008) @@ -1959,18 +1959,35 @@ 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)){ - // TODO: implement: reifier-constraint + Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); + + Topic reifier = null; + if(this.receivedData instanceof Topic){ + JsArray names = ((Topic)this.receivedData).getNames(type); + if(names.length() != 0) reifier = names.get(0).getReifier(); + if(reifier == null){ + JsArray 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()); + } + + 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)){ // TODO: implement: variant-name-constraint } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ - // TODO: implement Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray scope = null; if(this.receivedData instanceof Topic){ JsArray names = ((Topic)this.receivedData).getNames(type); if(names.length() != 0) scope = names.get(0).getScope(); - if(scope != null){ + if(scope == null){ JsArray occs = ((Topic)this.receivedData).getOccurrences(type); if(occs.length() != 0) scope = occs.get(0).getScope(); } 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 07:39:38 2011 (r1007) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 19 03:22:41 2011 (r1008) @@ -373,7 +373,7 @@ {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-reifier-constraint]"}]}, {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, - {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-ii-constraint]"}]} From lgiessmann at common-lisp.net Wed Oct 19 12:07:19 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 19 Oct 2011 05:07:19 -0700 Subject: [isidorus-cvs] r1009 - trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets Message-ID: Author: lgiessmann Date: Wed Oct 19 05:07:18 2011 New Revision: 1009 Log: gdl-frontend: Widgets: extended the GDL-Test-Schema for variant-names 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.txt Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 19 03:22:41 2011 (r1008) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 19 05:07:18 2011 (r1009) @@ -171,7 +171,7 @@ {"subject_identifiers":["[gdlt:Delete-Button]"]}, {"subject_identifiers":["[gdlsrv:service-schema]"], "instance_of":["si:[gdlt:Schema]"], "names":[{"type":"si:[gdl:schema-name]", "value":"GDL Schema for a Service UI"}]}, - {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"300px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, + {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"800px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, {"subject_identifiers":["[gdlsrv:service-editor-view-binding]"], "instance_of":["si:[gdlt:TM-Single-Type-Value]"]}, {"subject_identifiers":["[gdlsrv:service-psis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_psis_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, @@ -207,6 +207,26 @@ {"subject_identifiers":["[gdlsrv:service-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"270px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"310px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + + {"subject_identifiers":["[gdlsrv:service-variant-name-dt-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_dt_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-dt-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"350px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-dt-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[model:service-variant-name-dt-constraint]"], "instance_of":["si:[gdlt:Datatype]"]}, + + {"subject_identifiers":["[gdlsrv:service-variant-name-scope-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_scope_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-scope-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"390px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-scope-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[model:service-variant-name-scope-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Scope]"]}, + + {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_ii_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"430px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]}, + + {"subject_identifiers":["[model:sort-service-name-reifier]"], "instance_of":["si:[types:Reifier-Type]"]}, @@ -375,8 +395,34 @@ {"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-name-iis-text]"}]}, {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-name-iis-text]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-ii-constraint]"}]} - + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-name-ii-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-name-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-dt-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-dt-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-dt-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-dt-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-dt-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-dt-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-dt-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-dt-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-scope-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-scope-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-dt-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-scope-text]"}]}, + {"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:[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]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-ii-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-ii-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]} + + + + ] } \ No newline at end of file Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Wed Oct 19 03:22:41 2011 (r1008) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Wed Oct 19 05:07:18 2011 (r1009) @@ -8,10 +8,10 @@ ==> scope-constraint *** ==> reifier-constraint *** ==> item-identifier-constraint *** - ==> variant-name-constraint * * - ==> Datatype * - ==> Variant-Name-Scope * - ==> Variant-Name-Identifiers * + ==> variant-name-constraint *** + ==> Datatype ** + ==> Variant-Name-Scope ** + ==> Variant-Name-Identifiers ** ==> Variant-Name-Reifier * From lgiessmann at common-lisp.net Wed Oct 19 19:16:20 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 19 Oct 2011 12:16:20 -0700 Subject: [isidorus-cvs] r1010 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Wed Oct 19 12:16:19 2011 New Revision: 1010 Log: gdl-frontend: Widgets: implemented the tmcl:variant-name-constraint semantics for retrieving data Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 19 05:07:18 2011 (r1009) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 19 12:16:19 2011 (r1010) @@ -1979,7 +1979,22 @@ if(str == null) str = ""; this.addSubItem(str); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ - // TODO: implement: variant-name-constraint + if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); + + Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); + JsArray names = ((Topic)this.receivedData).getNames(nameType); + Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); + JsArray variants = names.get(0).getVariants(); + + if(variants.get(0).getScope().length() != 0){ + JsArray scopes = variants.get(0).getScope(); + int i = 0; + for( ; i != scopes.length(); ++i) if(scopes.get(i).equals(scope)) break; + + if(i != scopes.length()){ + for(i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); + } + } } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Wed Oct 19 05:07:18 2011 (r1009) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Wed Oct 19 12:16:19 2011 (r1010) @@ -38,6 +38,7 @@ public final static String tmclAllowed = tmcl + "allowed"; public final static String tmclAllowedReifier = tmcl + "allowed-reifier"; public final static String tmclConstrainedScope = tmcl + "constrained-scope"; + public final static String tmclConstrainedScopeTopic = tmcl + "constrained-scope-topic"; public final static String tmclSubjectIdentifierConstraint = tmcl + "subject-identifier-constraint"; public final static String tmclSubjectLocatorConstraint = tmcl + "subject-locator-constraint"; public final static String tmclItemIdentifierConstraint = tmcl + "item-identifier-constraint"; Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Oct 19 05:07:18 2011 (r1009) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Oct 19 12:16:19 2011 (r1010) @@ -856,6 +856,21 @@ } + // returns a topic that can e used as scope topic + public static Topic getConstrainedScopeTopic(Topic constraintTopic) throws InvalidGdlSchemaException{ + if(constraintTopic == null) return null; + + TopicMap tm = constraintTopic.getTopicMap(); + Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm); + Topic constrainedScopeTopicAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedScopeTopic, tm); + Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm); + ArrayList constrainedScopeTopics = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constrainedScopeTopicAssocType, null, constrainedRoleType); + + if(constrainedScopeTopics.size() != 1) throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraintTopic) + " must be bound exactly once to a statement topic via a " + PSIs.TMCL.tmclConstrainedScopeTopic + " association, but is: " + constrainedScopeTopics.size()); + else return constrainedScopeTopics.get(0); + } + + // returns the topic that plays the role of tmcl:constrained in an association // of the type tmcl:constrained-topic-type that is bound to the passed topic // constraint-Topic that plays the role of tmcl:constraint Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 19 05:07:18 2011 (r1009) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 19 12:16:19 2011 (r1010) @@ -225,7 +225,12 @@ {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"430px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]}, - + + {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"470px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, + {"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]}, + @@ -418,7 +423,13 @@ {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-scope-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]}, {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-ii-constraint]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-ii-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]} + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-ii-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]}, + + {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]}, + {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]}, + {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-reifier-constraint]"}]}, + {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]} Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Wed Oct 19 05:07:18 2011 (r1009) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm.txt Wed Oct 19 12:16:19 2011 (r1010) @@ -4,15 +4,15 @@ ==> item-identifier-constraint *** ==> topic-name-constraint *** ==> regular-expression-constraint *** - ==> Type ** + ==> Type *** ==> scope-constraint *** ==> reifier-constraint *** ==> item-identifier-constraint *** ==> variant-name-constraint *** - ==> Datatype ** - ==> Variant-Name-Scope ** - ==> Variant-Name-Identifiers ** - ==> Variant-Name-Reifier * + ==> Datatype *** + ==> Variant-Name-Scope *** + ==> Variant-Name-Identifiers *** + ==> Variant-Name-Reifier *** ==> Endpoint * From lgiessmann at common-lisp.net Thu Oct 20 07:14:02 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 20 Oct 2011 00:14:02 -0700 Subject: [isidorus-cvs] r1011 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Thu Oct 20 00:14:01 2011 New Revision: 1011 Log: gdl-frontend: Widgets: implemented the gdlt:Variant-Name-Scope semantics for retrieving data 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 19 12:16:19 2011 (r1010) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Oct 20 00:14:01 2011 (r1011) @@ -1920,10 +1920,10 @@ // get type Topic constrainedTopicType = TmHelper.getConstrainedTopicType(this.getConstraint()); - + // search for the topic type Reifiable ref = (Reifiable)this.receivedData; - + // search for the characteristics type if(this.receivedData instanceof Topic){ JsArray names = ((Topic)this.receivedData).getNames(constrainedTopicType); @@ -1937,7 +1937,7 @@ JsArray 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){ @@ -1960,7 +1960,7 @@ 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()); - + Topic reifier = null; if(this.receivedData instanceof Topic){ JsArray names = ((Topic)this.receivedData).getNames(type); @@ -1974,30 +1974,33 @@ } 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()); - + Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); JsArray names = ((Topic)this.receivedData).getNames(nameType); Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); JsArray variants = names.get(0).getVariants(); - - if(variants.get(0).getScope().length() != 0){ - JsArray scopes = variants.get(0).getScope(); - int i = 0; - for( ; i != scopes.length(); ++i) if(scopes.get(i).equals(scope)) break; - - if(i != scopes.length()){ - for(i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); + + for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ + if(variants.get(varIdx).getScope().length() != 0){ + JsArray scopes = variants.get(varIdx).getScope(); + int scopeIdx = 0; + for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; + + if(scopeIdx != scopes.length()){ + this.addSubItem(variants.get(varIdx).getValue()); + break; + } } } } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); - + JsArray scope = null; if(this.receivedData instanceof Topic){ JsArray names = ((Topic)this.receivedData).getNames(type); @@ -2011,7 +2014,7 @@ } else { throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass()); } - + if(scope != null){ for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); } @@ -2044,7 +2047,7 @@ 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); @@ -2055,7 +2058,24 @@ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ // TODO: implement: Variant-Name-Reifier } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ - // TODO: implement: Variant-Name-Scope + if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); + + Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); + JsArray names = ((Topic)this.receivedData).getNames(nameType); + Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); + JsArray variants = names.get(0).getVariants(); + + for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ + if(variants.get(varIdx).getScope().length() != 0){ + JsArray scopes = variants.get(varIdx).getScope(); + int scopeIdx = 0; + for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; + + if(scopeIdx != scopes.length()){ + for(int i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); + } + } + } } 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())); } From lgiessmann at common-lisp.net Thu Oct 20 07:47:08 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 20 Oct 2011 00:47:08 -0700 Subject: [isidorus-cvs] r1012 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Thu Oct 20 00:47:07 2011 New Revision: 1012 Log: gdl-frontend: Widgets: implemented the gdlt:Variant-Identifiers-Scope and gdlt:Datatype semantics for retrieving data Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm 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 Thu Oct 20 00:14:01 2011 (r1011) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Oct 20 00:47:07 2011 (r1012) @@ -1981,23 +1981,9 @@ } 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()); - Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); - JsArray names = ((Topic)this.receivedData).getNames(nameType); - Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); - JsArray variants = names.get(0).getVariants(); - - for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ - if(variants.get(varIdx).getScope().length() != 0){ - JsArray scopes = variants.get(varIdx).getScope(); - int scopeIdx = 0; - for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; - - if(scopeIdx != scopes.length()){ - this.addSubItem(variants.get(varIdx).getValue()); - break; - } - } - } + ArrayList variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint()); + if(variants.size() != 0) this.addSubItem(variants.get(0).getValue()); + else this.addSubItem(""); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); @@ -2052,29 +2038,40 @@ if(str == null) str = ""; this.addSubItem(str); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ - // TODO: implement: Datatype + 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 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 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)){ - // TODO: implement: Variant-Name-Identifiers + 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 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()); + } } 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())); + // TODO: implement: Variant-Name-Reifier } 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()); - - Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); - JsArray names = ((Topic)this.receivedData).getNames(nameType); - Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); - JsArray variants = names.get(0).getVariants(); - - for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ - if(variants.get(varIdx).getScope().length() != 0){ - JsArray scopes = variants.get(varIdx).getScope(); - int scopeIdx = 0; - for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; - - if(scopeIdx != scopes.length()){ - for(int i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); - } - } + 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 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())); } } 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())); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Thu Oct 20 00:14:01 2011 (r1011) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java Thu Oct 20 00:47:07 2011 (r1012) @@ -21,6 +21,7 @@ public final static String tmclAssociationType = tmcl + "association-type"; public final static String tmclRoleType = tmcl + "role-type"; public final static String tmclConstraint = tmcl + "constraint"; + public final static String tmclOccurrenceConstraint = tmcl + "occurrence-constraint"; public final static String tmclConstrained = tmcl + "constrained"; public final static String tmclConstrainedStatement = tmcl + "constrained-statement"; public final static String tmclRegularExpressionConstraint = tmcl + "regular-expression-constraint"; 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 Thu Oct 20 00:14:01 2011 (r1011) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Oct 20 00:47:07 2011 (r1012) @@ -12,6 +12,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.ScopedStub; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.environment.Pair; @@ -1498,4 +1499,31 @@ else if(result.size() == 1) return result.get(0); else return null; } + + + // Returns all variants of a topic that satisfies the passed constraint. + public static ArrayList getVariantsForConstraint(Topic owner, Topic constraint) throws InvalidGdlSchemaException { + ArrayList result = new ArrayList(); + if(owner == null || constraint == null) return result; + + Topic nameType = TmHelper.getConstrainedStatement(constraint); + JsArray names = owner.getNames(nameType); + Topic scope = TmHelper.getConstrainedScopeTopic(constraint); + + for(int nameIdx = 0; nameIdx != names.length(); ++nameIdx){ + JsArray variants = names.get(nameIdx).getVariants(); + for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ + if(variants.get(varIdx).getScope().length() != 0){ + JsArray scopes = variants.get(varIdx).getScope(); + int scopeIdx = 0; + for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; + + if(scopeIdx != scopes.length()) result.add(variants.get(varIdx)); + } + } + } + + 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 Thu Oct 20 00:14:01 2011 (r1011) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Thu Oct 20 00:47:07 2011 (r1012) @@ -222,12 +222,12 @@ {"subject_identifiers":["[model:service-variant-name-scope-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Scope]"]}, {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_ii_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"430px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"450px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]}, {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, - {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"470px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, + {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"490px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]}, From lgiessmann at common-lisp.net Thu Oct 20 07:49:41 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 20 Oct 2011 00:49:41 -0700 Subject: [isidorus-cvs] r1013 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Thu Oct 20 00:49:41 2011 New Revision: 1013 Log: gdl-frontend: Widgets: implemented the gdlt:Variant-Name-Reifier semantics for retrieving data 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 Thu Oct 20 00:47:07 2011 (r1012) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Oct 20 00:49:41 2011 (r1013) @@ -2064,7 +2064,10 @@ 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())); - // TODO: implement: Variant-Name-Reifier + ArrayList 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())); + } } 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())); From lgiessmann at common-lisp.net Thu Oct 20 09:23:10 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 20 Oct 2011 02:23:10 -0700 Subject: [isidorus-cvs] r1014 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: Author: lgiessmann Date: Thu Oct 20 02:23:09 2011 New Revision: 1014 Log: gdl-frontend: Widgets: extended the test-gdl-schema 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 Thu Oct 20 00:49:41 2011 (r1013) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Oct 20 02:23:09 2011 (r1014) @@ -2267,20 +2267,6 @@ } - // returns the set literal value or null - public String getSetLiteralValue() throws InvalidGdlSchemaException { - // TODO Auto-generated method stub - return null; - } - - - // returns the set tm value or null - public Construct getSetTmValue() throws InvalidGdlSchemaException { - // TODO Auto-generated method stub - return null; - } - - // returns the valid topic maps value for the constraint bound // to the value-group that is bound to this element - or an empty ArrayList public ArrayList getTmValuesForConstraint() throws InvalidGdlSchemaException, ExecutionException { @@ -2402,54 +2388,64 @@ Construct localCarrier = carrier; if(carrier == null) localCarrier = TmHelper.getNearestTopicOrAssociation(this); - //TODO: finalise for (int idx = 0; idx != this.getSelectedValues().size(); ++idx){ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ - - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ - if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass()); + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ + // TODO: implement + } 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()); Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray names = ((Topic)localCarrier).getNames(nameType); Name changedName = null; - if(this.getRootConstraint().equals(this.getConstraint())){ - if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); + if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - if(names.length() > idx){ - changedName = names.get(idx); - changedName.setValue(this.getSelectedValues().get(idx)); - }else { - changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null); - } - } // TODO: item-identifier, reifier, variant, ... + if(names.length() > idx){ + changedName = names.get(idx); + changedName.setValue(this.getSelectedValues().get(idx)); + }else { + changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null); + } result.add(new Pair(changedName, TopicMapsTypes.Name)); - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ - - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ - if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass()); + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ + // TODO: implement + } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){ + // TODO: implement + } 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()); Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray occurrences = ((Topic)localCarrier).getOccurrences(occurrenceType); Occurrence changedOccurrence = null; - if(this.getRootConstraint().equals(this.getConstraint())){ - if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); + if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - if(occurrences.length() > idx){ - changedOccurrence = occurrences.get(idx); - changedOccurrence.setValue(this.getSelectedValues().get(idx)); - }else { - changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null); - } - } // TODO: item-identifier, reifier, ... + if(occurrences.length() > idx){ + changedOccurrence = occurrences.get(idx); + changedOccurrence.setValue(this.getSelectedValues().get(idx)); + }else { + changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null); + } result.add(new Pair(changedOccurrence, TopicMapsTypes.Occurrence)); - } else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){ - if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass()); + } 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 roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); Topic roleType = roleAndPlayerType.getFirst(); Topic playerType = roleAndPlayerType.getSecond(); @@ -2460,27 +2456,18 @@ if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i)); Role changedRole = null; - if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){ - // TODO: implement - } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - // TODO: implement - } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){ - 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); - } - } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){ - // TODO: implement + + 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 { - throw new InvalidGdlSchemaException("the root constraint must be bound to one of: " + PSIs.TMCL.tmclReifierConstraint + ", " + PSIs.TMCL.tmclItemIdentifierConstraint + ", " + PSIs.GDL.TopicType.gdlRolePlayer + ", " + PSIs.GDL.TopicType.gdlType + ", but is: " + TmHelper.getAnyIdOfTopic(this.getConstraint())); + changedRole = ((Association)localCarrier).createRole(roleType, player); } result.add(new Pair(changedRole, TopicMapsTypes.Role)); } else { - throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " is not supported"); + throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported"); } } 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 Thu Oct 20 00:49:41 2011 (r1013) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Oct 20 02:23:09 2011 (r1014) @@ -30,6 +30,7 @@ if(subjectIdentifier == null || tm == null) return null; Locator loc = tm.createLocator(subjectIdentifier); + return tm.getTopicBySubjectIdentifier(loc); } 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 Thu Oct 20 00:49:41 2011 (r1013) +++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Thu Oct 20 02:23:09 2011 (r1014) @@ -164,11 +164,13 @@ {"subject_identifiers":["[gdlt:Position]"]}, {"subject_identifiers":["[gdl:position-style]"], "instance_of":["si:[tmcl:occurrence-type]"]}, {"subject_identifiers":["[gdl:top]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:bottom]"], "instance_of":["si:[tmcl:occurrence-type]"]}, + {"subject_identifiers":["[gdl:right]"], "instance_of":["si:[tmcl:occurrence-type]"]}, {"subject_identifiers":["[gdl:left]"], "instance_of":["si:[tmcl:occurrence-type]"]}, {"subject_identifiers":["[gdlt:Value-Group]"]}, {"subject_identifiers":["[gdlt:Button]"]}, {"subject_identifiers":["[gdlt:Action-Button]"]}, - {"subject_identifiers":["[gdlt:Delete-Button]"]}, + {"subject_identifiers":["[gdlt:Commit-Button]"]}, {"subject_identifiers":["[gdlsrv:service-schema]"], "instance_of":["si:[gdlt:Schema]"], "names":[{"type":"si:[gdl:schema-name]", "value":"GDL Schema for a Service UI"}]}, {"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"800px"},{"type":"si:[gdl:background-color]", "value":"gray"}]}, @@ -231,7 +233,11 @@ {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, {"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]}, - + {"subject_identifiers":["[gdlsrv:service-editor-commit-button]"], "instance_of":["si:[gdlt:Commit-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_creator_commit_button_id"}, {"type":"si:[gdl:height]", "value":"30px"}, {"type":"si:[gdl:width]", "value":"80px"}, {"type":"si:[gdl:font-size]", "value":"12px"}]}, + {"subject_identifiers":["[gdlsrv:service-editor-commit-button-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:bottom]", "value":"10px"}, {"type":"si:[gdl:right]", "value":"10px"}]}, + + + {"subject_identifiers":["[model:sort-service-name-reifier]"], "instance_of":["si:[types:Reifier-Type]"]}, @@ -270,15 +276,31 @@ {"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:[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:Commit-Button]"}]}, + {"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]"}]}, {"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-sl-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]}, @@ -336,27 +358,6 @@ {"type":"si:[tmcl:constrained-statement]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:endpoint-role-reifier-constraint]"}, {"type":"si:[tmcl:constrained]", "player":"si:[model:endpoint]"}]}, - {"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:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-schema]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-default-editor-topic-view]"}]}, {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-editor-view-binding]"},{"type":"si:[gdl:tm-construct]", "player":"si:[types:Service]"}]}, {"type":"si:[gdl:topic-view-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:tm-value]", "player":"si:[gdlsrv:service-editor-view-binding]"}]}, @@ -429,11 +430,12 @@ {"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]}, {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]}, {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-reifier-constraint]"}]}, - {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]} - + {"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:[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]"}]} + + ] } \ No newline at end of file From lgiessmann at common-lisp.net Tue Oct 25 09:03:43 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 02:03:43 -0700 Subject: [isidorus-cvs] r1015 - in trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment isidorus view Message-ID: Author: lgiessmann Date: Tue Oct 25 02:03:42 2011 New Revision: 1015 Log: gdl-frontend: Widgets: implemented the tmcl:subject-identifier-constraint and tmcl:subject-locator-constraint semantics for generating content entered in GdlVisibleObject Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java 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 trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java Tue Oct 25 02:03:42 2011 (r1015) @@ -2,7 +2,6 @@ import java.util.ArrayList; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; @@ -210,8 +209,8 @@ if(this.commitCallback == null){ throw new ExecutionException("No CommitCallback was set yet"); } - ArrayList> data = new ArrayList>(); - data.add(new Pair(this.requestedSchemaTm, TopicMapsTypes.TopicMap)); + ArrayList> data = new ArrayList>(); + data.add(new Pair(this.requestedSchemaTm, TopicMapsTypes.TopicMap)); this.commitCallback.commitTmConstruct(data, null, this.tmEngine); }catch(Exception e){ for (IOnErrorCallback handler : localOnErrorContainer) { @@ -253,8 +252,8 @@ if(this.deleteCallback == null) throw new ExecutionException("No DeleteCallback was set yet"); - ArrayList> data = new ArrayList>(); - data.add(new Pair(this.requestedSchemaTm, TopicMapsTypes.TopicMap)); + ArrayList> data = new ArrayList>(); + data.add(new Pair(this.requestedSchemaTm, TopicMapsTypes.TopicMap)); this.deleteCallback.deleteTmConstruct(data, this.getTmEngine(), null); }catch(Exception e){ for (IOnErrorCallback handler : localOnErrorContainer) @@ -265,7 +264,7 @@ // this method is responsible for generating a Topic Map fo the user's // data by using the view's getContent method. - public ArrayList> getContent(boolean validate) throws Exception { + public ArrayList> getContent(boolean validate) throws Exception { try{ return this.view.getContent(null, validate); }catch(Exception e){ 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 Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 02:03:42 2011 (r1015) @@ -4,6 +4,7 @@ import java.util.ArrayList; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Reifiable; @@ -2333,24 +2334,23 @@ public abstract ArrayList getSelectedValues(); - // validates names, occurrences and identifiers for tha passed value + // validates names, occurrences and identifiers for the passed value private void validateLiteralValue(String selectedValue) throws InvalidContentException, InvalidGdlSchemaException{ - ArrayList validLiteralValues = new ArrayList(); - for (String literal : this.getLiterals()) validLiteralValues.add(new Pattern(literal)); - if(validLiteralValues.size() == 0) validLiteralValues.add(new Pattern(this.getLiteralValueForConstraint())); - int i = 0; - for( ; i != validLiteralValues.size(); ++i) if(validLiteralValues.get(i).matches(selectedValue)) break; - - if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ - if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-name " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); - } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ - if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-occurrence " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); - } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ - - } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - - } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ + if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint) || TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint) || TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ + Pattern pattern = new Pattern(TmHelper.getRegExp(this.getConstraint())); + if(!pattern.matches(selectedValue)) throw new InvalidContentException("The value \"" + selectedValue + "\" does not satisfy the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " with the regular expression: " + TmHelper.getRegExp(this.getConstraint())); + } else { + ArrayList validLiteralValues = new ArrayList(); + for (String literal : this.getLiterals()) validLiteralValues.add(new Pattern(literal)); + if(validLiteralValues.size() == 0) validLiteralValues.add(new Pattern(this.getLiteralValueForConstraint())); + int i = 0; + for( ; i != validLiteralValues.size(); ++i) if(validLiteralValues.get(i).matches(selectedValue)) break; + if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ + if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-name " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); + } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ + if(i == validLiteralValues.size()) throw new InvalidContentException("the user data " + selectedValue + " for the topic-occurrence " + TmHelper.getAnyIdOfTopic(TmHelper.getConstrainedStatement(this.getConstraint())) + " does not satisfy any of the constraints: " + Utils.arrayToString(validLiteralValues)); + } } } @@ -2380,10 +2380,58 @@ } } + + // returns all locators contained in the passed locators array, which match the + // passed regular expression value + private ArrayList filterLocators(String pattern, JsArray locators){ + ArrayList result = new ArrayList(); + if(locators == null || locators.length() == 0) return result; + Pattern patternObject = new Pattern(pattern == null ? ".*" : pattern); + + for(int i = 0; i != locators.length(); ++i){ + if(patternObject.matches(locators.get(i).getReference())) result.add(locators.get(i)); + } + + return result; + } + + + // handles the getContetn call for subject identifiers and subject locators + private void getTopicIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + JsArray identifiers = null; + + ArrayList filteredIdentifiers = null; + boolean isPsiConstraint = false; + if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ + isPsiConstraint = true; + identifiers = carier.getSubjectIdentifiers(); + filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); + } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ + identifiers = carier.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) carier.removeSubjectIdentifier(changedIdentifier); + else carier.removeSubjectLocator(changedIdentifier); + } + + changedIdentifier = carier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + if(isPsiConstraint) carier.addSubjectIdentifier(changedIdentifier); + else carier.addSubjectLocator(changedIdentifier); + contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); + } + // returns the actual data that is hold by this instance - public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { - ArrayList> result = new ArrayList>(); + public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { + ArrayList> result = new ArrayList>(); if(this.getRootConstraint() == null) return result; Construct localCarrier = carrier; if(carrier == null) localCarrier = TmHelper.getNearestTopicOrAssociation(this); @@ -2392,10 +2440,12 @@ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ - // 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.getTopicIdentifierContent(result, validate, (Topic)localCarrier, idx); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - // TODO: implement - } 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.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()); Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint()); JsArray names = ((Topic)localCarrier).getNames(nameType); @@ -2409,8 +2459,7 @@ }else { changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null); } - - result.add(new Pair(changedName, TopicMapsTypes.Name)); + result.add(new Pair(changedName, TopicMapsTypes.Name)); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ @@ -2442,7 +2491,7 @@ changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null); } - result.add(new Pair(changedOccurrence, TopicMapsTypes.Occurrence)); + result.add(new Pair(changedOccurrence, TopicMapsTypes.Occurrence)); } 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())); @@ -2465,7 +2514,7 @@ } else { changedRole = ((Association)localCarrier).createRole(roleType, player); } - result.add(new Pair(changedRole, TopicMapsTypes.Role)); + result.add(new Pair(changedRole, TopicMapsTypes.Role)); } else { throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported"); } 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 Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Oct 25 02:03:42 2011 (r1015) @@ -2,8 +2,8 @@ import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator; import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback; import us.isidor.gdl.anaToMia.Widgets.environment.IDeleteCallback; import us.isidor.gdl.anaToMia.Widgets.environment.Pair; @@ -56,13 +56,21 @@ gdlPanel.setLoadSchemaCallback(new TestLoadSchemaCallback()); gdlPanel.setCommitCallback(new ICommitCallback() { @Override - public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine) { - Window.alert("not implemented yet :-("); + public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine) { + for (Pair construct : constructs) { + if(construct.getSecond().equals(TopicMapsTypes.Topic)){ + Window.alert("Topic!!!"); + } else if(construct.getSecond().equals(TopicMapsTypes.Locator)){ + Window.alert(((Locator)construct.getFirst()).getReference() + " >> " + construct.getSecond()); + } else { + Window.alert(construct.getFirst() + " >> " + construct.getSecond()); + } + } } }); gdlPanel.setDeleteCallback(new IDeleteCallback() { @Override - public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId) { + public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId) { Window.alert("not implemented yet :-("); } }); 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 Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 25 02:03:42 2011 (r1015) @@ -1210,7 +1210,7 @@ ArrayList occurrenceTypes = getOtherPlayerOfBinaryAssociation(constraint, constraintRoleType, constrainedStatementAssocType, null, occurrenceType, constrainedRoleType); ArrayList nameOrOccurrenceTypes = Utils.union(nameTypes, occurrenceTypes); - if(nameOrOccurrenceTypes.size() == 0){ + if(nameOrOccurrenceTypes.size() == 0){ return result; } else if(nameOrOccurrenceTypes.size() > 1){ throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraint) + " must be bound maximum once to a topic via a " + PSIs.TMCL.tmclConstrainedStatement + ", but is: " + nameOrOccurrenceTypes.size()); @@ -1368,7 +1368,7 @@ } - // returns an integer representing the tmcl:card-min value + // returns an integer representing the tmcl:card-min value of the passed constraint public static int getCardMin(Topic constraint) throws InvalidGdlSchemaException { if(constraint == null) return 0; Occurrence occ = getSingleOccurrence(constraint, getTopicByPsi(PSIs.TMCL.tmclCardMin, constraint.getTopicMap())); @@ -1384,8 +1384,20 @@ } - // returns an integer representing the tmcl:card-max value or -1 - // if infinite + // returns a string representing the tmcl:regexp value of the passed constraint + public static String getRegExp(Topic constraint) throws InvalidGdlSchemaException { + if(constraint == null) return ".*"; + Occurrence occ = getSingleOccurrence(constraint, getTopicByPsi(PSIs.TMCL.tmclRegexp, constraint.getTopicMap())); + if(occ == null){ + return ".*"; + } else { + return occ.getValue(); + } + } + + + // returns an integer representing the tmcl:card-max value of the + // passed constraint or -1 if infinite public static int getCardMax(Topic constraint) throws InvalidGdlSchemaException { if(constraint == null) return 0; Occurrence occ = getSingleOccurrence(constraint, getTopicByPsi(PSIs.TMCL.tmclCardMax, constraint.getTopicMap())); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java Tue Oct 25 02:03:42 2011 (r1015) @@ -3,11 +3,10 @@ import java.util.ArrayList; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; public interface ICommitCallback { - public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine); + public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine); } Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java Tue Oct 25 02:03:42 2011 (r1015) @@ -2,10 +2,9 @@ import java.util.ArrayList; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; public interface IDeleteCallback { - public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId); + public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId); } Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java Tue Oct 25 02:03:42 2011 (r1015) @@ -22,7 +22,6 @@ import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; @@ -49,7 +48,7 @@ @Override - public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine) { + public void commitTmConstruct(ArrayList> constructs, String buttonId, TmEngine tmEngine) { try{ if("creator_hash_object_commit_button_id".equals(buttonId)){ if(this.gdlWebPage != null) this.gdlWebPage.createLoadScreenPanel("Committing Data", "committing the currently created Hash-Object topic to " + this.COMMIT_REQUEST_URL); @@ -78,12 +77,12 @@ } - private void commitCreatedEnvironment(ArrayList> constructs, TmEngine tmEngine) throws ExporterException { + private void commitCreatedEnvironment(ArrayList> constructs, TmEngine tmEngine) throws ExporterException { final String carrierPsi = PSIs.GDL.gdl + "environment_default_creator_topic_view_id"; ArrayList topics = new ArrayList(); ArrayList topicMaps = new ArrayList(); - for (Pair construct : constructs) { + for (Pair construct : constructs) { if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst()); else if(construct.getSecond().equals(TopicMapsTypes.TopicMap)) topicMaps.add((TopicMap)construct.getFirst()); else throw new ExporterException("unexpected construct types: " + construct.getSecond()+ ", only Topic and Association are allowed"); @@ -134,13 +133,13 @@ } - private void commitCreatedHashObject(ArrayList> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{ + private void commitCreatedHashObject(ArrayList> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{ final String carrierPsi = PSIs.GDL.gdl + "hash_object_default_creator_topic_view_id"; ArrayList topics = new ArrayList(); ArrayList associations = new ArrayList(); ArrayList topicMaps = new ArrayList(); - for (Pair construct : constructs) { + for (Pair construct : constructs) { if(construct.getSecond().equals(TopicMapsTypes.Association)) associations.add((Association)construct.getFirst()); else if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst()); else if(construct.getSecond().equals(TopicMapsTypes.TopicMap)) topicMaps.add((TopicMap)construct.getFirst()); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java Tue Oct 25 02:03:42 2011 (r1015) @@ -18,7 +18,6 @@ import com.google.gwt.user.client.Window; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException; import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine; -import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; import us.isidor.gdl.anaToMia.Widgets.base.TmHelper; @@ -52,7 +51,7 @@ @Override - public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId) { + public void deleteTmConstruct(ArrayList> constructs, TmEngine tmEngine, String buttonId) { if(buttonId != null){ Element elem = DOM.getElementById(buttonId); ButtonElement btnElem = (ButtonElement)elem; @@ -62,8 +61,8 @@ } - private void deleteTopic(ArrayList> constructs, TmEngine tmEngine){ - for (Pair pair : constructs) { + private void deleteTopic(ArrayList> constructs, TmEngine tmEngine){ + for (Pair pair : constructs) { if(pair.getSecond().equals(TopicMapsTypes.Topic)){ Topic top = (Topic)pair.getFirst(); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java Tue Oct 25 02:03:42 2011 (r1015) @@ -185,13 +185,13 @@ @Override - public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{ - ArrayList> result = new ArrayList>(); + public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{ + ArrayList> result = new ArrayList>(); for (Widget ctrl : this.subElements) { if(ctrl instanceof ButtonableObject){ if(((ButtonableObject)ctrl).getMainObject() instanceof AssociationItem){ - for (Pair pair : ((AssociationItem)((ButtonableObject)ctrl).getMainObject()).getContent(null, validate)) { + for (Pair pair : ((AssociationItem)((ButtonableObject)ctrl).getMainObject()).getContent(null, validate)) { result.add(pair); } } @@ -207,7 +207,7 @@ if(TmHelper.isInstanceOf(hdv.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){ if(!TmHelper.isInstanceOf(hdv.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(hdv.getConstraint()) + " must be bound to an instance of " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(hdv.getRootConstraint())); - for (Pair pair : result) { + for (Pair pair : result) { if(pair.getSecond().equals(TopicMapsTypes.Association)){ Association assoc = (Association)pair.getFirst(); JsArray roles = assoc.getRoles(roleType); @@ -276,8 +276,8 @@ @Override - public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { - ArrayList> result = new ArrayList>(); + public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { + ArrayList> result = new ArrayList>(); Association localCarrier = this.getRepresentedAssociation(); @@ -286,7 +286,7 @@ ((GdlVisibleObject)ctrl).getContent(localCarrier, validate); } } - result.add(new Pair(localCarrier, TopicMapsTypes.Association)); + result.add(new Pair(localCarrier, TopicMapsTypes.Association)); return result; } Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Thu Oct 20 02:23:09 2011 (r1014) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Tue Oct 25 02:03:42 2011 (r1015) @@ -88,14 +88,14 @@ // returns true if the construct that is contained in the first member of pair // is also indirectly contained in the container - private boolean indirectlyContained(Pair pair, ArrayList> container){ + private boolean indirectlyContained(Pair pair, ArrayList> container){ if(pair == null) return true; if(container == null) return false; TopicMapsTypes newType = pair.getSecond(); if(newType.equals(TopicMapsTypes.Name)){ Name name = (Name)pair.getFirst(); - for (Pair item : container) { + for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Topic)){ JsArray names = ((Topic)item.getFirst()).getNames(); if(Utils.contains(names, name)) return true; @@ -103,14 +103,14 @@ } } else if (newType.equals(TopicMapsTypes.Variant)){ Variant variant = (Variant)pair.getFirst(); - for (Pair item : container) { + for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Name)){ JsArray variants = ((Name)item.getFirst()).getVariants(); if(Utils.contains(variants, variant)) return true; } } - for (Pair item : container) { + for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Topic)){ JsArray names = ((Topic)item.getFirst()).getNames(); for(int i = 0; i != names.length(); ++i){ @@ -121,7 +121,7 @@ } } else if (newType.equals(TopicMapsTypes.Occurrence)){ Occurrence occurrence = (Occurrence)pair.getFirst(); - for (Pair item : container) { + for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Topic)){ JsArray occurrences = ((Topic)item.getFirst()).getOccurrences(); if(Utils.contains(occurrences, occurrence)) return true; @@ -129,7 +129,7 @@ } } else if (newType.equals(TopicMapsTypes.Role)){ Role role = (Role)pair.getFirst(); - for (Pair item : container) { + for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Association)){ JsArray roles = ((Association)item.getFirst()).getRoles(); if(Utils.contains(roles, role)) return true; @@ -143,18 +143,18 @@ @SuppressWarnings("unchecked") @Override - public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { - ArrayList> result = new ArrayList>(); + public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { + ArrayList> result = new ArrayList>(); Topic localCarrier = this.getRepresentedTopic(); for (Widget ctrl : this.subElements) { int i = 0; for( ; i != result.size(); ++i) if(result.get(i).getFirst().equals(localCarrier)) break; - if(i == result.size()) result.add(new Pair(localCarrier, TopicMapsTypes.Topic)); + if(i == result.size()) result.add(new Pair(localCarrier, TopicMapsTypes.Topic)); if(ctrl instanceof GdlVisibleObject){ - for (Pair pair : ((GdlVisibleObject)ctrl).getContent(localCarrier, validate)) { + for (Pair pair : ((GdlVisibleObject)ctrl).getContent(localCarrier, validate)) { if((this.receivedData != null || (ctrl instanceof GdlView)) && !this.indirectlyContained(pair, result))result.add(pair); } } @@ -177,7 +177,7 @@ if(i == occurrences.length()){ Occurrence occ = top.createOccurrence(occurrenceType, value, (JsArray)JsArray.createArray()); - Pair newItem = new Pair(occ, TopicMapsTypes.Occurrence); + Pair newItem = new Pair(occ, TopicMapsTypes.Occurrence); if(!this.indirectlyContained(newItem, result)) result.add(newItem); } } From lgiessmann at common-lisp.net Tue Oct 25 09:32:54 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 02:32:54 -0700 Subject: [isidorus-cvs] r1016 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 25 02:32:54 2011 New Revision: 1016 Log: gdl-frontend: Widgets: fixed a bug in the implementation if tmcl:item-identifier-constraint when retrieving TM-data 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 Tue Oct 25 02:03:42 2011 (r1015) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 02:32:54 2011 (r1016) @@ -1917,34 +1917,54 @@ } } } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - if(!(this.receivedData instanceof Reifiable)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass()); + 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()); - // search for the topic type - Reifiable ref = (Reifiable)this.receivedData; - - // search for the characteristics type - if(this.receivedData instanceof Topic){ - JsArray names = ((Topic)this.receivedData).getNames(constrainedTopicType); - if(names.length() != 0){ - ref = names.get(0); - } else { - JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); - if(occs.length() != 0) ref = occs.get(0); + int typeIdx = -1; + JsArray 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(this.receivedData instanceof Association){ - JsArray 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); + 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 names = ((Topic)this.receivedData).getNames(constrainedTopicType); + if(names.length() != 0){ + ref = names.get(0); + } else { + JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); + if(occs.length() != 0) ref = occs.get(0); + } + } else if(this.receivedData instanceof Association){ + JsArray 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); + } } } } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ @@ -2396,7 +2416,7 @@ } - // handles the getContetn call for subject identifiers and subject locators + // handles the getContent call for subject identifiers and subject locators private void getTopicIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ JsArray identifiers = null; @@ -2428,6 +2448,15 @@ contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); } + + // handles the getContent call for item identifiers + private void getItemIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + JsArray identifiers = null; + + + + } + // returns the actual data that is hold by this instance public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { @@ -2438,7 +2467,8 @@ for (int idx = 0; idx != this.getSelectedValues().size(); ++idx){ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){ - // TODO: implement + 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); From lgiessmann at common-lisp.net Tue Oct 25 09:56:18 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 02:56:18 -0700 Subject: [isidorus-cvs] r1017 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 25 02:56:18 2011 New Revision: 1017 Log: gdl-frontend: Widgets: implemented the tmcl:item-identifier-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 Tue Oct 25 02:32:54 2011 (r1016) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 02:56:18 2011 (r1017) @@ -2450,11 +2450,73 @@ // handles the getContent call for item identifiers - private void getItemIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + private void getItemIdentifierContent(ArrayList> contents, boolean validate, Construct carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, 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()); + + int typeIdx = -1; + JsArray types = null; + if((carier instanceof Topic)){ + types = ((Topic)carier).getTypes(); + if(types.length() != 0){ + for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break; + } + } + JsArray identifiers = null; - - - + ArrayList filteredIdentifiers = null; + if((carier instanceof Topic) && types != null && typeIdx != types.length()){ + identifiers = ((Topic)carier).getItemIdentifiers(); + filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); + + Locator changedIdentifier = null; + if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex)); + + if(filteredIdentifiers.size() > selectedValueIndex){ + changedIdentifier = filteredIdentifiers.get(selectedValueIndex); + ((Topic)carier).removeItemIdentifier(changedIdentifier); + } + + changedIdentifier = ((Topic)carier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + ((Topic)carier).addItemIdentifier(changedIdentifier); + contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); + } else { + // search for the topic type + Reifiable ref = null; + + // search for the characteristics type + if(carier instanceof Topic){ + JsArray names = ((Topic)carier).getNames(constrainedTopicType); + if(names.length() != 0){ + ref = names.get(0); + } else { + JsArray occs = ((Topic)carier).getOccurrences(constrainedTopicType); + if(occs.length() != 0) ref = occs.get(0); + } + } else if(carier instanceof Association){ + JsArray roles = ((Association)carier).getRoles(constrainedTopicType); + if(roles.length() != 0) ref = roles.get(0); + } + if(ref == null) return; + + // search for item-identifiers of the found topic type or characteristics + identifiers = ((ReifiableStub)ref).getItemIdentifiers(); + filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); + + Locator changedIdentifier = null; + if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex)); + + if(filteredIdentifiers.size() > selectedValueIndex){ + changedIdentifier = filteredIdentifiers.get(selectedValueIndex); + ((ReifiableStub)carier).removeItemIdentifier(changedIdentifier); + } + + changedIdentifier = ((ReifiableStub)carier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + ((ReifiableStub)carier).addItemIdentifier(changedIdentifier); + contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); + } } From lgiessmann at common-lisp.net Tue Oct 25 10:10:08 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 03:10:08 -0700 Subject: [isidorus-cvs] r1018 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 25 03:10:07 2011 New Revision: 1018 Log: gdl-frontend: Widgets: implemented the gdlt:Variant-Name-Identifiers 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 Tue Oct 25 02:56:18 2011 (r1017) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 03:10:07 2011 (r1018) @@ -2520,6 +2520,33 @@ } + // handles the getContent call for item identifiers of varian-names + private void getVariantIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + ArrayList possibleVariants = TmHelper.getVariantsForConstraint(carier, this.getRootConstraint()); + if(possibleVariants.size() != 0){ + Variant variant = possibleVariants.get(0); + JsArray identifiers = null; + + ArrayList filteredIdentifiers = null; + + identifiers = variant.getItemIdentifiers(); + filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); + + Locator changedIdentifier = null; + if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex)); + + if(filteredIdentifiers.size() > selectedValueIndex){ + changedIdentifier = filteredIdentifiers.get(selectedValueIndex); + variant.removeItemIdentifier(changedIdentifier); + } + + changedIdentifier = variant.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + variant.addItemIdentifier(changedIdentifier); + contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); + } + } + + // returns the actual data that is hold by this instance public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { ArrayList> result = new ArrayList>(); @@ -2553,21 +2580,22 @@ } result.add(new Pair(changedName, TopicMapsTypes.Name)); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ - // TODO: implement + // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){ - // 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.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()); Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint()); From lgiessmann at common-lisp.net Tue Oct 25 13:23:39 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 06:23:39 -0700 Subject: [isidorus-cvs] r1019 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Tue Oct 25 06:23:37 2011 New Revision: 1019 Log: gdl-frontend: Widgets: refactored the implementation for the tmcl:topic-occurrence-constraint and tmcl:topic-name-constraint 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/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 Tue Oct 25 03:10:07 2011 (r1018) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 06:23:37 2011 (r1019) @@ -2417,17 +2417,17 @@ // handles the getContent call for subject identifiers and subject locators - private void getTopicIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + private void getTopicIdentifierContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ JsArray identifiers = null; ArrayList filteredIdentifiers = null; boolean isPsiConstraint = false; if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){ isPsiConstraint = true; - identifiers = carier.getSubjectIdentifiers(); + identifiers = carrier.getSubjectIdentifiers(); filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){ - identifiers = carier.getSubjectLocators(); + 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"); @@ -2438,19 +2438,19 @@ if(filteredIdentifiers.size() > selectedValueIndex){ changedIdentifier = filteredIdentifiers.get(selectedValueIndex); - if(isPsiConstraint) carier.removeSubjectIdentifier(changedIdentifier); - else carier.removeSubjectLocator(changedIdentifier); + if(isPsiConstraint) carrier.removeSubjectIdentifier(changedIdentifier); + else carrier.removeSubjectLocator(changedIdentifier); } - changedIdentifier = carier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); - if(isPsiConstraint) carier.addSubjectIdentifier(changedIdentifier); - else carier.addSubjectLocator(changedIdentifier); + changedIdentifier = carrier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + if(isPsiConstraint) carrier.addSubjectIdentifier(changedIdentifier); + else carrier.addSubjectLocator(changedIdentifier); contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); } // handles the getContent call for item identifiers - private void getItemIdentifierContent(ArrayList> contents, boolean validate, Construct carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + private void getItemIdentifierContent(ArrayList> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, 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 @@ -2458,8 +2458,8 @@ int typeIdx = -1; JsArray types = null; - if((carier instanceof Topic)){ - types = ((Topic)carier).getTypes(); + if((carrier instanceof Topic)){ + types = ((Topic)carrier).getTypes(); if(types.length() != 0){ for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break; } @@ -2467,8 +2467,8 @@ JsArray identifiers = null; ArrayList filteredIdentifiers = null; - if((carier instanceof Topic) && types != null && typeIdx != types.length()){ - identifiers = ((Topic)carier).getItemIdentifiers(); + if((carrier instanceof Topic) && types != null && typeIdx != types.length()){ + identifiers = ((Topic)carrier).getItemIdentifiers(); filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers); Locator changedIdentifier = null; @@ -2476,27 +2476,27 @@ if(filteredIdentifiers.size() > selectedValueIndex){ changedIdentifier = filteredIdentifiers.get(selectedValueIndex); - ((Topic)carier).removeItemIdentifier(changedIdentifier); + ((Topic)carrier).removeItemIdentifier(changedIdentifier); } - changedIdentifier = ((Topic)carier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); - ((Topic)carier).addItemIdentifier(changedIdentifier); + changedIdentifier = ((Topic)carrier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + ((Topic)carrier).addItemIdentifier(changedIdentifier); contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); } else { // search for the topic type Reifiable ref = null; // search for the characteristics type - if(carier instanceof Topic){ - JsArray names = ((Topic)carier).getNames(constrainedTopicType); + if(carrier instanceof Topic){ + JsArray names = ((Topic)carrier).getNames(constrainedTopicType); if(names.length() != 0){ ref = names.get(0); } else { - JsArray occs = ((Topic)carier).getOccurrences(constrainedTopicType); + JsArray occs = ((Topic)carrier).getOccurrences(constrainedTopicType); if(occs.length() != 0) ref = occs.get(0); } - } else if(carier instanceof Association){ - JsArray roles = ((Association)carier).getRoles(constrainedTopicType); + } else if(carrier instanceof Association){ + JsArray roles = ((Association)carrier).getRoles(constrainedTopicType); if(roles.length() != 0) ref = roles.get(0); } if(ref == null) return; @@ -2510,19 +2510,19 @@ if(filteredIdentifiers.size() > selectedValueIndex){ changedIdentifier = filteredIdentifiers.get(selectedValueIndex); - ((ReifiableStub)carier).removeItemIdentifier(changedIdentifier); + ((ReifiableStub)carrier).removeItemIdentifier(changedIdentifier); } - changedIdentifier = ((ReifiableStub)carier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); - ((ReifiableStub)carier).addItemIdentifier(changedIdentifier); + changedIdentifier = ((ReifiableStub)carrier).getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex)); + ((ReifiableStub)carrier).addItemIdentifier(changedIdentifier); contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); } } - // handles the getContent call for item identifiers of varian-names - private void getVariantIdentifierContent(ArrayList> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ - ArrayList possibleVariants = TmHelper.getVariantsForConstraint(carier, this.getRootConstraint()); + // handles the getContent call for item identifiers of variant-names + private void getVariantIdentifierContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + ArrayList possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint()); if(possibleVariants.size() != 0){ Variant variant = possibleVariants.get(0); JsArray identifiers = null; @@ -2545,7 +2545,48 @@ contents.add(new Pair(changedIdentifier, TopicMapsTypes.Locator)); } } + + + // handles the getContent call for occurrence and name values + private void getTopicCharacteristicContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint()); + + boolean isOccConstraint = true; + if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){ + isOccConstraint = true; + } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){ + isOccConstraint = false; + } else { + throw new ExecutionException("the function getTopicCharacteristicContent can operate only on constraints of the type " + PSIs.TMCL.tmclTopicOccurrenceConstraint + " or " + PSIs.TMCL.tmclTopicNameConstraint + ", but is called with " + TmHelper.getAnyIdOfTopic(this.getConstraint())); + } + JsArray names = null; + JsArray occurrences = null; + if(isOccConstraint) occurrences = carrier.getOccurrences(characteristicType); + else names = carrier.getNames(characteristicType); + + + Construct changedConstruct = null; + if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex)); + + if(isOccConstraint){ + if(occurrences.length() > selectedValueIndex){ + changedConstruct = occurrences.get(selectedValueIndex); + ((Occurrence)changedConstruct).setValue(this.getSelectedValues().get(selectedValueIndex)); + }else { + changedConstruct = carrier.createOccurrence(characteristicType, this.getSelectedValues().get(selectedValueIndex), null); + } + } else { + if(names.length() > selectedValueIndex){ + changedConstruct = names.get(selectedValueIndex); + ((Name)changedConstruct).setValue(this.getSelectedValues().get(selectedValueIndex)); + }else { + changedConstruct = carrier.createName(this.getSelectedValues().get(selectedValueIndex), characteristicType, null); + } + } + contents.add(new Pair(changedConstruct, isOccConstraint ? TopicMapsTypes.Occurrence : TopicMapsTypes.Name)); + } + // returns the actual data that is hold by this instance public ArrayList> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException { @@ -2566,19 +2607,7 @@ 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()); - Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint()); - JsArray names = ((Topic)localCarrier).getNames(nameType); - - Name changedName = null; - if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - - if(names.length() > idx){ - changedName = names.get(idx); - changedName.setValue(this.getSelectedValues().get(idx)); - }else { - changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null); - } - result.add(new Pair(changedName, TopicMapsTypes.Name)); + this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx); } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ // TODO: implement } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ @@ -2598,20 +2627,7 @@ 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()); - Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint()); - JsArray occurrences = ((Topic)localCarrier).getOccurrences(occurrenceType); - - Occurrence changedOccurrence = null; - if(validate) this.validateLiteralValue(this.getSelectedValues().get(idx)); - - if(occurrences.length() > idx){ - changedOccurrence = occurrences.get(idx); - changedOccurrence.setValue(this.getSelectedValues().get(idx)); - }else { - changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null); - } - - result.add(new Pair(changedOccurrence, TopicMapsTypes.Occurrence)); + 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())); 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 03:10:07 2011 (r1018) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Oct 25 06:23:37 2011 (r1019) @@ -2,6 +2,8 @@ import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; 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.TopicMapsTypes; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator; import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback; @@ -62,6 +64,10 @@ Window.alert("Topic!!!"); } else if(construct.getSecond().equals(TopicMapsTypes.Locator)){ Window.alert(((Locator)construct.getFirst()).getReference() + " >> " + construct.getSecond()); + } else if(construct.getSecond().equals(TopicMapsTypes.Occurrence)){ + Window.alert(((Occurrence)construct.getFirst()).getValue() + " >> " + construct.getSecond()); + } else if(construct.getSecond().equals(TopicMapsTypes.Name)){ + Window.alert(((Name)construct.getFirst()).getValue() + " >> " + construct.getSecond()); } else { Window.alert(construct.getFirst() + " >> " + construct.getSecond()); } From lgiessmann at common-lisp.net Tue Oct 25 16:29:08 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 25 Oct 2011 09:29:08 -0700 Subject: [isidorus-cvs] r1020 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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 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> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + ArrayList 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(variant, TopicMapsTypes.Variant)); + } + } + + // handles the getContent call for occurrence and name values private void getTopicCharacteristicContent(ArrayList> 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 getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException { - // TODO: implement - throw new ExecutionException("this mehtod is currently not implemented"); + public static ArrayList getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException { + ArrayList result = new ArrayList(); + 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 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 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 getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException{ - // TODO: implement - throw new ExecutionException("this method is currently not implemented"); + public static ArrayList getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException, InvalidGdlSchemaException{ + ArrayList result = new ArrayList(); + 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 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 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; } From lgiessmann at common-lisp.net Wed Oct 26 09:11:24 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 02:11:24 -0700 Subject: [isidorus-cvs] r1021 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets Message-ID: 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(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 getTmValuesForTypeConstraint(Topic typeConstraint, Topic valueGroup) throws InvalidGdlSchemaException, ExecutionException { ArrayList result = new ArrayList(); 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 getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException { ArrayList result = new ArrayList(); if(variantNameReifierConstraint == null) return result; @@ -1199,9 +1199,8 @@ // get subtypes of typeTopic JsArray 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 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]"}]} From lgiessmann at common-lisp.net Wed Oct 26 10:06:14 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 03:06:14 -0700 Subject: [isidorus-cvs] r1022 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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 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 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 names = ((Topic)this.receivedData).getNames(constrainedTopicType); + if(names.length() != 0){ + ref = names.get(0); + } else { + JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); + if(occs.length() != 0) ref = occs.get(0); } + } else if(this.receivedData instanceof Association){ + JsArray 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 names = ((Topic)this.receivedData).getNames(constrainedTopicType); - if(names.length() != 0){ - ref = names.get(0); - } else { - JsArray occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType); - if(occs.length() != 0) ref = occs.get(0); - } - } else if(this.receivedData instanceof Association){ - JsArray 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 names = ((Topic)this.receivedData).getNames(type); + if(names.length() != 0) reifier = names.get(0).getReifier(); + if(reifier == null){ + JsArray 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 names = ((Topic)this.receivedData).getNames(type); - if(names.length() != 0) reifier = names.get(0).getReifier(); - if(reifier == null){ - JsArray 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 scope = null; + if(this.receivedData instanceof Topic){ + JsArray names = ((Topic)this.receivedData).getNames(type); + if(names.length() != 0) scope = names.get(0).getScope(); + if(scope == null){ + JsArray 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 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 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 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 scope = null; - if(this.receivedData instanceof Topic){ - JsArray names = ((Topic)this.receivedData).getNames(type); - if(names.length() != 0) scope = names.get(0).getScope(); - if(scope == null){ - JsArray 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 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 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 roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); - JsArray 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 roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); + JsArray 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 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 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 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 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 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 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 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 getRawTmValues() throws InvalidGdlSchemaException{ if(this.rawTmValuesSet){ @@ -2606,6 +2679,68 @@ contents.add(new Pair(changedConstruct, isOccConstraint ? TopicMapsTypes.Occurrence : TopicMapsTypes.Name)); } + + // handles the getContent call for subject identifiers and subject locators + private void getVariantNameContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + // TODO: implement + + /*JsArray identifiers = null; + + ArrayList 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(changedIdentifier, TopicMapsTypes.Locator)); + */ + } + + + // handles the getContent call for role players + private void getRolePlayerContent(ArrayList> 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 roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); + Topic roleType = roleAndPlayerType.getFirst(); + Topic playerType = roleAndPlayerType.getSecond(); + + JsArray typedRoles = carrier.getRoles(roleType); + ArrayList roles = new ArrayList(); + 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(changedRole, TopicMapsTypes.Role)); + } + // returns the actual data that is hold by this instance public ArrayList> 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 roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint()); - Topic roleType = roleAndPlayerType.getFirst(); - Topic playerType = roleAndPlayerType.getSecond(); - - JsArray typedRoles = ((Association)localCarrier).getRoles(roleType); - ArrayList roles = new ArrayList(); - 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(changedRole, TopicMapsTypes.Role)); + this.getRolePlayerContent(result, validate, (Association)localCarrier, idx); } else { throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported"); } From lgiessmann at common-lisp.net Wed Oct 26 11:49:33 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 04:49:33 -0700 Subject: [isidorus-cvs] r1023 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ - // TODO: implement - - /*JsArray identifiers = null; - - ArrayList 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 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 names = carrier.getNames(nameType); + Name owner = names.get(0); + Topic scope = TmHelper.getConstrainedScopeTopic(this.getConstraint()); + @SuppressWarnings("unchecked") + JsArray scopes = (JsArray) 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(changedIdentifier, TopicMapsTypes.Locator)); - */ + contents.add(new Pair(changedVariant, TopicMapsTypes.Variant)); } From lgiessmann at common-lisp.net Wed Oct 26 11:53:39 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 04:53:39 -0700 Subject: [isidorus-cvs] r1024 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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> 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 identifiers = null; ArrayList filteredIdentifiers = null; @@ -2601,6 +2602,7 @@ // handles the getContent call for item identifiers of variant-names private void getVariantIdentifierContent(ArrayList> 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 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> 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 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> 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> 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 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"); From lgiessmann at common-lisp.net Wed Oct 26 12:02:48 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 05:02:48 -0700 Subject: [isidorus-cvs] r1025 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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(changedRole, TopicMapsTypes.Role)); } + + // handles the getContent call for scope topics of variant-names + private void getVariantNameScopeContent(ArrayList> 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 possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint()); + if(possibleVariants.size() != 0){ + Variant variant = possibleVariants.get(0); + JsArray 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(variant, TopicMapsTypes.Variant)); + } + } + // returns the actual data that is hold by this instance public ArrayList> 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)){ From lgiessmann at common-lisp.net Wed Oct 26 14:10:40 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 07:10:40 -0700 Subject: [isidorus-cvs] r1026 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + // TODO: implement + } + + + // handles the getContent call for scope topics + private void getReifierContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + // TODO: implement + } + + + // handles the getContent call for scope topics + private void getDatatypeContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + // TODO: implement + } + + + // handles the getContent call for scope topics + private void getTypeContent(ArrayList> 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> 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()); } From lgiessmann at common-lisp.net Wed Oct 26 16:18:55 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 09:18:55 -0700 Subject: [isidorus-cvs] r1027 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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 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(variant, TopicMapsTypes.Variant)); } } // handles the getContent call for scope topics - private void getScopeContent(ArrayList> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ - // TODO: implement + private void getScopeContent(ArrayList> contents, boolean validate, Construct carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); + + JsArray scopes = null; + Construct owner = null; + TopicMapsTypes ownerType = null; + if(carrier instanceof Topic){ + JsArray 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 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(owner, ownerType)); } - // handles the getContent call for scope topics - private void getReifierContent(ArrayList> 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> 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 names = ((Topic)carrier).getNames(type); + if(names.length() != 0){ + owner = names.get(0); + ownerType = TopicMapsTypes.Name; + } else { + JsArray 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 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(owner, ownerType)); } From lgiessmann at common-lisp.net Wed Oct 26 16:56:13 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 09:56:13 -0700 Subject: [isidorus-cvs] r1028 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ + private void getDatatypeContent(ArrayList> 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> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{ - // TODO: implement + private void getTypeContent(ArrayList> 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 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 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 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 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(owner, ownerType)); } From lgiessmann at common-lisp.net Wed Oct 26 17:07:01 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Wed, 26 Oct 2011 10:07:01 -0700 Subject: [isidorus-cvs] r1029 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: 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> 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 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 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(owner, ownerType)); } From lgiessmann at common-lisp.net Thu Oct 27 08:08:01 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 27 Oct 2011 01:08:01 -0700 Subject: [isidorus-cvs] r1030 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view Message-ID: Author: lgiessmann Date: Thu Oct 27 01:08:00 2011 New Revision: 1030 Log: gdl-frontend: Widgets: finalised GdlTopicView.indirectlyContained(...) Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Wed Oct 26 10:06:49 2011 (r1029) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java Thu Oct 27 01:08:00 2011 (r1030) @@ -93,7 +93,10 @@ if(container == null) return false; TopicMapsTypes newType = pair.getSecond(); - if(newType.equals(TopicMapsTypes.Name)){ + if(newType.equals(TopicMapsTypes.Locator)){ + // remove all locators + return true; + } else if(newType.equals(TopicMapsTypes.Name)){ Name name = (Name)pair.getFirst(); for (Pair item : container) { if(item.getSecond().equals(TopicMapsTypes.Topic)){ @@ -187,14 +190,22 @@ // subject-identifier // subject-locator // item-identifier + // reifier => name + // reifier => occurrence + // reifier => association + // reifier => role // topic-name // variant-name // *topic-occurrence // type => topic-name // type => topic-occurrence - // datatype => topic-occurrence + // datatype => topic-occurrence + variant-name // scope => topic-name // scope => topic-occurrence + // scope => association + // variant-name-reifier + // variant-name-identifiers + // variant-name-scope } return result; From lgiessmann at common-lisp.net Thu Oct 27 08:27:15 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 27 Oct 2011 01:27:15 -0700 Subject: [isidorus-cvs] r1031 - in trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base button container environment isidorus Message-ID: Author: lgiessmann Date: Thu Oct 27 01:27:15 2011 New Revision: 1031 Log: gdl-frontend: Widgets: refactored all files and updated all TODOs Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCreateButton.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlErrorTypes.java trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 27 01:27:15 2011 (r1031) @@ -1,8 +1,27 @@ * implement export of Fragments, e.g. exportJTM11Fragment(ArrayList topics, ArrayList associaitions), e.i. the passed topics and associations must be exported with all characteristics and associations, and all referenced topics must be exported as stubs -* implement all constraints - * TM-generation - * TM-consumption - * TM-validation +* finalise GdltopicView.getContent() +* finalise TmHelper.getTmValuesForTypeConstraint() +* finalise GdlPanel.doValidate() +* finalise GdlCheckBox +* finalise GdlCommitButton +* finalise GdlCreateButton +* finalise GdlRadioButton +* finalise GdlUnit +* finalise GdlTitle.setWidth() +* finalise GdlTitle.getSelectedValues() +* finalise GdlInfo.GdlInfo() +* finalise GdlReference.GdlReference() +* finalise GdlReference.addSubItem() +* finalise GdlReference.ReferenceClickHandler.onClick() +* finalise GdlTopicView.getContent() +* finalise GdlSpecialTopicView +* finalise GdlSpecialEditorTopicView +* finalise GdlSpecialCreatorTopicView +* finalise GdlEditorAssociationView +* finalise GdlDefaultTopicView +* finalise GdlDefaultCreatorTopicView +* finalise GdlDefaultEditorTopicView +* finalise GdlAssociationView.getContent() * Fix css-pseudo-class-handlers \ No newline at end of file Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestLoadSchemaCallback.java Thu Oct 27 01:27:15 2011 (r1031) @@ -65,7 +65,7 @@ }catch(ExecutionException e){ Window.alert("Execution Error: " + e.getMessage()); }catch(Exception e){ - Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncaught error: " + e.getLocalizedMessage()); // TODO: implement smarter error handling + Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncaught error: " + e.getLocalizedMessage()); e.printStackTrace(); } } else { Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCreateButton.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCreateButton.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCreateButton.java Thu Oct 27 01:27:15 2011 (r1031) @@ -8,7 +8,6 @@ import com.google.gwt.user.client.ui.Button; public class GdlCreateButton extends GdlActionButton { - // TOOD: is this class really necessary or is GdlCommitButton sufficient??? // TODO: implement protected GdlCreateButton(){ Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java Thu Oct 27 01:27:15 2011 (r1031) @@ -12,8 +12,6 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class GdlDeleteButton extends GdlActionButton { - // TODO: implement - protected GdlDeleteButton(){ super(); } Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlList.java Thu Oct 27 01:27:15 2011 (r1031) @@ -280,7 +280,6 @@ @Override public GdlVisibleObject append(Topic ancestor, Topic current) throws InvalidGdlSchemaException, ExecutionException { - // TODO Auto-generated method stub if(this.subElements.size() == 0) return null; if(this.storedItems == null) this.storedItems = this.containsItems(); Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlErrorTypes.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlErrorTypes.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlErrorTypes.java Thu Oct 27 01:27:15 2011 (r1031) @@ -8,5 +8,4 @@ TopicMapsGenerationError, ViewCreationError, ExecutionError - // TODO: ... } Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Thu Oct 27 01:08:00 2011 (r1030) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Thu Oct 27 01:27:15 2011 (r1031) @@ -70,7 +70,7 @@ }catch(ExecutionException e){ Window.alert("Execution Error: " + e.getMessage()); }catch(Exception e){ - Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncaught error: " + e.getLocalizedMessage()); // TODO: implement smarter error handling + Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncaught error: " + e.getLocalizedMessage()); e.printStackTrace(); } } else { From lgiessmann at common-lisp.net Thu Oct 27 09:18:30 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Thu, 27 Oct 2011 02:18:30 -0700 Subject: [isidorus-cvs] r1032 - in trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base Message-ID: Author: lgiessmann Date: Thu Oct 27 02:18:29 2011 New Revision: 1032 Log: gdl-frontend: Widgets: finalised TmHelper.getTmValuesForTypeConstraint(...) Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt 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/TODO.txt ============================================================================== --- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 27 01:27:15 2011 (r1031) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Thu Oct 27 02:18:29 2011 (r1032) @@ -2,7 +2,6 @@ e.i. the passed topics and associations must be exported with all characteristics and associations, and all referenced topics must be exported as stubs * finalise GdltopicView.getContent() -* finalise TmHelper.getTmValuesForTypeConstraint() * finalise GdlPanel.doValidate() * finalise GdlCheckBox * finalise GdlCommitButton 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 Thu Oct 27 01:27:15 2011 (r1031) +++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Thu Oct 27 02:18:29 2011 (r1032) @@ -1147,33 +1147,35 @@ Topic rootConstraint = getRootConstraintOfValueGroup(valueGroup, typeConstraint); if(rootConstraint == null) return result; + TopicMap tm = rootConstraint.getTopicMap(); + Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm); + Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm); + Topic constrainedStatementAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedStatement, tm); + ArrayList typeTopics = new ArrayList(); if(isInstanceOf(rootConstraint, PSIs.TMCL.tmclTopicNameConstraint) || isInstanceOf(rootConstraint, PSIs.TMCL.tmclTopicOccurrenceConstraint)){ - TopicMap tm = rootConstraint.getTopicMap(); - Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm); - Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm); Topic nameType = getTopicByPsi(PSIs.TMCL.tmclNameType, tm); Topic occurrenceType = getTopicByPsi(PSIs.TMCL.tmclOccurrenceType, tm); - Topic constrainedStatementAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedStatement, tm); ArrayList nameTypeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedStatementAssocType, null, nameType, constrainedRoleType); ArrayList occurrenceTypeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedStatementAssocType, null, occurrenceType, constrainedRoleType); - ArrayList typeTopics = Utils.union(nameTypeTopics, occurrenceTypeTopics); - - if(typeTopics.size() != 1){ - throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(rootConstraint) + " must be bound extactly once to an occurrence or name type, but is: " + typeTopics.size()); - } else { - // add the direct specified type - result.add(typeTopics.get(0)); - - // get subtypes of typeTopic - JsArray allTopics = tm.getTopics(); - for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), typeTopics.get(0))) result.add(allTopics.get(i)); - } + typeTopics = Utils.union(nameTypeTopics, occurrenceTypeTopics); } else if(isInstanceOf(rootConstraint, PSIs.TMCL.tmclAssociationRoleConstraint)){ - // TODO: implement - throw new ExecutionException(PSIs.TMCL.tmclAssociationRoleConstraint + " is not implemented yet"); + Topic constrainedRoleAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedRole, tm); + Topic roleType = getTopicByPsi(PSIs.TMCL.tmclRoleType, tm); + typeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedRoleAssocType, null, roleType, constrainedRoleType); } else if(isInstanceOf(rootConstraint, PSIs.TMCL.tmclTopicRoleConstraint)){ - // TODO: implement - throw new ExecutionException(PSIs.TMCL.tmclTopicRoleConstraint + " is not implemented yet"); + Topic associationType = getTopicByPsi(PSIs.TMCL.tmclAssociationType, tm); + typeTopics = getOtherPlayerOfBinaryAssociation(rootConstraint, constraintRoleType, constrainedStatementAssocType, null, associationType, constrainedRoleType); + } + + if(typeTopics.size() != 1){ + throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(rootConstraint) + " must be bound extactly once to an occurrence or name type, but is: " + typeTopics.size()); + } else { + // add the direct specified type + result.add(typeTopics.get(0)); + + // get subtypes of typeTopic + JsArray allTopics = tm.getTopics(); + for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), typeTopics.get(0))) result.add(allTopics.get(i)); } return result;