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

[isidorus-cvs] r1022 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 26 Oct '11
by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
Author: lgiessmann
Date: Wed Oct 26 03:06:05 2011
New Revision: 1022
Log:
gdl-frontend: Widgets: refactored GdlVisibleObject.setReceivedData(...) and parted it to smaller sub-methods
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 26 02:11:12 2011 (r1021)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 26 03:06:05 2011 (r1022)
@@ -1891,218 +1891,292 @@
// of this control
public abstract void fixValue();
+
+ // sets the item-identifier-fields for the received data
+ private void setReceivedItemIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Reifiable) || !(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass());
+
+ // get type
+ Topic constrainedTopicType = TmHelper.getConstrainedTopicType(this.getConstraint());
- // sets the fields for the received data
- protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException {
- if(receivedData == null) return;
-
- if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
- if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
-
- Pattern rex = new Pattern(this.getLiteralValueForConstraint());
- for(int i = 0; i != ((Topic)receivedData).getSubjectIdentifiers().length(); ++i){
- String psi = ((Topic)receivedData).getSubjectIdentifiers().get(i).getReference();
- if(rex.matches(psi)){
- this.addSubItem(psi);
- }
+ int typeIdx = -1;
+ JsArray<Topic> types = null;
+ if((this.receivedData instanceof Topic)){
+ types = ((Topic)this.receivedData).getTypes();
+ if(types.length() != 0){
+ for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break;
}
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
- if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ }
+ if((this.receivedData instanceof Topic) && types != null && typeIdx != types.length()){
Pattern rex = new Pattern(this.getLiteralValueForConstraint());
- for(int i = 0; i != ((Topic)receivedData).getSubjectLocators().length(); ++i){
- String sl = ((Topic)receivedData).getSubjectLocators().get(i).getReference();
- if(rex.matches(sl)){
- this.addSubItem(sl);
+ Topic top = (Topic)this.receivedData;
+ for(int i = 0; i != top.getItemIdentifiers().length(); ++i){
+ String ii = top.getItemIdentifiers().get(i).getReference();
+ if(rex.matches(ii)){
+ this.addSubItem(ii);
}
}
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
- if(!(this.receivedData instanceof Reifiable) || !(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass());
-
- // get type
- Topic constrainedTopicType = TmHelper.getConstrainedTopicType(this.getConstraint());
+ } else {
+ // search for the topic type
+ Reifiable ref = null;
- int typeIdx = -1;
- JsArray<Topic> types = null;
- if((this.receivedData instanceof Topic)){
- types = ((Topic)this.receivedData).getTypes();
- if(types.length() != 0){
- for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break;
+ // search for the characteristics type
+ if(this.receivedData instanceof Topic){
+ JsArray<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
+ if(names.length() != 0){
+ ref = names.get(0);
+ } else {
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
+ if(occs.length() != 0) ref = occs.get(0);
}
+ } else if(this.receivedData instanceof Association){
+ JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
+ if(roles.length() != 0) ref = roles.get(0);
}
- if((this.receivedData instanceof Topic) && types != null && typeIdx != types.length()){
- Pattern rex = new Pattern(this.getLiteralValueForConstraint());
- Topic top = (Topic)this.receivedData;
- for(int i = 0; i != top.getItemIdentifiers().length(); ++i){
- String ii = top.getItemIdentifiers().get(i).getReference();
- if(rex.matches(ii)){
- this.addSubItem(ii);
- }
- }
- } else {
- // search for the topic type
- Reifiable ref = null;
-
- // search for the characteristics type
- if(this.receivedData instanceof Topic){
- JsArray<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
- if(names.length() != 0){
- ref = names.get(0);
- } else {
- JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
- if(occs.length() != 0) ref = occs.get(0);
- }
- } else if(this.receivedData instanceof Association){
- JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
- if(roles.length() != 0) ref = roles.get(0);
+ // search for item-identifiers of the found topic type or characteristics
+ Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+ for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
+ String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
+ if(rex.matches(ii)){
+ this.addSubItem(ii);
}
+ }
+ }
+ }
- // search for item-identifiers of the found topic type or characteristics
- Pattern rex = new Pattern(this.getLiteralValueForConstraint());
- for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
- String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
- if(rex.matches(ii)){
- this.addSubItem(ii);
- }
- }
+
+ // sets the reifier-fields for the received data
+ private void setReceivedReifier() throws InvalidGdlSchemaException, ExecutionException {
+ Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+
+ Topic reifier = null;
+ if(this.receivedData instanceof Topic){
+ JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
+ if(names.length() != 0) reifier = names.get(0).getReifier();
+ if(reifier == null){
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
+ if(occs.length() != 0) reifier = occs.get(0).getReifier();
}
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
- if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ } else if(this.receivedData instanceof Association){
+ if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+ } else {
+ throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+ }
- Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
- for(int i = 0; i != ((Topic)this.receivedData).getNames(nameType).length(); ++i)
- this.addSubItem(((Topic)this.receivedData).getNames(nameType).get(i).getValue());
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
- if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ String str = this.getTopicRepresentation(reifier, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
+ if(str == null) str = "";
+ this.addSubItem(str);
+ }
+
- Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint());
- for(int i = 0; i != ((Topic)this.receivedData).getOccurrences(occurrenceType).length(); ++i)
- this.addSubItem(((Topic)this.receivedData).getOccurrences(occurrenceType).get(i).getValue());
- } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
- Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+ // sets the scope-fields for the received data
+ private void setReceivedScope() throws InvalidGdlSchemaException, ExecutionException {
+ Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
- Topic reifier = null;
- if(this.receivedData instanceof Topic){
- JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
- if(names.length() != 0) reifier = names.get(0).getReifier();
- if(reifier == null){
- JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
- if(occs.length() != 0) reifier = occs.get(0).getReifier();
- }
- } else if(this.receivedData instanceof Association){
- if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
- } else {
- throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+ JsArray<Topic> scope = null;
+ if(this.receivedData instanceof Topic){
+ JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
+ if(names.length() != 0) scope = names.get(0).getScope();
+ if(scope == null){
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
+ if(occs.length() != 0) scope = occs.get(0).getScope();
}
+ } else if(this.receivedData instanceof Association){
+ if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
+ } else {
+ throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+ }
- String str = this.getTopicRepresentation(reifier, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
- if(str == null) str = "";
- this.addSubItem(str);
- } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ if(scope != null){
+ for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
+ }
+
+
+ // sets the type-fields for the received data
+ private void setReceivedType() throws InvalidGdlSchemaException, ExecutionException {
+ Topic type = null;
+ if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+ type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+ } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
+ type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+ } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
+ if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+ type = TmHelper.getConstrainedStatement(this.getRootConstraint());
+ } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclAssociationRoleConstraint)){
+ if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
+ type = TmHelper.getConstraintRoleOfConstraint(this.getRootConstraint());
+ } else {
+ String constraints = PSIs.TMCL.tmclTopicNameConstraint + ", " + PSIs.TMCL.tmclTopicOccurrenceConstraint + ", " + PSIs.TMCL.tmclTopicRoleConstraint + ", " + PSIs.TMCL.tmclAssociationRoleConstraint;
+ throw new ExecutionException("The topic " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to the following root constraints: " + constraints);
+ }
- ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
- if(variants.size() != 0){
- for (Variant variant : variants) {
- this.addSubItem(variant.getValue());
- }
- }
- else{
- this.addSubItem("");
- }
- } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
- Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
+ String str = this.getTopicRepresentation(type, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
+ if(str == null) str = "";
+ this.addSubItem(str);
+ }
+
+
+ // sets the variant-name-scope-fields for the received data
+ private void setReceivedVariantNameScope() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+
+ ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+ if(variants.size() != 0){
+ for(int i = 0; i != variants.get(0).getScope().length(); ++i) this.addSubItem(this.getTopicRepresentation(variants.get(0).getScope().get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
+ }
+
+
+ // sets the variant-name-reifier-fields for the received data
+ private void setReceivedVariantNameReifier() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+
+ ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+ if(variants.size() != 0 && variants.get(0).getReifier() != null){
+ this.addSubItem(this.getTopicRepresentation(variants.get(0).getReifier(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
+ }
+
+
+ // sets the subject-identifier and subjetc-locator-fields for the received data
+ private void setReceivedTopicIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- JsArray<Topic> scope = null;
- if(this.receivedData instanceof Topic){
- JsArray<Name> names = ((Topic)this.receivedData).getNames(type);
- if(names.length() != 0) scope = names.get(0).getScope();
- if(scope == null){
- JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(type);
- if(occs.length() != 0) scope = occs.get(0).getScope();
- }
- } else if(this.receivedData instanceof Association){
- if(((Association)this.receivedData).getType().equals(type)) type = ((Association)this.receivedData).getType();
- } else {
- throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a topic or association, but is: " + this.receivedData.getClass());
+ Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+
+ JsArray<Locator> identifiers = null;
+ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+ identifiers = ((Topic)receivedData).getSubjectIdentifiers();
+ }else {
+ identifiers = ((Topic)receivedData).getSubjectLocators();
+ }
+
+ for(int i = 0; i != identifiers.length(); ++i){
+ String id = identifiers.get(i).getReference();
+ if(rex.matches(id)){
+ this.addSubItem(id);
}
+ }
+ }
+
+
+ // sets the variant-name-fields for the received data
+ private void setReceivedVariantName() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- if(scope != null){
- for(int i = 0; i != scope.length(); ++i) this.addSubItem(this.getTopicRepresentation(scope.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
+ if(variants.size() != 0){
+ for (Variant variant : variants) {
+ this.addSubItem(variant.getValue());
}
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
- if(!(receivedData instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + receivedData.getClass());
- if(this.getRootConstraint() == null || !TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but ist bound to the root topic: " + (this.getRootConstraint() == null ? "null" : TmHelper.getAnyIdOfTopic(this.getRootConstraint())));
+ }
+ else{
+ this.addSubItem("");
+ }
+ }
+
+
+ // sets the role-player-fields for the received data
+ private void setReceivedRolePlayer() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(receivedData instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + receivedData.getClass());
+ if(this.getRootConstraint() == null || !TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but ist bound to the root topic: " + (this.getRootConstraint() == null ? "null" : TmHelper.getAnyIdOfTopic(this.getRootConstraint())));
- Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
- JsArray<Role> assocRoles = ((Association)this.receivedData).getRoles(roleAndPlayerType.getFirst());
- for(int i = 0; i != assocRoles.length(); ++i){
- if(TmHelper.isInstanceOf(assocRoles.get(i).getPlayer(), roleAndPlayerType.getSecond())){
- this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
- }
+ Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
+ JsArray<Role> assocRoles = ((Association)this.receivedData).getRoles(roleAndPlayerType.getFirst());
+ for(int i = 0; i != assocRoles.length(); ++i){
+ if(TmHelper.isInstanceOf(assocRoles.get(i).getPlayer(), roleAndPlayerType.getSecond())){
+ this.addSubItem(this.getTopicRepresentation(assocRoles.get(i).getPlayer(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
}
- } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
- Topic type = null;
- if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
- type = TmHelper.getConstrainedStatement(this.getRootConstraint());
- } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when a topic is processed, but is: " + this.receivedData.getClass());
- type = TmHelper.getConstrainedStatement(this.getRootConstraint());
- } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
- if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
- type = TmHelper.getConstrainedStatement(this.getRootConstraint());
- } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclAssociationRoleConstraint)){
- if(!(this.receivedData instanceof Association)) throw new ExecutionException("The constraints " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " and " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " are only valid when an association is processed, but is: " + this.receivedData.getClass());
- type = TmHelper.getConstraintRoleOfConstraint(this.getRootConstraint());
- } else {
- String constraints = PSIs.TMCL.tmclTopicNameConstraint + ", " + PSIs.TMCL.tmclTopicOccurrenceConstraint + ", " + PSIs.TMCL.tmclTopicRoleConstraint + ", " + PSIs.TMCL.tmclAssociationRoleConstraint;
- throw new ExecutionException("The topic " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to the following root constraints: " + constraints);
- }
-
- String str = this.getTopicRepresentation(type, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup());
- if(str == null) str = "";
- this.addSubItem(str);
- } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ }
+ }
+
+
+ // sets the variant-name-identifiers-fields for the received data
+ private void setReceivedVariantNameIdentifiers() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+ if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+
+ ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+ if(variants.size() != 0){
+ for(int i = 0; i != variants.get(0).getItemIdentifiers().length(); ++i) this.addSubItem(variants.get(0).getItemIdentifiers().get(i).getReference());
+ }
+ }
+
+
+ // sets the datatype-fields for the received data
+ private void setReceivedDatatype() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
- ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
- if(variants.size() != 0){
- this.addSubItem(variants.get(0).getDatatype().getReference());
- }
- } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){
- Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint());
- JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType);
- if(occs.length() != 0) this.addSubItem(occs.get(0).getDatatype().getReference());
- } else {
- throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + " or " + PSIs.TMCL.tmclOccurrenceConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
- }
- } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-
+ if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
if(variants.size() != 0){
- for(int i = 0; i != variants.get(0).getItemIdentifiers().length(); ++i) this.addSubItem(variants.get(0).getItemIdentifiers().get(i).getReference());
+ this.addSubItem(variants.get(0).getDatatype().getReference());
}
+ } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){
+ Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint());
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType);
+ if(occs.length() != 0) this.addSubItem(occs.get(0).getDatatype().getReference());
+ } else {
+ throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + " or " + PSIs.TMCL.tmclOccurrenceConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+ }
+ }
+
+
+ // sets the name- and occurrence-fields for the received data
+ private void setReceivedTopicCharacteristics() throws InvalidGdlSchemaException, ExecutionException {
+ if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+
+ Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
+
+ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+ for(int i = 0; i != ((Topic)this.receivedData).getNames(characteristicType).length(); ++i)
+ this.addSubItem(((Topic)this.receivedData).getNames(characteristicType).get(i).getValue());
+ } else {
+ for(int i = 0; i != ((Topic)this.receivedData).getOccurrences(characteristicType).length(); ++i)
+ this.addSubItem(((Topic)this.receivedData).getOccurrences(characteristicType).get(i).getValue());
+ }
+ }
+
+
+ // sets the fields for the received data
+ protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException {
+ if(receivedData == null) return;
+
+ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+ this.setReceivedTopicIdentifiers();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
+ this.setReceivedTopicIdentifiers();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
+ this.setReceivedItemIdentifiers();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+ this.setReceivedTopicCharacteristics();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+ this.setReceivedTopicCharacteristics();
+ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
+ this.setReceivedReifier();
+ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
+ this.setReceivedVariantName();
+ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
+ this.setReceivedScope();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
+ this.setReceivedRolePlayer();
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
+ this.setReceivedType();
+ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){
+ this.setReceivedDatatype();
+ } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
+ this.setReceivedVariantNameIdentifiers();
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-
- ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
- if(variants.size() != 0 && variants.get(0).getReifier() != null){
- this.addSubItem(this.getTopicRepresentation(variants.get(0).getReifier(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
- }
+ this.setReceivedVariantNameReifier();
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
- if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
- if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a constraint of the type " + PSIs.TMCL.tmclVariantNameConstraint + ", but is bound to: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
-
- ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
- if(variants.size() != 0){
- for(int i = 0; i != variants.get(0).getScope().length(); ++i) this.addSubItem(this.getTopicRepresentation(variants.get(0).getScope().get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
- }
+ this.setReceivedVariantNameScope();
} else {
throw new InvalidGdlSchemaException("The constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not suported to be bound to the value group instance " + TmHelper.getAnyIdOfTopic(this.getValueGroup()));
}
@@ -2393,7 +2467,6 @@
}
-
// returns the actual topics that are set as possible tm-values
private ArrayList<Topic> getRawTmValues() throws InvalidGdlSchemaException{
if(this.rawTmValuesSet){
@@ -2606,6 +2679,68 @@
contents.add(new Pair<Object, TopicMapsTypes>(changedConstruct, isOccConstraint ? TopicMapsTypes.Occurrence : TopicMapsTypes.Name));
}
+
+ // handles the getContent call for subject identifiers and subject locators
+ private void getVariantNameContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ // TODO: implement
+
+ /*JsArray<Locator> identifiers = null;
+
+ ArrayList<Locator> filteredIdentifiers = null;
+ boolean isPsiConstraint = false;
+ if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+ isPsiConstraint = true;
+ identifiers = carrier.getSubjectIdentifiers();
+ filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
+ } else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
+ identifiers = carrier.getSubjectLocators();
+ filteredIdentifiers = this.filterLocators(TmHelper.getRegExp(this.getConstraint()), identifiers);
+ } else {
+ throw new ExecutionException("Only the constraints " + PSIs.TMCL.tmclSubjectIdentifierConstraint + " and " + PSIs.TMCL.tmclSubjectLocatorConstraint + " are supported by the function getTopicIdentifierContent");
+ }
+
+ Locator changedIdentifier = null;
+ if(validate) this.validateLiteralValue(this.getSelectedValues().get(selectedValueIndex));
+
+ if(filteredIdentifiers.size() > selectedValueIndex){
+ changedIdentifier = filteredIdentifiers.get(selectedValueIndex);
+ if(isPsiConstraint) carrier.removeSubjectIdentifier(changedIdentifier);
+ else carrier.removeSubjectLocator(changedIdentifier);
+ }
+
+ changedIdentifier = carrier.getTopicMap().createLocator(this.getSelectedValues().get(selectedValueIndex));
+ if(isPsiConstraint) carrier.addSubjectIdentifier(changedIdentifier);
+ else carrier.addSubjectLocator(changedIdentifier);
+ contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+ */
+ }
+
+
+ // handles the getContent call for role players
+ private void getRolePlayerContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Association carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint))throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
+ Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
+ Topic roleType = roleAndPlayerType.getFirst();
+ Topic playerType = roleAndPlayerType.getSecond();
+
+ JsArray<Role> typedRoles = carrier.getRoles(roleType);
+ ArrayList<Role> roles = new ArrayList<Role>();
+ for(int i = 0; i != typedRoles.length(); ++i)
+ if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i));
+
+ Role changedRole = null;
+
+ Topic player = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+ if(validate) this.validateTmValue(player);
+ if(roles.size() > selectedValueIndex){
+ changedRole = roles.get(selectedValueIndex);
+ changedRole.setPlayer(player);
+ } else {
+ changedRole = carrier.createRole(roleType, player);
+ }
+ contents.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
+ }
+
// returns the actual data that is hold by this instance
public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
@@ -2628,7 +2763,8 @@
if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
- // TODO: implement
+ if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
+ this.getVariantNameContent(result, validate, (Topic)localCarrier, idx);
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
// TODO: implement
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclReifierConstraint)){
@@ -2650,27 +2786,7 @@
this.getTopicCharacteristicContent(result, validate, (Topic)localCarrier, idx);
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass());
- if(!TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint))throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a root constraint of the type " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()));
- Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
- Topic roleType = roleAndPlayerType.getFirst();
- Topic playerType = roleAndPlayerType.getSecond();
-
- JsArray<Role> typedRoles = ((Association)localCarrier).getRoles(roleType);
- ArrayList<Role> roles = new ArrayList<Role>();
- for(int i = 0; i != typedRoles.length(); ++i)
- if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i));
-
- Role changedRole = null;
-
- Topic player = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(idx), this.getValueGroup());
- if(validate) this.validateTmValue(player);
- if(roles.size() > idx){
- changedRole = roles.get(idx);
- changedRole.setPlayer(player);
- } else {
- changedRole = ((Association)localCarrier).createRole(roleType, player);
- }
- result.add(new Pair<Object, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
+ this.getRolePlayerContent(result, validate, (Association)localCarrier, idx);
} else {
throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " is not supported");
}
1
0

[isidorus-cvs] r1021 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets
by lgiessmann@common-lisp.net 26 Oct '11
by lgiessmann@common-lisp.net 26 Oct '11
26 Oct '11
Author: lgiessmann
Date: Wed Oct 26 02:11:12 2011
New Revision: 1021
Log:
gdl-frontend: Widgets: implemented additional functionality for the gdlt:Variant-Name-Scope and gdlt:Variant-Name-Reifier semantics for generating content entered in GdlVisibleObject
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 09:29:07 2011 (r1020)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Oct 26 02:11:12 2011 (r1021)
@@ -2560,7 +2560,7 @@
Variant variant = possibleVariants.get(0);
Topic reifier = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
- if(reifier != null) variant.setReifier(reifier);
+ if(reifier != null && !variant.getReifier().equals(reifier)) variant.setReifier(reifier);
contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
}
}
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 25 09:29:07 2011 (r1020)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Oct 26 02:11:12 2011 (r1021)
@@ -1139,7 +1139,7 @@
}
- // returns the topic that can be used to satisfy the passed type-constraint.
+ // returns the topics that can be used to satisfy the passed type-constraint.
public static ArrayList<Topic> getTmValuesForTypeConstraint(Topic typeConstraint, Topic valueGroup) throws InvalidGdlSchemaException, ExecutionException {
ArrayList<Topic> result = new ArrayList<Topic>();
if(typeConstraint == null || valueGroup == null) return result;
@@ -1180,7 +1180,7 @@
}
- // returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
+ // returns the topics that can be used to satisfy the passed variant-name-reifier-constraint.
public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException {
ArrayList<Topic> result = new ArrayList<Topic>();
if(variantNameReifierConstraint == null) return result;
@@ -1199,9 +1199,8 @@
// get subtypes of typeTopic
JsArray<Topic> allTopics = tm.getTopics();
- for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
+ for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
}
-
return result;
}
@@ -1225,7 +1224,7 @@
// get subtypes of typeTopic
JsArray<Topic> allTopics = tm.getTopics();
- for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
+ for(int i = 0; i != allTopics.length(); ++i) if(isInstanceOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
}
return result;
Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Tue Oct 25 09:29:07 2011 (r1020)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Oct 26 02:11:12 2011 (r1021)
@@ -419,7 +419,8 @@
{"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-scope-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-scope-text]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-scope-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-scope-constraint]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-scope-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]},
-
+ {"type":"si:[tmcl:constrained-scope]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-variant-name-scope-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Scope-Type]"}]},
+
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]},
{"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-scope-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]},
{"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-iis-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-iis-text]"}]},
@@ -431,6 +432,8 @@
{"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[gdlsrv:service-variant-name-reifier-text-value-group]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-reifier-constraint]"}]},
{"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[gdl:tm-construct]", "player":"si:[model:service-variant-name-constraint]"}]},
+ {"type":"si:[tmcl:allowed-reifier]", "roles":[{"type":"si:[tmcl:allows]", "player":"si:[model:service-variant-name-reifier-constraint]"},{"type":"si:[tmcl:allowed]", "player":"si:[types:Reifier-Type]"}]},
+
{"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[gdlsrv:service-default-editor-topic-view]"},{"type":"si:[gdl:containee]", "player":"si:[gdlsrv:service-editor-commit-button]"}]},
{"type":"si:[gdl:position]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[gdlsrv:service-editor-commit-button-position]"},{"type":"si:[gdl:ancestor]", "player":"si:[gdlsrv:service-variant-name-reifier-text]"},{"type":"si:[gdl:descendant]", "player":"si:[gdlsrv:service-editor-commit-button]"}]}
1
0

[isidorus-cvs] r1020 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 09:29:07 2011
New Revision: 1020
Log:
gdl-frontend: Widgets: updated the GDL-Schema => gdlt:Variant-Name-Scope and gdlt:Variant-Name-Reifier, so it is possible to select the corresponding topic types of these constraints directly in the schema instance
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 06:23:37 2011 (r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Oct 25 09:29:07 2011 (r1020)
@@ -2003,8 +2003,14 @@
if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint());
- if(variants.size() != 0) this.addSubItem(variants.get(0).getValue());
- else this.addSubItem("");
+ if(variants.size() != 0){
+ for (Variant variant : variants) {
+ this.addSubItem(variant.getValue());
+ }
+ }
+ else{
+ this.addSubItem("");
+ }
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){
Topic type = TmHelper.getConstrainedStatement(this.getConstraint());
@@ -2547,6 +2553,19 @@
}
+ // handles the getContent call for item identifiers of variant-names
+ private void getVariantReifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());
+ if(possibleVariants.size() != 0){
+ Variant variant = possibleVariants.get(0);
+ Topic reifier = TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(selectedValueIndex), this.getValueGroup());
+
+ if(reifier != null) variant.setReifier(reifier);
+ contents.add(new Pair<Object, TopicMapsTypes>(variant, TopicMapsTypes.Variant));
+ }
+ }
+
+
// handles the getContent call for occurrence and name values
private void getTopicCharacteristicContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
@@ -2621,7 +2640,8 @@
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){
// TODO: implement
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){
- // TODO: implement
+ if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
+ this.getVariantReifierContent(result, validate, (Topic)localCarrier, idx);
} else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){
if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
this.getVariantIdentifierContent(result, validate, (Topic)localCarrier, idx);
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Oct 25 06:23:37 2011 (r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Oct 25 09:29:07 2011 (r1020)
@@ -4,6 +4,7 @@
import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback;
@@ -68,6 +69,8 @@
Window.alert(((Occurrence)construct.getFirst()).getValue() + " >> " + construct.getSecond());
} else if(construct.getSecond().equals(TopicMapsTypes.Name)){
Window.alert(((Name)construct.getFirst()).getValue() + " >> " + construct.getSecond());
+ } else if(construct.getSecond().equals(TopicMapsTypes.Variant)){
+ Window.alert(TmHelper.getAnyIdOfTopic(((Variant)construct.getFirst()).getReifier()) + " >> " + construct.getSecond());
} else {
Window.alert(construct.getFirst() + " >> " + construct.getSecond());
}
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 25 06:23:37 2011 (r1019)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Tue Oct 25 09:29:07 2011 (r1020)
@@ -1181,16 +1181,54 @@
// returns the topic that can be used to satisfy the passed variant-name-reifier-constraint.
- public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException {
- // TODO: implement
- throw new ExecutionException("this mehtod is currently not implemented");
+ public static ArrayList<Topic> getTmValuesForVariantNameReifierConstraint(Topic variantNameReifierConstraint) throws ExecutionException, InvalidGdlSchemaException {
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(variantNameReifierConstraint == null) return result;
+
+ TopicMap tm = variantNameReifierConstraint.getTopicMap();
+ Topic allowedRoleType = getTopicByPsi(PSIs.TMCL.tmclAllowed, tm);
+ Topic allowsRoleType = getTopicByPsi(PSIs.TMCL.tmclAllows, tm);
+ Topic allowedReifierAssocType = getTopicByPsi(PSIs.TMCL.tmclAllowedReifier, tm);
+ ArrayList<Topic> reifierTypeTopics = getOtherPlayerOfBinaryAssociation(variantNameReifierConstraint, allowsRoleType, allowedReifierAssocType, null, allowedRoleType);
+
+ if(reifierTypeTopics.size() != 1){
+ throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameReifierConstraint) + " must be bound extactly once to a topic type, but is: " + reifierTypeTopics.size());
+ } else {
+ // add the direct specified type
+ result.add(reifierTypeTopics.get(0));
+
+ // get subtypes of typeTopic
+ JsArray<Topic> allTopics = tm.getTopics();
+ for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), reifierTypeTopics.get(0))) result.add(allTopics.get(i));
+ }
+
+ return result;
}
// returns the topic that can be used to satisfy the passed variant-name-scope-constraint.
- public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException{
- // TODO: implement
- throw new ExecutionException("this method is currently not implemented");
+ public static ArrayList<Topic> getTmValuesForVariantNameScopeConstraint(Topic variantNameScopeConstraint) throws ExecutionException, InvalidGdlSchemaException{
+ ArrayList<Topic> result = new ArrayList<Topic>();
+ if(variantNameScopeConstraint == null) return result;
+
+ TopicMap tm = variantNameScopeConstraint.getTopicMap();
+ Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm);
+ Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm);
+ Topic constrainedScopeAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedScope, tm);
+ ArrayList<Topic> scopeTypeTopics = getOtherPlayerOfBinaryAssociation(variantNameScopeConstraint, constraintRoleType, constrainedScopeAssocType, null, constrainedRoleType);
+
+ if(scopeTypeTopics.size() != 1){
+ throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameScopeConstraint) + " must be bound extactly once to a topic type, but is: " + scopeTypeTopics.size());
+ } else {
+ // add the direct specified type
+ result.add(scopeTypeTopics.get(0));
+
+ // get subtypes of typeTopic
+ JsArray<Topic> allTopics = tm.getTopics();
+ for(int i = 0; i != allTopics.length(); ++i) if(isSupertypeOf(allTopics.get(i), scopeTypeTopics.get(0))) result.add(allTopics.get(i));
+ }
+
+ return result;
}
1
0

[isidorus-cvs] r1019 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 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<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ private void getTopicIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
JsArray<Locator> identifiers = null;
ArrayList<Locator> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
}
// handles the getContent call for item identifiers
- private void getItemIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Construct carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ private void getItemIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> 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<Topic> 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<Locator> identifiers = null;
ArrayList<Locator> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
} else {
// search for the topic type
Reifiable ref = null;
// search for the characteristics type
- if(carier instanceof Topic){
- JsArray<Name> names = ((Topic)carier).getNames(constrainedTopicType);
+ if(carrier instanceof Topic){
+ JsArray<Name> names = ((Topic)carrier).getNames(constrainedTopicType);
if(names.length() != 0){
ref = names.get(0);
} else {
- JsArray<Occurrence> occs = ((Topic)carier).getOccurrences(constrainedTopicType);
+ JsArray<Occurrence> occs = ((Topic)carrier).getOccurrences(constrainedTopicType);
if(occs.length() != 0) ref = occs.get(0);
}
- } else if(carier instanceof Association){
- JsArray<Role> roles = ((Association)carier).getRoles(constrainedTopicType);
+ } else if(carrier instanceof Association){
+ JsArray<Role> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
}
}
- // handles the getContent call for item identifiers of varian-names
- private void getVariantIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
- ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carier, this.getRootConstraint());
+ // handles the getContent call for item identifiers of variant-names
+ private void getVariantIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carrier, this.getRootConstraint());
if(possibleVariants.size() != 0){
Variant variant = possibleVariants.get(0);
JsArray<Locator> identifiers = null;
@@ -2545,7 +2545,48 @@
contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
}
}
+
+
+ // handles the getContent call for occurrence and name values
+ private void getTopicCharacteristicContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carrier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ Topic characteristicType = TmHelper.getConstrainedStatement(this.getConstraint());
+
+ 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<Name> names = null;
+ JsArray<Occurrence> 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<Object, TopicMapsTypes>(changedConstruct, isOccConstraint ? TopicMapsTypes.Occurrence : TopicMapsTypes.Name));
+ }
+
// returns the actual data that is hold by this instance
public ArrayList<Pair<Object, TopicMapsTypes>> 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<Name> 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<Object, TopicMapsTypes>(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<Occurrence> 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<Object, TopicMapsTypes>(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());
}
1
0

[isidorus-cvs] r1018 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 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<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ ArrayList<Variant> possibleVariants = TmHelper.getVariantsForConstraint(carier, this.getRootConstraint());
+ if(possibleVariants.size() != 0){
+ Variant variant = possibleVariants.get(0);
+ JsArray<Locator> identifiers = null;
+
+ ArrayList<Locator> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+ }
+ }
+
+
// returns the actual data that is hold by this instance
public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
@@ -2553,21 +2580,22 @@
}
result.add(new Pair<Object, TopicMapsTypes>(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());
1
0

[isidorus-cvs] r1017 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 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<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ private void getItemIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> 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<Topic> 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<Locator> identifiers = null;
-
-
-
+ ArrayList<Locator> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+ } else {
+ // search for the topic type
+ Reifiable ref = null;
+
+ // search for the characteristics type
+ if(carier instanceof Topic){
+ JsArray<Name> names = ((Topic)carier).getNames(constrainedTopicType);
+ if(names.length() != 0){
+ ref = names.get(0);
+ } else {
+ JsArray<Occurrence> occs = ((Topic)carier).getOccurrences(constrainedTopicType);
+ if(occs.length() != 0) ref = occs.get(0);
+ }
+ } else if(carier instanceof Association){
+ JsArray<Role> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+ }
}
1
0

[isidorus-cvs] r1016 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 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<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
- if(names.length() != 0){
- ref = names.get(0);
- } else {
- JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
- if(occs.length() != 0) ref = occs.get(0);
+ int typeIdx = -1;
+ JsArray<Topic> types = null;
+ if((this.receivedData instanceof Topic)){
+ types = ((Topic)this.receivedData).getTypes();
+ if(types.length() != 0){
+ for(typeIdx = 0; typeIdx != types.length(); ++typeIdx) if(types.get(typeIdx).equals(constrainedTopicType)) break;
}
- } else if(this.receivedData instanceof Association){
- JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
- if(roles.length() != 0) ref = roles.get(0);
}
- // search for item-identifiers of the found topic type or characteristics
- Pattern rex = new Pattern(this.getLiteralValueForConstraint());
- for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
- String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
- if(rex.matches(ii)){
- this.addSubItem(ii);
+ if((this.receivedData instanceof Topic) && types != null && typeIdx != types.length()){
+ Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+ Topic top = (Topic)this.receivedData;
+ for(int i = 0; i != top.getItemIdentifiers().length(); ++i){
+ String ii = top.getItemIdentifiers().get(i).getReference();
+ if(rex.matches(ii)){
+ this.addSubItem(ii);
+ }
+ }
+ } else {
+ // search for the topic type
+ Reifiable ref = null;
+
+ // search for the characteristics type
+ if(this.receivedData instanceof Topic){
+ JsArray<Name> names = ((Topic)this.receivedData).getNames(constrainedTopicType);
+ if(names.length() != 0){
+ ref = names.get(0);
+ } else {
+ JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(constrainedTopicType);
+ if(occs.length() != 0) ref = occs.get(0);
+ }
+ } else if(this.receivedData instanceof Association){
+ JsArray<Role> roles = ((Association)this.receivedData).getRoles(constrainedTopicType);
+ if(roles.length() != 0) ref = roles.get(0);
+ }
+
+ // search for item-identifiers of the found topic type or characteristics
+ Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+ for(int i = 0; i != ((ReifiableStub)ref).getItemIdentifiers().length(); ++i){
+ String ii = ((ReifiableStub)ref).getItemIdentifiers().get(i).getReference();
+ if(rex.matches(ii)){
+ this.addSubItem(ii);
+ }
}
}
} 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<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
JsArray<Locator> identifiers = null;
@@ -2428,6 +2448,15 @@
contents.add(new Pair<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
}
+
+ // handles the getContent call for item identifiers
+ private void getItemIdentifierContent(ArrayList<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ JsArray<Locator> identifiers = null;
+
+
+
+ }
+
// returns the actual data that is hold by this instance
public ArrayList<Pair<Object, TopicMapsTypes>> 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);
1
0

[isidorus-cvs] r1015 - in trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment isidorus view
by lgiessmann@common-lisp.net 25 Oct '11
by lgiessmann@common-lisp.net 25 Oct '11
25 Oct '11
Author: lgiessmann
Date: Tue Oct 25 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<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
- data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
+ ArrayList<Pair<Object, TopicMapsTypes>> data = new ArrayList<Pair<Object,TopicMapsTypes>>();
+ data.add(new Pair<Object, TopicMapsTypes>(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<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
- data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
+ ArrayList<Pair<Object, TopicMapsTypes>> data = new ArrayList<Pair<Object,TopicMapsTypes>>();
+ data.add(new Pair<Object, TopicMapsTypes>(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<Pair<Construct, TopicMapsTypes>> getContent(boolean validate) throws Exception {
+ public ArrayList<Pair<Object, TopicMapsTypes>> 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<String> 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<Pattern> validLiteralValues = new ArrayList<Pattern>();
- 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<Pattern> validLiteralValues = new ArrayList<Pattern>();
+ 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<Locator> filterLocators(String pattern, JsArray<Locator> locators){
+ ArrayList<Locator> result = new ArrayList<Locator>();
+ 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<Pair<Object, TopicMapsTypes>> contents, boolean validate, Topic carier, int selectedValueIndex) throws InvalidGdlSchemaException, InvalidContentException, ExecutionException{
+ JsArray<Locator> identifiers = null;
+
+ ArrayList<Locator> 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<Object, TopicMapsTypes>(changedIdentifier, TopicMapsTypes.Locator));
+ }
+
// returns the actual data that is hold by this instance
- public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
- ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+ public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
+ ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
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<Name> names = ((Topic)localCarrier).getNames(nameType);
@@ -2409,8 +2459,7 @@
}else {
changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null);
}
-
- result.add(new Pair<Construct, TopicMapsTypes>(changedName, TopicMapsTypes.Name));
+ result.add(new Pair<Object, TopicMapsTypes>(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<Construct, TopicMapsTypes>(changedOccurrence, TopicMapsTypes.Occurrence));
+ result.add(new Pair<Object, TopicMapsTypes>(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<Construct, TopicMapsTypes>(changedRole, TopicMapsTypes.Role));
+ result.add(new Pair<Object, TopicMapsTypes>(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<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
- Window.alert("not implemented yet :-(");
+ public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
+ for (Pair<Object, TopicMapsTypes> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
+ public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> 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<Topic> occurrenceTypes = getOtherPlayerOfBinaryAssociation(constraint, constraintRoleType, constrainedStatementAssocType, null, occurrenceType, constrainedRoleType);
ArrayList<Topic> 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<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine);
+ public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId);
+ public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> 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<Pair<Construct, TopicMapsTypes>> constructs, String buttonId, TmEngine tmEngine) {
+ public void commitTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
+ private void commitCreatedEnvironment(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
final String carrierPsi = PSIs.GDL.gdl + "environment_default_creator_topic_view_id";
ArrayList<Topic> topics = new ArrayList<Topic>();
ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
- for (Pair<Construct, TopicMapsTypes> construct : constructs) {
+ for (Pair<Object, TopicMapsTypes> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{
+ private void commitCreatedHashObject(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine, boolean edited) throws ExporterException{
final String carrierPsi = PSIs.GDL.gdl + "hash_object_default_creator_topic_view_id";
ArrayList<Topic> topics = new ArrayList<Topic>();
ArrayList<Association> associations = new ArrayList<Association>();
ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
- for (Pair<Construct, TopicMapsTypes> construct : constructs) {
+ for (Pair<Object, TopicMapsTypes> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
+ public void deleteTmConstruct(ArrayList<Pair<Object, TopicMapsTypes>> 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<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine){
- for (Pair<Construct, TopicMapsTypes> pair : constructs) {
+ private void deleteTopic(ArrayList<Pair<Object, TopicMapsTypes>> constructs, TmEngine tmEngine){
+ for (Pair<Object, TopicMapsTypes> 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<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{
- ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+ public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException{
+ ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
for (Widget ctrl : this.subElements) {
if(ctrl instanceof ButtonableObject){
if(((ButtonableObject)ctrl).getMainObject() instanceof AssociationItem){
- for (Pair<Construct, TopicMapsTypes> pair : ((AssociationItem)((ButtonableObject)ctrl).getMainObject()).getContent(null, validate)) {
+ for (Pair<Object, TopicMapsTypes> 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<Construct, TopicMapsTypes> pair : result) {
+ for (Pair<Object, TopicMapsTypes> pair : result) {
if(pair.getSecond().equals(TopicMapsTypes.Association)){
Association assoc = (Association)pair.getFirst();
JsArray<Role> roles = assoc.getRoles(roleType);
@@ -276,8 +276,8 @@
@Override
- public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
- ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+ public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
+ ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
Association localCarrier = this.getRepresentedAssociation();
@@ -286,7 +286,7 @@
((GdlVisibleObject)ctrl).getContent(localCarrier, validate);
}
}
- result.add(new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Association));
+ result.add(new Pair<Object, TopicMapsTypes>(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<Construct, TopicMapsTypes> pair, ArrayList<Pair<Construct, TopicMapsTypes>> container){
+ private boolean indirectlyContained(Pair<Object, TopicMapsTypes> pair, ArrayList<Pair<Object, TopicMapsTypes>> 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<Construct, TopicMapsTypes> item : container) {
+ for (Pair<Object, TopicMapsTypes> item : container) {
if(item.getSecond().equals(TopicMapsTypes.Topic)){
JsArray<Name> 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<Construct, TopicMapsTypes> item : container) {
+ for (Pair<Object, TopicMapsTypes> item : container) {
if(item.getSecond().equals(TopicMapsTypes.Name)){
JsArray<Variant> variants = ((Name)item.getFirst()).getVariants();
if(Utils.contains(variants, variant)) return true;
}
}
- for (Pair<Construct, TopicMapsTypes> item : container) {
+ for (Pair<Object, TopicMapsTypes> item : container) {
if(item.getSecond().equals(TopicMapsTypes.Topic)){
JsArray<Name> 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<Construct, TopicMapsTypes> item : container) {
+ for (Pair<Object, TopicMapsTypes> item : container) {
if(item.getSecond().equals(TopicMapsTypes.Topic)){
JsArray<Occurrence> 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<Construct, TopicMapsTypes> item : container) {
+ for (Pair<Object, TopicMapsTypes> item : container) {
if(item.getSecond().equals(TopicMapsTypes.Association)){
JsArray<Role> roles = ((Association)item.getFirst()).getRoles();
if(Utils.contains(roles, role)) return true;
@@ -143,18 +143,18 @@
@SuppressWarnings("unchecked")
@Override
- public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
- ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+ public ArrayList<Pair<Object, TopicMapsTypes>> getContent(Construct carrier, boolean validate) throws InvalidGdlSchemaException, ExecutionException, InvalidContentException {
+ ArrayList<Pair<Object, TopicMapsTypes>> result = new ArrayList<Pair<Object,TopicMapsTypes>>();
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<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
+ if(i == result.size()) result.add(new Pair<Object, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
if(ctrl instanceof GdlVisibleObject){
- for (Pair<Construct, TopicMapsTypes> pair : ((GdlVisibleObject)ctrl).getContent(localCarrier, validate)) {
+ for (Pair<Object, TopicMapsTypes> 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<Topic>)JsArray.createArray());
- Pair<Construct, TopicMapsTypes> newItem = new Pair<Construct, TopicMapsTypes>(occ, TopicMapsTypes.Occurrence);
+ Pair<Object, TopicMapsTypes> newItem = new Pair<Object, TopicMapsTypes>(occ, TopicMapsTypes.Occurrence);
if(!this.indirectlyContained(newItem, result)) result.add(newItem);
}
}
1
0

[isidorus-cvs] r1014 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base war/gdl_widgets
by lgiessmann@common-lisp.net 20 Oct '11
by lgiessmann@common-lisp.net 20 Oct '11
20 Oct '11
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<Topic> 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<Name> 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<Construct, TopicMapsTypes>(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<Occurrence> 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<Construct, TopicMapsTypes>(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<Topic, Topic> 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<Construct, TopicMapsTypes>(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
1
0

[isidorus-cvs] r1013 - trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base
by lgiessmann@common-lisp.net 20 Oct '11
by lgiessmann@common-lisp.net 20 Oct '11
20 Oct '11
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<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint());
+ if(variants.size() != 0 && variants.get(0).getReifier() != null){
+ this.addSubItem(this.getTopicRepresentation(variants.get(0).getReifier(), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
} 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()));
1
0