Changeset 1012 for trunk/src/anaToMia/GDL_Widgets
- Timestamp:
- 10/20/11 07:47:07 (14 years ago)
- Location:
- trunk/src/anaToMia/GDL_Widgets
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ¶
r1011 r1012 1982 1982 if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); 1983 1983 1984 Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); 1985 JsArray<Name> names = ((Topic)this.receivedData).getNames(nameType); 1986 Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); 1987 JsArray<Variant> variants = names.get(0).getVariants(); 1988 1989 for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ 1990 if(variants.get(varIdx).getScope().length() != 0){ 1991 JsArray<Topic> scopes = variants.get(varIdx).getScope(); 1992 int scopeIdx = 0; 1993 for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; 1994 1995 if(scopeIdx != scopes.length()){ 1996 this.addSubItem(variants.get(varIdx).getValue()); 1997 break; 1998 } 1999 } 2000 } 1984 ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getConstraint()); 1985 if(variants.size() != 0) this.addSubItem(variants.get(0).getValue()); 1986 else this.addSubItem(""); 2001 1987 } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclScopeConstraint)){ 2002 1988 Topic type = TmHelper.getConstrainedStatement(this.getConstraint()); … … 2053 2039 this.addSubItem(str); 2054 2040 } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlDatatype)){ 2055 // TODO: implement: Datatype 2041 if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); 2042 2043 if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){ 2044 ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint()); 2045 if(variants.size() != 0){ 2046 this.addSubItem(variants.get(0).getDatatype().getReference()); 2047 } 2048 } else if(TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclOccurrenceConstraint)){ 2049 Topic occType = TmHelper.getConstrainedStatement(this.getRootConstraint()); 2050 JsArray<Occurrence> occs = ((Topic)this.receivedData).getOccurrences(occType); 2051 if(occs.length() != 0) this.addSubItem(occs.get(0).getDatatype().getReference()); 2052 } else { 2053 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())); 2054 } 2056 2055 } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameIdentifiers)){ 2057 // TODO: implement: Variant-Name-Identifiers 2056 if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); 2057 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())); 2058 2059 ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint()); 2060 if(variants.size() != 0){ 2061 for(int i = 0; i != variants.get(0).getItemIdentifiers().length(); ++i) this.addSubItem(variants.get(0).getItemIdentifiers().get(i).getReference()); 2062 } 2058 2063 } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameReifier)){ 2064 if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); 2065 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())); 2066 2059 2067 // TODO: implement: Variant-Name-Reifier 2060 2068 } else if (TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlVariantNameScope)){ 2061 2069 if(!(this.receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass()); 2062 2063 Topic nameType = TmHelper.getConstrainedStatement(this.getRootConstraint()); 2064 JsArray<Name> names = ((Topic)this.receivedData).getNames(nameType); 2065 Topic scope = TmHelper.getConstrainedScopeTopic(this.getRootConstraint()); 2066 JsArray<Variant> variants = names.get(0).getVariants(); 2067 2068 for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ 2069 if(variants.get(varIdx).getScope().length() != 0){ 2070 JsArray<Topic> scopes = variants.get(varIdx).getScope(); 2071 int scopeIdx = 0; 2072 for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; 2073 2074 if(scopeIdx != scopes.length()){ 2075 for(int i = 0; i != scopes.length(); ++i) this.addSubItem(this.getTopicRepresentation(scopes.get(i), this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup())); 2076 } 2077 } 2070 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())); 2071 2072 ArrayList<Variant> variants = TmHelper.getVariantsForConstraint((Topic)this.receivedData, this.getRootConstraint()); 2073 if(variants.size() != 0){ 2074 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())); 2078 2075 } 2079 2076 } else { -
TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java ¶
r1010 r1012 22 22 public final static String tmclRoleType = tmcl + "role-type"; 23 23 public final static String tmclConstraint = tmcl + "constraint"; 24 public final static String tmclOccurrenceConstraint = tmcl + "occurrence-constraint"; 24 25 public final static String tmclConstrained = tmcl + "constrained"; 25 26 public final static String tmclConstrainedStatement = tmcl + "constrained-statement"; -
TabularUnified trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java ¶
r1010 r1012 13 13 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; 14 14 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; 15 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant; 15 16 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; 16 17 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; … … 1499 1500 else return null; 1500 1501 } 1502 1503 1504 // Returns all variants of a topic that satisfies the passed constraint. 1505 public static ArrayList<Variant> getVariantsForConstraint(Topic owner, Topic constraint) throws InvalidGdlSchemaException { 1506 ArrayList<Variant> result = new ArrayList<Variant>(); 1507 if(owner == null || constraint == null) return result; 1508 1509 Topic nameType = TmHelper.getConstrainedStatement(constraint); 1510 JsArray<Name> names = owner.getNames(nameType); 1511 Topic scope = TmHelper.getConstrainedScopeTopic(constraint); 1512 1513 for(int nameIdx = 0; nameIdx != names.length(); ++nameIdx){ 1514 JsArray<Variant> variants = names.get(nameIdx).getVariants(); 1515 for(int varIdx = 0; varIdx != variants.length(); ++varIdx){ 1516 if(variants.get(varIdx).getScope().length() != 0){ 1517 JsArray<Topic> scopes = variants.get(varIdx).getScope(); 1518 int scopeIdx = 0; 1519 for( ; scopeIdx != scopes.length(); ++scopeIdx) if(scopes.get(scopeIdx).equals(scope)) break; 1520 1521 if(scopeIdx != scopes.length()) result.add(variants.get(varIdx)); 1522 } 1523 } 1524 } 1525 1526 return result; 1527 } 1528 1501 1529 } -
TabularUnified trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm ¶
r1010 r1012 223 223 224 224 {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_ii_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, 225 {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"4 30px"}, {"type":"si:[gdl:left]", "value":"10px"}]},225 {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"450px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, 226 226 {"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, 227 227 {"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]}, 228 228 229 229 {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]}, 230 {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"4 70px"}, {"type":"si:[gdl:left]", "value":"10px"}]},230 {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"490px"}, {"type":"si:[gdl:left]", "value":"10px"}]}, 231 231 {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]}, 232 232 {"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]},
Note: See TracChangeset
for help on using the changeset viewer.