From: <mcu...@us...> - 2007-10-15 06:49:36
|
Revision: 1157 http://orm.svn.sourceforge.net/orm/?rev=1157&view=rev Author: mcurland Date: 2007-10-14 23:49:40 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Pull hyphens from collapsed predicate text and added notes on better future name generation implementations. refs #338 Updated version to 2007-10 CTP. refs #193 Modified Paths: -------------- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs trunk/VersionGenerator.exe.config Modified: trunk/RelationalModel/OialDcilBridge/NameGeneration.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-10-15 06:48:28 UTC (rev 1156) +++ trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-10-15 06:49:40 UTC (rev 1157) @@ -55,13 +55,22 @@ private static class NameGeneration { #region GenerateAllNames method - private static IDatabaseNameGenerator nameGenerator; - public static void GenerateAllNames(Schema schema) + private static IDatabaseNameGenerator myNameGenerator; + private static IDatabaseNameGenerator NameGenerator { - if (null == nameGenerator) + get { - nameGenerator = new DefaultDatabaseNameGenerator(); + IDatabaseNameGenerator retVal = myNameGenerator; + if (null == retVal) + { + myNameGenerator = retVal = new DefaultDatabaseNameGenerator(); + } + return retVal; } + } + public static void GenerateAllNames(Schema schema) + { + IDatabaseNameGenerator nameGenerator = NameGenerator; UniqueNameGenerator uniqueChecker = new UniqueNameGenerator(); LinkedElementCollection<Table> tables = schema.TableCollection; @@ -571,6 +580,22 @@ if (createRoleName && !createRoleNameSecond) { //generate a role name from the predicate text and prepend it + + // UNDONE: Matt Curland (Oct 13, 2007) + // The predicate text can be used to generate a much better name + // than just prepending it. There are several things to consider here. + // This is not a spec, just things we should look at. + // 1) If we do generate a role name that ends up being unique, then there + // really is no reason to use the role player name at all if we use a reading + // that ends with the opposite role. + // 2) The generated text here should use the opposite role as a predicate + // replacement if it starts the format string and the near role ends the format + // string. In other words, we prefer to find a reading that is the forward reading + // for the near role, but we need to respect the order if we don't find it. + // 3) The 'longerThan' approach may be too simplistic. We may look at other ways + // to track 'refinement level' that allows us to know what we have tried already + // and to jump immediately to other alternatives. Refinements are not necessary longer. + AddToNameCollection(ref singleName, ref nameCollection, GetRoleNameFromPredicateText(mainFactType, towardsRole, oppositeRole, isUnary, columnSpace), 0); @@ -939,8 +964,8 @@ //get rid of string replace fields string text = myReplaceFieldsPattern.Replace(reading.Text, " "); text = " " + CultureInfo.CurrentCulture.TextInfo.ToLower(text) + " "; - //remove articles - text = text.Replace(" a ", " ").Replace(" an ", " ").Replace(" the ", " "); + //remove articles and hyphens + text = text.Replace(" a ", " ").Replace(" an ", " ").Replace(" the ", " ").Replace("- ", " ").Replace(" -", " "); if (!isUnary && text.Trim() != "has") { text = text.Replace(" has ", " "); Modified: trunk/VersionGenerator.exe.config =================================================================== --- trunk/VersionGenerator.exe.config 2007-10-15 06:48:28 UTC (rev 1156) +++ trunk/VersionGenerator.exe.config 2007-10-15 06:49:40 UTC (rev 1157) @@ -2,7 +2,7 @@ <configuration> <appSettings> <add key="RevisionStartYearMonth" value="2006-01"/> - <add key="ReleaseYearMonth" value="2007-09"/> + <add key="ReleaseYearMonth" value="2007-10"/> <!-- ReleaseType: "CTP" or "RTM" --> <add key="ReleaseType" value="CTP"/> <!-- Changes to the major and/or minor version numbers have extreme effects across every part of the product. --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |