|
From: <mcu...@us...> - 2007-09-10 22:52:53
|
Revision: 1113
http://orm.svn.sourceforge.net/orm/?rev=1113&view=rev
Author: mcurland
Date: 2007-09-10 15:52:52 -0700 (Mon, 10 Sep 2007)
Log Message:
-----------
Fixes some bugs with name generation. refs #334
Modified Paths:
--------------
trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs
trunk/RelationalModel/OialDcilBridge/NameGeneration.cs
Modified: trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs
===================================================================
--- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-09-10 22:50:51 UTC (rev 1112)
+++ trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-09-10 22:52:52 UTC (rev 1113)
@@ -214,10 +214,27 @@
ORMCore.FactType factType = ((ORMCore.Role)e.ModelElement).FactType;
if (factType != null)
{
- foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType))
+ ORMCore.Objectification objectification = factType.Objectification;
+ if (objectification != null)
{
- ValidateConceptTypeChildNameChanged(child);
+ foreach (ORMCore.FactType impliedFactType in objectification.ImpliedFactTypeCollection)
+ {
+ foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(impliedFactType))
+ {
+ ValidateConceptTypeChildNameChanged(child);
+ goto doubleBreak;
+ }
+ }
+ doubleBreak: ;
}
+ else
+ {
+ foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType))
+ {
+ ValidateConceptTypeChildNameChanged(child);
+ break;
+ }
+ }
}
}
}
Modified: trunk/RelationalModel/OialDcilBridge/NameGeneration.cs
===================================================================
--- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-09-10 22:50:51 UTC (rev 1112)
+++ trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-09-10 22:52:52 UTC (rev 1113)
@@ -166,11 +166,11 @@
{
foreach (ConceptType conceptType in secondaryConceptTypes)
{
- name.Append(conceptType.Name);
if (longerThan == null || FinalizeName(name.ToString(), tableCase, tableStringReplace) != longerThan)
{
break;
}
+ name.Append(conceptType.Name);
}
}
@@ -180,9 +180,12 @@
}
string finalName = FinalizeName(name.ToString(), tableCase, tableStringReplace);
- while (finalName == longerThan)
+ if (longerThan != null && finalName == longerThan.TrimEnd('_'))
{
- finalName += "_";
+ while (finalName.Length <= longerThan.Length)
+ {
+ finalName += "_";
+ }
}
return finalName;
}
@@ -212,6 +215,8 @@
//get a role name for each fact type, or generate one from the reading
foreach (FactType factType in factTypes)
{
+ //factType.ImpliedByObjectification
+ //factType.Objectification.ImpliedFactTypeCollection
string roleName;
LinkedElementCollection<RoleBase> factTypeRoles = factType.RoleCollection;
int? unaryRoleIndex = FactType.GetUnaryRoleIndex(factTypeRoles);
@@ -292,6 +297,7 @@
if (!hasUnary || (longerThan != null && longerThan == FinalizeName(name.ToString(), columnCasing, columnStringReplace)))
{
+ string curName;
if (!(hasRoleOrHyphenBound || alwaysKeepText) && (predicateTextCount == 1 &&
(longerThan == null || longerThan != FinalizeName(valueTypeName, columnCasing, columnStringReplace))))
{
@@ -299,7 +305,8 @@
name.Remove(0, name.Length);
name.Append(valueTypeName);
}
- else if (!hasRoleOrHyphenBound || FinalizeName(name.ToString(), columnCasing, columnStringReplace) == longerThan)
+ else if (!hasRoleOrHyphenBound || (longerThan != null && (FinalizeName(curName = name.ToString(), columnCasing, columnStringReplace) == longerThan
+ || FinalizeName(curName + valueTypeName, columnCasing, columnStringReplace) == longerThan)))
{
name.Append(valueTypeName);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|