You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(21) |
Sep
(25) |
Oct
(13) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(1) |
Oct
(1) |
Nov
(8) |
Dec
(3) |
2009 |
Jan
(5) |
Feb
(3) |
Mar
(10) |
Apr
(6) |
May
(3) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(5) |
Oct
(1) |
Nov
(2) |
Dec
(2) |
2010 |
Jan
|
Feb
(3) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
|
Sep
(3) |
Oct
(2) |
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(3) |
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
(4) |
Nov
(4) |
Dec
(2) |
2013 |
Jan
(1) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(3) |
Dec
(2) |
2014 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
(5) |
2015 |
Jan
(3) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
|
Dec
|
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <mcu...@us...> - 2007-09-01 19:12:15
|
Revision: 1110 http://orm.svn.sourceforge.net/orm/?rev=1110&view=rev Author: mcurland Date: 2007-09-01 12:12:14 -0700 (Sat, 01 Sep 2007) Log Message: ----------- Subtypes with no resolvable preferred identifier were considered eligible for absorption. Modify ORMElementGateway to block object types that do not resolve to a preferred identifier. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ORMElementGateway.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-09-01 19:01:35 UTC (rev 1109) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-09-01 19:12:14 UTC (rev 1110) @@ -133,6 +133,40 @@ } } } + else if (!objectType.IsValueType) + { + // If this is a subtype, then we need to resolve + // the preferred identifier back to a non-excluded super type + ObjectType preferridentifierFrom = null; + ObjectType.WalkSupertypes( + objectType, + delegate(ObjectType type, int depth, bool isPrimary) + { + ObjectTypeVisitorResult result = ObjectTypeVisitorResult.Continue; + if (isPrimary) + { + if (IsElementExcluded(type)) + { + result = ObjectTypeVisitorResult.Stop; + } + else if (type.PreferredIdentifier != null) + { + preferridentifierFrom = type; + result = ObjectTypeVisitorResult.Stop; + } + else + { + result = ObjectTypeVisitorResult.SkipFollowingSiblings; // We already have the primary, no need to look further at this level + } + } + else if (depth != 0) + { + result = ObjectTypeVisitorResult.SkipChildren; + } + return result; + }); + return preferridentifierFrom != null; + } return true; } return false; @@ -275,6 +309,8 @@ { exclusionLink.Delete(); AddObjectType(objectType); + + // Consider readding associated fact types foreach (Role playedRole in objectType.PlayedRoleCollection) { FactType factType = playedRole.FactType; @@ -292,6 +328,33 @@ } } } + + // Consider readding subtypes excluded because this element was excluded + if (!objectType.IsValueType) + { + // Excluding an object type can leave a downstream subtype without an + // identifier, which excludes them. Note we only go one level deep + // as this will recurse naturally on the next level. + ObjectType.WalkSubtypes(objectType, delegate(ObjectType type, int depth, bool isPrimary) + { + switch (depth) + { + case 0: + return ObjectTypeVisitorResult.Continue; + case 1: + if (isPrimary) + { + if (type.PreferredIdentifier == null) + { + FilterModifiedObjectType(type); + } + } + return ObjectTypeVisitorResult.SkipChildren; + default: + return ObjectTypeVisitorResult.Stop; + } + }); + } } } else if (exclusionLink == null) @@ -348,6 +411,9 @@ { notifyExcluded(objectType); } + + // Excluding an object type leaves a FactType with a null role player, + // so the associated fact types also need to be excluded. foreach (Role playedRole in objectType.PlayedRoleCollection) { ExcludeFactType(playedRole.FactType, model, false, notifyExcluded); @@ -357,6 +423,32 @@ ExcludeFactType(proxy.FactType, model, false, notifyExcluded); } } + + if (!objectType.IsValueType) + { + // Excluding an object type can leave a downstream subtype without an + // identifier, so exclude those as well. Note we only go one level deep + // as this will recurse naturally on the next level. + ObjectType.WalkSubtypes(objectType, delegate(ObjectType type, int depth, bool isPrimary) + { + switch (depth) + { + case 0: + return ObjectTypeVisitorResult.Continue; + case 1: + if (isPrimary) + { + if (type.PreferredIdentifier == null) + { + ExcludeObjectType(type, model, false, notifyExcluded); + } + } + return ObjectTypeVisitorResult.SkipChildren; + default: + return ObjectTypeVisitorResult.Stop; + } + }); + } } } #endregion // Exclude* methods, exclude elements from absorption consideration @@ -575,6 +667,27 @@ } } #endregion // Model error tracking rules + #region Preferred Identifier Tracking Rules + /// <summary> + /// AddRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// Handle cases where subtypes have no preferred identifier. Note that this + /// is not necessarily an error condition in the core model, so we will not always + /// an error deleting notification on this object type, but this condition blocks + /// absorption on directly and indirectly subtyped objects that now need to be reconsidered. + /// </summary> + private static void PreferredIdentifierAddedRule(ElementAddedEventArgs e) + { + ObjectType objectType = ((EntityTypeHasPreferredIdentifier)e.ModelElement).PreferredIdentifierFor; + ObjectType.WalkSubtypes(objectType, delegate(ObjectType type, int depth, bool isPrimary) + { + if (isPrimary || depth == 0) + { + FilterModifiedObjectType(type); + } + return ObjectTypeVisitorResult.Continue; + }); + } + #endregion // Preferred Identifier Tracking Rules #region RolePlayer tracking rules /// <summary> /// AddRule: typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole) Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-09-01 19:01:35 UTC (rev 1109) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-09-01 19:12:14 UTC (rev 1110) @@ -41,6 +41,7 @@ typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ObjectTypeAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ObjectTypeErrorAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ObjectTypeErrorDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("PreferredIdentifierAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("RolePlayerAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("RolePlayerDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ORMElementGateway", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("RolePlayerRolePlayerChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), @@ -90,7 +91,7 @@ { Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager; Type[] disabledRuleTypes = ORMToORMAbstractionBridgeDomainModel.CustomDomainModelTypes; - for (int i = 0; i < 23; ++i) + for (int i = 0; i < 24; ++i) { ruleManager.EnableRule(disabledRuleTypes[i]); } @@ -309,6 +310,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ORMElementGateway.ObjectTypeErrorDeletedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier), Priority=Neumont.Tools.Modeling.FrameworkDomainModel.InlineRulePriority)] + private sealed class PreferredIdentifierAddedRuleClass : Microsoft.VisualStudio.Modeling.AddRule + { + [System.Diagnostics.DebuggerStepThrough()] + public PreferredIdentifierAddedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ORMElementGateway + /// /// <summary> + /// /// AddRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// /// </summary> + /// private static void PreferredIdentifierAddedRule(ElementAddedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ORMElementGateway.PreferredIdentifierAddedRule"); + ORMElementGateway.PreferredIdentifierAddedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ORMElementGateway.PreferredIdentifierAddedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole), Priority=Neumont.Tools.Modeling.FrameworkDomainModel.InlineRulePriority)] private sealed class RolePlayerAddedRuleClass : Microsoft.VisualStudio.Modeling.AddRule { Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-09-01 19:01:35 UTC (rev 1109) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-09-01 19:12:14 UTC (rev 1110) @@ -48,6 +48,9 @@ <arg:RuleOn targetType="ObjectTypeHasObjectTypeRequiresPrimarySupertypeError" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> <arg:RuleOn targetType="ValueTypeHasUnspecifiedDataTypeError" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:DeleteRule> + <arg:AddRule methodName="PreferredIdentifierAddedRule"> + <arg:RuleOn targetType="EntityTypeHasPreferredIdentifier" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:AddRule> <arg:AddRule methodName="RolePlayerAddedRule"> <arg:RuleOn targetType="ObjectTypePlaysRole" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:AddRule> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:58:08
|
Revision: 1106 http://orm.svn.sourceforge.net/orm/?rev=1106&view=rev Author: mcurland Date: 2007-08-30 10:58:08 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Fixed crash introduced in [1100] refs #334 Also updated install case missed in [1105] Modified Paths: -------------- trunk/Oial/ORMOialBridge/Install.bat trunk/RelationalModel/OialDcilBridge/NameGeneration.cs Modified: trunk/Oial/ORMOialBridge/Install.bat =================================================================== --- trunk/Oial/ORMOialBridge/Install.bat 2007-08-30 17:36:21 UTC (rev 1105) +++ trunk/Oial/ORMOialBridge/Install.bat 2007-08-30 17:58:08 UTC (rev 1106) @@ -7,6 +7,7 @@ XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMToORMAbstractionBridge.dll" "%NORMAExtensionsDir%\" XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMToORMAbstractionBridge.pdb" "%NORMAExtensionsDir%\" +XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMToORMAbstractionBridge.xml" "%NORMAExtensionsDir%\" REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMToORMAbstraction" /v "Class" /d "Neumont.Tools.ORMToORMAbstractionBridge.ORMToORMAbstractionBridgeDomainModel" /f 1>NUL REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMToORMAbstraction" /v "CodeBase" /d "%NORMAExtensionsDir%\Neumont.Tools.ORMToORMAbstractionBridge.dll" /f 1>NUL Modified: trunk/RelationalModel/OialDcilBridge/NameGeneration.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-08-30 17:36:21 UTC (rev 1105) +++ trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-08-30 17:58:08 UTC (rev 1106) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Neumont.Tools.ORM.ObjectModel; +using ORMCore = Neumont.Tools.ORM.ObjectModel; using Microsoft.VisualStudio.Modeling; using Neumont.Tools.ORMAbstraction; using Neumont.Tools.ORMToORMAbstractionBridge; @@ -274,17 +275,16 @@ LinkedElementCollection<ConceptType> types = informationTypeFormat.ConceptTypeCollection; if (types.Count == 1) { - ObjectType preferredFor = ConceptTypeIsForObjectType.GetObjectType(types[0]); - LinkedElementCollection<Role> identifiers = preferredFor.ResolvedPreferredIdentifier.RoleCollection; - if (identifiers.Count == 1) + ObjectType preferredFor; + ORMCore.UniquenessConstraint preferredIdentifier; + LinkedElementCollection<Role> identifiers; + if (null != (preferredFor = ConceptTypeIsForObjectType.GetObjectType(types[0])) && + null != (preferredIdentifier = preferredFor.ResolvedPreferredIdentifier) && + 1 == (identifiers = preferredIdentifier.RoleCollection).Count && + identifiers[0].RolePlayer == InformationTypeFormatIsForValueType.GetValueType(informationTypeFormat) && + !informationTypeFormat.Name.StartsWith(preferredFor.Name)) { - if (identifiers[0].RolePlayer.Id == InformationTypeFormatIsForValueType.GetValueType(informationTypeFormat).Id) - { - if (!informationTypeFormat.Name.StartsWith(preferredFor.Name)) - { - valueTypeName = preferredFor.Name + "_"; - } - } + valueTypeName = preferredFor.Name + "_"; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:36:21
|
Revision: 1105 http://orm.svn.sourceforge.net/orm/?rev=1105&view=rev Author: mcurland Date: 2007-08-30 10:36:21 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Added preview abstraction and relational models to setup and increased version to 2007-08 CTP for pending drop. refs #193 Also updated batch files to pick up doc comment files from referencing projects. Modified Paths: -------------- trunk/ORMModel/Shell/catalog.xml trunk/Oial/ORMOialBridge/ORMOialBridge.csproj trunk/Oial/OialModel/Install.bat trunk/Oial/OialModel/OialModel.csproj trunk/RelationalModel/DcilModel/DcilModel.csproj trunk/RelationalModel/DcilModel/Install.bat trunk/RelationalModel/OialDcilBridge/Install.bat trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj trunk/Setup/ComponentGroups.wxs trunk/Setup/Components.wxs trunk/VersionGenerator.exe.config trunk/install.bat Modified: trunk/ORMModel/Shell/catalog.xml =================================================================== --- trunk/ORMModel/Shell/catalog.xml 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/ORMModel/Shell/catalog.xml 2007-08-30 17:36:21 UTC (rev 1105) @@ -1,4 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <SchemaCatalog xmlns="http://schemas.microsoft.com/xsd/catalog"> <Schema targetNamespace="http://schemas.neumont.edu/ORM/DesignerSettings" href="ORMDesignerSettings.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Preview/CustomProperties" href="CustomProperties.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Abstraction/2007-06/Core" href="ORMAbstraction.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Abstraction/2007-06/DataTypes/Core" href="ORMAbstractionDataTypes.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMToORMAbstraction" href="ORMToORMAbstraction.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Relational/2007-06/ConceptualDatabase" href="ConceptualDatabase.xsd"/> + <Schema targetNamespace="http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMAbstractionToConceptualDatabase" href="ORMAbstractionToConceptualDatabase.xsd"/> </SchemaCatalog> \ No newline at end of file Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.csproj =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.csproj 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.csproj 2007-08-30 17:36:21 UTC (rev 1105) @@ -22,7 +22,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> - <DocumentationFile>bin\Debug\Neumont.Tools.ORMOialBridge.xml</DocumentationFile> + <DocumentationFile>bin\Debug\Neumont.Tools.ORMToORMAbstractionBridge.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> @@ -32,7 +32,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> - <DocumentationFile>bin\Release\Neumont.Tools.ORMOialBridge.xml</DocumentationFile> + <DocumentationFile>bin\Release\Neumont.Tools.ORMToORMAbstractionBridge.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <NoWarn>1607</NoWarn> Modified: trunk/Oial/OialModel/Install.bat =================================================================== --- trunk/Oial/OialModel/Install.bat 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/Oial/OialModel/Install.bat 2007-08-30 17:36:21 UTC (rev 1105) @@ -7,6 +7,7 @@ XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstraction.dll" "%NORMAExtensionsDir%\" XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstraction.pdb" "%NORMAExtensionsDir%\" +XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstraction.xml" "%NORMAExtensionsDir%\" REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Abstraction/2007-06/Core" /v "Class" /d "Neumont.Tools.ORMAbstraction.AbstractionDomainModel" /f 1>NUL REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Abstraction/2007-06/Core" /v "CodeBase" /d "%NORMAExtensionsDir%\Neumont.Tools.ORMAbstraction.dll" /f 1>NUL Modified: trunk/Oial/OialModel/OialModel.csproj =================================================================== --- trunk/Oial/OialModel/OialModel.csproj 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/Oial/OialModel/OialModel.csproj 2007-08-30 17:36:21 UTC (rev 1105) @@ -22,7 +22,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> - <DocumentationFile>bin\Debug\Neumont.Tools.Oial.xml</DocumentationFile> + <DocumentationFile>bin\Debug\Neumont.Tools.ORMAbstraction.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> @@ -32,7 +32,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> - <DocumentationFile>bin\Release\Neumont.Tools.Oial.xml</DocumentationFile> + <DocumentationFile>bin\Release\Neumont.Tools.ORMAbstraction.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> Modified: trunk/RelationalModel/DcilModel/DcilModel.csproj =================================================================== --- trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-30 17:36:21 UTC (rev 1105) @@ -22,7 +22,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Debug\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> - <DocumentationFile>bin\Debug\Neumont.Tools.Dil.Dcil.xml</DocumentationFile> + <DocumentationFile>bin\Debug\Neumont.Tools.RelationalModels.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> @@ -32,7 +32,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> - <DocumentationFile>bin\Release\Neumont.Tools.Dil.Dcil.xml</DocumentationFile> + <DocumentationFile>bin\Release\Neumont.Tools.RelationalModels.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> Modified: trunk/RelationalModel/DcilModel/Install.bat =================================================================== --- trunk/RelationalModel/DcilModel/Install.bat 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/RelationalModel/DcilModel/Install.bat 2007-08-30 17:36:21 UTC (rev 1105) @@ -7,6 +7,7 @@ XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.RelationalModels.dll" "%NORMAExtensionsDir%\" XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.RelationalModels.pdb" "%NORMAExtensionsDir%\" +XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.RelationalModels.xml" "%NORMAExtensionsDir%\" REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Relational/2007-06/ConceptualDatabase" /v "Class" /d "Neumont.Tools.RelationalModels.ConceptualDatabase.ConceptualDatabaseDomainModel" /f 1>NUL REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Relational/2007-06/ConceptualDatabase" /v "CodeBase" /d "%NORMAExtensionsDir%\Neumont.Tools.RelationalModels.dll" /f 1>NUL Modified: trunk/RelationalModel/OialDcilBridge/Install.bat =================================================================== --- trunk/RelationalModel/OialDcilBridge/Install.bat 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/RelationalModel/OialDcilBridge/Install.bat 2007-08-30 17:36:21 UTC (rev 1105) @@ -7,6 +7,7 @@ XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" "%NORMAExtensionsDir%\" XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.pdb" "%NORMAExtensionsDir%\" +XCOPY /Y /D /V /Q "%RootDir%\%BuildOutDir%\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.xml" "%NORMAExtensionsDir%\" REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMAbstractionToConceptualDatabase" /v "Class" /d "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel" /f 1>NUL REG ADD "HKLM\%VSRegistryRoot%\Neumont\ORM Architect\Extensions\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMAbstractionToConceptualDatabase" /v "CodeBase" /d "%NORMAExtensionsDir%\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" /f 1>NUL Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-30 17:36:21 UTC (rev 1105) @@ -32,7 +32,7 @@ <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> - <DocumentationFile>bin\Release\Neumont.Tools.Dil.OialDcilBridge.xml</DocumentationFile> + <DocumentationFile>bin\Release\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.xml</DocumentationFile> <ErrorReport>prompt</ErrorReport> <NoWarn>1607</NoWarn> <UseVSHostingProcess>false</UseVSHostingProcess> Modified: trunk/Setup/ComponentGroups.wxs =================================================================== --- trunk/Setup/ComponentGroups.wxs 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/Setup/ComponentGroups.wxs 2007-08-30 17:36:21 UTC (rev 1105) @@ -39,7 +39,21 @@ <ComponentRef Id="NORMAVSOIALModelExtensionComponent"/> <ComponentRef Id="NORMAVSRelationalViewExtensionComponent"/> <ComponentRef Id="NORMAVSCustomPropertiesExtensionComponent"/> + <ComponentRef Id="NORMAVSCustomPropertiesGACComponent"/> + <ComponentRef Id="NORMAVSCustomPropertiesSchemaComponent"/> <ComponentRef Id="NORMAVSCustomPropertiesVerbalizationComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionExtensionComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionGACComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionSchemaComponent"/> + <ComponentRef Id="NORMAVSORMToORMAbstractionExtensionComponent"/> + <ComponentRef Id="NORMAVSORMToORMAbstractionGACComponent"/> + <ComponentRef Id="NORMAVSORMToORMAbstractionSchemaComponent"/> + <ComponentRef Id="NORMAVSRelationalModelsExtensionComponent"/> + <ComponentRef Id="NORMAVSRelationalModelsGACComponent"/> + <ComponentRef Id="NORMAVSRelationalModelsSchemaComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionToConceptualDatabaseExtensionComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionToConceptualDatabaseGACComponent"/> + <ComponentRef Id="NORMAVSORMAbstractionToConceptualDatabaseSchemaComponent"/> <ComponentRef Id="ORMSchemaCatalogComponent"/> <ComponentRef Id="ORMSchemasComponent"/> <ComponentRef Id="ORMSchemasLocalCatalogComponent"/> Modified: trunk/Setup/Components.wxs =================================================================== --- trunk/Setup/Components.wxs 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/Setup/Components.wxs 2007-08-30 17:36:21 UTC (rev 1105) @@ -23,6 +23,26 @@ <File Id="Neumont.Tools.ORM.dll_GAC" Name="ORM.dll" LongName="Neumont.Tools.ORM.dll" src="..\ORMModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORM.dll" DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Vital="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORM.dll_GAC" ProcessorArchitecture="msil"/> </Component> + <Component Id="NORMAVSCustomPropertiesGACComponent" Guid="0772D284-812E-4ECC-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORM.CustomProperties.dll_GAC" Name="ORMCstPr.dll" LongName="Neumont.Tools.ORM.CustomProperties.dll" src="..\CustomProperties\bin\$(var.BuildConfiguration)\Neumont.Tools.ORM.CustomProperties.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORM.CustomProperties.dll_GAC" ProcessorArchitecture="msil"/> + </Component> + <Component Id="NORMAVSORMAbstractionGACComponent" Guid="287179E2-73E9-4685-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMAbstraction.dll_GAC" Name="ORMAbstr.dll" LongName="Neumont.Tools.ORMAbstraction.dll" src="..\Oial\OialModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstraction.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMAbstraction.dll_GAC" ProcessorArchitecture="msil"/> + </Component> + <Component Id="NORMAVSORMToORMAbstractionGACComponent" Guid="83ACCC60-19F4-4BBE-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMToORMAbstractionBridge.dll_GAC" Name="ORMAbsBr.dll" LongName="Neumont.Tools.ORMToORMAbstractionBridge.dll" src="..\Oial\ORMOialBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMToORMAbstractionBridge.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMToORMAbstractionBridge.dll_GAC" ProcessorArchitecture="msil"/> + </Component> + <Component Id="NORMAVSRelationalModelsGACComponent" Guid="8877E891-60A3-454C-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.RelationalModels.dll_GAC" Name="RelMods.dll" LongName="Neumont.Tools.RelationalModels.dll" src="..\RelationalModel\DcilModel\bin\$(var.BuildConfiguration)\Neumont.Tools.RelationalModels.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.RelationalModels.dll_GAC" ProcessorArchitecture="msil"/> + </Component> + <Component Id="NORMAVSORMAbstractionToConceptualDatabaseGACComponent" Guid="B14BF95A-EC48-49EE-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll_GAC" Name="CDBBr.dll" LongName="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" src="..\RelationalModel\OialDcilBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll_GAC" ProcessorArchitecture="msil"/> + </Component> </Directory> <Directory Id="$(var.ProgramFilesFolder)"> @@ -59,6 +79,9 @@ <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\NORMAVS"> <Registry Type="string" Value="[BINDIR]"/> </Registry> + <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\NORMAVSExtensions"> + <Registry Type="string" Value="[EXTENSIONSDIR]"/> + </Registry> <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="$(var.NORMARegRoot)"> <Registry Type="string" Name="InstallDir" Value="[$(var.DefaultShortProductDir)]"/> <Registry Type="string" Name="ProductVersion" Value="$(var.ProductVersion)"/> @@ -150,8 +173,7 @@ </Registry> </Component> - <Directory Id="Extensions" Name="Ext" LongName="Extenions"> - + <Directory Id="EXTENSIONSDIR" Name="Ext" LongName="Extensions"> <Component Id="NORMAVSOIALModelExtensionComponent" Guid="27157B36-345A-4E11-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> <File Id="Neumont.Tools.ORM.OIALModel.dll" Name="OIALModl.dll" LongName="Neumont.Tools.ORM.OIALModel.dll" src="..\OIALModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORM.OIALModel.dll" DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORM.OIALModel.dll" AssemblyApplication="Neumont.Tools.ORM.OIALModel.dll" ProcessorArchitecture="msil"/> @@ -188,6 +210,61 @@ </Registry> </Component> + <Component Id="NORMAVSORMAbstractionExtensionComponent" Guid="2AF4858D-43CC-4107-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMAbstraction.dll" Name="ORMAbstr.dll" LongName="Neumont.Tools.ORMAbstraction.dll" src="..\Oial\OialModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstraction.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMAbstraction.dll" AssemblyApplication="Neumont.Tools.ORMAbstraction.dll" ProcessorArchitecture="msil"/> + <File Id="Neumont.Tools.ORMAbstraction.pdb" Name="ORMAbstr.pdb" LongName="Neumont.Tools.ORMAbstraction.pdb" src="..\Oial\OialModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstraction.pdb" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstraction.dll"/> + <File Id="Neumont.Tools.ORMAbstraction.xml" Name="ORMAbstr.xml" LongName="Neumont.Tools.ORMAbstraction.xml" src="..\Oial\OialModel\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstraction.xml" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstraction.dll"/> + <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="$(var.NORMAVSExtensionsRegRoot)\http://schemas.neumont.edu/ORM/Abstraction/2007-06/Core"> + <Registry Type="string" Name="Class" Value="Neumont.Tools.ORMAbstraction.AbstractionDomainModel"/> + <Registry Type="string" Name="Assembly" Value="Neumont.Tools.ORMAbstraction, $(var.BaseAssemblyName)"/> + <Registry Type="string" Name="CodeBase" Value="[#Neumont.Tools.ORMAbstraction.dll]"/> + </Registry> + </Component> + + <Component Id="NORMAVSORMToORMAbstractionExtensionComponent" Guid="C6CED0EA-97CA-40AA-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMToORMAbstractionBridge.dll" Name="ORMAbsBr.dll" LongName="Neumont.Tools.ORMToORMAbstractionBridge.dll" src="..\Oial\ORMOialBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMToORMAbstractionBridge.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMToORMAbstractionBridge.dll" AssemblyApplication="Neumont.Tools.ORMToORMAbstractionBridge.dll" ProcessorArchitecture="msil"/> + <File Id="Neumont.Tools.ORMToORMAbstractionBridge.pdb" Name="ORMAbsBr.pdb" LongName="Neumont.Tools.ORMToORMAbstractionBridge.pdb" src="..\Oial\ORMOialBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMToORMAbstractionBridge.pdb" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMToORMAbstractionBridge.dll"/> + <File Id="Neumont.Tools.ORMToORMAbstractionBridge.xml" Name="ORMAbsBr.xml" LongName="Neumont.Tools.ORMToORMAbstractionBridge.xml" src="..\Oial\ORMOialBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMToORMAbstractionBridge.xml" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMToORMAbstractionBridge.dll"/> + <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="$(var.NORMAVSExtensionsRegRoot)\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMToORMAbstraction"> + <Registry Type="string" Name="Class" Value="Neumont.Tools.ORMToORMAbstractionBridge.ORMToORMAbstractionBridgeDomainModel"/> + <Registry Type="string" Name="Assembly" Value="Neumont.Tools.ORMToORMAbstractionBridge, $(var.BaseAssemblyName)"/> + <Registry Type="string" Name="CodeBase" Value="[#Neumont.Tools.ORMToORMAbstractionBridge.dll]"/> + </Registry> + </Component> + + <Component Id="NORMAVSRelationalModelsExtensionComponent" Guid="8CA7B2DB-1669-427B-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.RelationalModels.dll" Name="RelMods.dll" LongName="Neumont.Tools.RelationalModels.dll" src="..\RelationalModel\DcilModel\bin\$(var.BuildConfiguration)\Neumont.Tools.RelationalModels.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.RelationalModels.dll" AssemblyApplication="Neumont.Tools.RelationalModels.dll" ProcessorArchitecture="msil"/> + <File Id="Neumont.Tools.RelationalModels.pdb" Name="RelMods.pdb" LongName="Neumont.Tools.RelationalModels.pdb" src="..\RelationalModel\DcilModel\bin\$(var.BuildConfiguration)\Neumont.Tools.RelationalModels.pdb" + DefaultLanguage="0" CompanionFile="Neumont.Tools.RelationalModels.dll"/> + <File Id="Neumont.Tools.RelationalModels.xml" Name="RelMods.xml" LongName="Neumont.Tools.RelationalModels.xml" src="..\RelationalModel\DcilModel\bin\$(var.BuildConfiguration)\Neumont.Tools.RelationalModels.xml" + DefaultLanguage="0" CompanionFile="Neumont.Tools.RelationalModels.dll"/> + <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="$(var.NORMAVSExtensionsRegRoot)\http://schemas.neumont.edu/ORM/Relational/2007-06/ConceptualDatabase"> + <Registry Type="string" Name="Class" Value="Neumont.Tools.RelationalModels.ConceptualDatabase.ConceptualDatabaseDomainModel"/> + <Registry Type="string" Name="Assembly" Value="Neumont.Tools.RelationalModels, $(var.BaseAssemblyName)"/> + <Registry Type="string" Name="CodeBase" Value="[#Neumont.Tools.RelationalModels.dll]"/> + </Registry> + </Component> + + <Component Id="NORMAVSORMAbstractionToConceptualDatabaseExtensionComponent" Guid="2D11803B-91D7-446E-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)"> + <File Id="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" Name="CDBBr.dll" LongName="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" src="..\RelationalModel\OialDcilBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" + DefaultVersion="$(var.ProductVersion)" DefaultLanguage="0" KeyPath="yes" Assembly=".net" AssemblyManifest="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" AssemblyApplication="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll" ProcessorArchitecture="msil"/> + <File Id="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.pdb" Name="CDBBr.pdb" LongName="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.pdb" src="..\RelationalModel\OialDcilBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.pdb" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll"/> + <File Id="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.xml" Name="CDBBr.xml" LongName="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.xml" src="..\RelationalModel\OialDcilBridge\bin\$(var.BuildConfiguration)\Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.xml" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll"/> + <Registry Action="createKeyAndRemoveKeyOnUninstall" Root="HKLM" Key="$(var.NORMAVSExtensionsRegRoot)\http://schemas.neumont.edu/ORM/Bridge/2007-06/ORMAbstractionToConceptualDatabase"> + <Registry Type="string" Name="Class" Value="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel"/> + <Registry Type="string" Name="Assembly" Value="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge, $(var.BaseAssemblyName)"/> + <Registry Type="string" Name="CodeBase" Value="[#Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll]"/> + </Registry> + </Component> </Directory> </Directory> @@ -211,6 +288,28 @@ <File Id="ORMDesignerSettings.xsd" Name="DsgnrStg.xsd" LongName="ORMDesignerSettings.xsd" src="..\ORMModel\Shell\ORMDesignerSettings.xsd" DefaultLanguage="0" CompanionFile="Neumont.Tools.ORM.dll"/> </Component> + <Component Id="NORMAVSCustomPropertiesSchemaComponent" Guid="27EB4413-1888-4038-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)" KeyPath="yes"> + <File Id="CustomProperties.xsd" Name="ORMCstPr.xsd" LongName="CustomProperties.xsd" src="..\CustomProperties\CustomProperties.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORM.CustomProperties.dll"/> + </Component> + <Component Id="NORMAVSORMAbstractionSchemaComponent" Guid="1AFB3357-16AC-4A2B-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)" KeyPath="yes"> + <File Id="ORMAbstraction.xsd" Name="ORMAbstr.xsd" LongName="ORMAbstraction.xsd" src="..\Oial\OialModel\OIAL.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstraction.dll"/> + <File Id="ORMAbstractionDataTypes.xsd" Name="ORMAbsDT.xsd" LongName="ORMAbstractionDataTypes.xsd" src="..\Oial\OialModel\OIALDatatypes.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstraction.dll"/> + </Component> + <Component Id="NORMAVSORMToORMAbstractionSchemaComponent" Guid="D79F2881-1707-4499-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)" KeyPath="yes"> + <File Id="ORMToORMAbstraction.xsd" Name="ORMAbsBr.xsd" LongName="ORMToORMAbstraction.xsd" src="..\Oial\ORMOialBridge\ORMToORMAbstraction.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMToORMAbstractionBridge.dll"/> + </Component> + <Component Id="NORMAVSRelationalModelsSchemaComponent" Guid="5D8B0055-6336-4226-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)" KeyPath="yes"> + <File Id="ConceptualDatabase.xsd" Name="CDB.xsd" LongName="ConceptualDatabase.xsd" src="..\RelationalModel\DcilModel\ConceptualDatabase.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.RelationalModels.dll"/> + </Component> + <Component Id="NORMAVSORMAbstractionToConceptualDatabaseSchemaComponent" Guid="F3ECE70B-A746-4FDA-$(var.VersionGuidSuffix)" DiskId="1" Win64="$(var.Win64)" KeyPath="yes"> + <File Id="ORMAbstractionToConceptualDatabase.xsd" Name="CDBBr.xsd" LongName="ORMAbstractionToConceptualDatabase.xsd" src="..\RelationalModel\OialDcilBridge\ORMAbstractionToConceptualDatabase.xsd" + DefaultLanguage="0" CompanionFile="Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.dll"/> + </Component> </Directory> <Directory Id="Transforms" Name="Trnsfrms" LongName="Transforms"> <!-- XSLTs specific to NORMA for VS go here. Anything potentially applicable to other programs should go under ORMCOMMONTRANSFORMSDIR or DILCOMMONTRANSFORMSDIR. --> Modified: trunk/VersionGenerator.exe.config =================================================================== --- trunk/VersionGenerator.exe.config 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/VersionGenerator.exe.config 2007-08-30 17:36:21 UTC (rev 1105) @@ -2,7 +2,7 @@ <configuration> <appSettings> <add key="RevisionStartYearMonth" value="2006-01"/> - <add key="ReleaseYearMonth" value="2007-06"/> + <add key="ReleaseYearMonth" value="2007-08"/> <!-- 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. --> Modified: trunk/install.bat =================================================================== --- trunk/install.bat 2007-08-30 17:30:26 UTC (rev 1104) +++ trunk/install.bat 2007-08-30 17:36:21 UTC (rev 1105) @@ -41,6 +41,12 @@ XCOPY /Y /D /V /Q "%RootDir%\catalog.xml" "%ORMDir%\Schemas\" XCOPY /Y /D /V /Q "%RootDir%\ORMModel\Shell\ORMDesignerSettings.xsd" "%NORMADir%\Xml\Schemas\" +XCOPY /Y /D /V /Q "%RootDir%\CustomProperties\CustomProperties.xsd" "%NORMADir%\Xml\Schemas\" +ECHO F | XCOPY /Y /D /V /Q "%RootDir%\Oial\OialModel\OIAL.xsd" "%NORMADir%\Xml\Schemas\ORMAbstraction.xsd" +ECHO F | XCOPY /Y /D /V /Q "%RootDir%\Oial\OialModel\OIALDatatypes.xsd" "%NORMADir%\Xml\Schemas\ORMAbstractionDataTypes.xsd" +XCOPY /Y /D /V /Q "%RootDir%\Oial\ORMOialBridge\ORMToORMAbstraction.xsd" "%NORMADir%\Xml\Schemas\" +XCOPY /Y /D /V /Q "%RootDir%\RelationalModel\DcilModel\ConceptualDatabase.xsd" "%NORMADir%\Xml\Schemas\" +XCOPY /Y /D /V /Q "%RootDir%\RelationalModel\OialDcilBridge\ORMAbstractionToConceptualDatabase.xsd" "%NORMADir%\Xml\Schemas\" XCOPY /Y /D /V /Q "%RootDir%\ORMModel\Shell\catalog.xml" "%NORMADir%\Xml\Schemas\" XCOPY /Y /D /V /Q "%RootDir%\ORMModel\Shell\ORMDesignerSettings.xml" "%NORMADir%\" XCOPY /Y /D /V /Q "%RootDir%\ORMModel\Shell\Converters\*.xslt" "%NORMADir%\Xml\Transforms\Converters\" @@ -98,6 +104,9 @@ REG ADD "HKLM\%VSRegistryRoot%\XmlDesigners\{EDA9E282-8FC6-4AE4-AF2C-C224FD3AE49B}" /v "LogicalView" /d "7651A702-06E5-11D1-8EBD-00A0C90F26EA" /f 1>NUL REG ADD "HKLM\%VSRegistryRoot%\XmlDesigners\{EDA9E282-8FC6-4AE4-AF2C-C224FD3AE49B}" /v "Namespace" /d "http://schemas.neumont.edu/ORM/2006-04/ORMRoot" /f 1>NUL +REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\NORMAVS" /ve /d "%NORMADir%\bin" /f 1>NUL +REG ADD "HKLM\SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\NORMAVSExtensions" /ve /d "%NORMADir%\bin\Extensions" /f 1>NUL + REG ADD "HKCR\MIME\Database\Content Type\application/orm+xml" /v "Extension" /d ".orm" /f 1>NUL REG ADD "HKCR\.orm" /ve /d "ormfile" /f 1>NUL REG ADD "HKCR\.orm" /v "Content Type" /d "application/orm+xml" /f 1>NUL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:30:28
|
Revision: 1104 http://orm.svn.sourceforge.net/orm/?rev=1104&view=rev Author: mcurland Date: 2007-08-30 10:30:26 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Changeset [1101] began setting ConceptTypeAssimilatesConceptType.IsPreferredForTarget, which was never set before. The conceptual database bridge crashes when this property is set, so ignore it for now. Temporary fix so the rest of us can keep working. refs #327 Modified Paths: -------------- trunk/ORMModel/ObjectModel/ObjectType.cs trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs Modified: trunk/ORMModel/ObjectModel/ObjectType.cs =================================================================== --- trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-30 17:27:46 UTC (rev 1103) +++ trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-30 17:30:26 UTC (rev 1104) @@ -1569,20 +1569,17 @@ } } /// <summary> - /// Indicates if this <see cref="ObjectType"/> is implied independent. + /// Indicates if this <see cref="ObjectType"/> is either explicitly marked as <see cref="IsIndependent">independent</see> + /// or is implicitly independent because it plays no roles outside of its preferred identifier. /// </summary> - public bool IsImpliedIndependent() + public bool TreatAsIndependent { - return !this.IsIndependent && this.ImpliedMandatoryConstraint == null && this.AllowIsIndependent(false); + get + { + return this.IsIndependent || (this.ImpliedMandatoryConstraint == null && this.AllowIsIndependent(false)); + } } /// <summary> - /// Indicates if this <see cref="ObjectType"/> is either implied independent or explicity independent. - /// </summary> - public bool IsAnyIndependent() - { - return this.IsIndependent || this.IsImpliedIndependent(); - } - /// <summary> /// Test if the <see cref="IsIndependent"/> property can be set to true. /// </summary> /// <param name="throwIfFalse">Set to <see langword="true"/> to throw an exception instead of returning false.</param> Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:27:46 UTC (rev 1103) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:30:26 UTC (rev 1104) @@ -352,7 +352,7 @@ foreach (ObjectType objectType in chain.ObjectTypes) { - if (objectType.IsAnyIndependent()) + if (objectType.TreatAsIndependent) { predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards[objectType] = null; } Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-30 17:27:46 UTC (rev 1103) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-30 17:30:26 UTC (rev 1104) @@ -1109,7 +1109,7 @@ private bool ObjectTypeIsConceptType(ObjectType objectType, FactTypeMappingDictionary factTypeMappings) { // If objectType is independent... - if (objectType.IsAnyIndependent()) + if (objectType.TreatAsIndependent) { return true; } Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:27:46 UTC (rev 1103) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:30:26 UTC (rev 1104) @@ -587,7 +587,7 @@ foreach (ConceptTypeAssimilatesConceptType conceptTypeAssimilatesConceptType in ConceptTypeAssimilatesConceptType.GetLinksToAssimilatorConceptTypeCollection(conceptType)) { - if (conceptTypeAssimilatesConceptType.IsPreferredForTarget) + if (false && conceptTypeAssimilatesConceptType.IsPreferredForTarget) { prefferedConceptTypeChildrenList.Add(conceptTypeAssimilatesConceptType); break; @@ -658,7 +658,7 @@ TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatorConceptType).UniquenessConstraintCollection.Add(mappedConstraint); } - else if (assimilation.IsPreferredForTarget) + else if (false && assimilation.IsPreferredForTarget) { if (isPreferredForChildFound == false) { @@ -879,7 +879,7 @@ } foreach (ConceptTypeAssimilatesConceptType conceptTypeAssimilatesConceptType in ConceptTypeAssimilatesConceptType.GetLinksToAssimilatorConceptTypeCollection(conceptType)) { - if (conceptTypeAssimilatesConceptType.IsPreferredForTarget) + if (false && conceptTypeAssimilatesConceptType.IsPreferredForTarget) { foreach (Column target in ColumnHasConceptTypeChild.GetColumn((ConceptTypeChild)conceptTypeAssimilatesConceptType)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:27:44
|
Revision: 1103 http://orm.svn.sourceforge.net/orm/?rev=1103&view=rev Author: mcurland Date: 2007-08-30 10:27:46 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Fixed bug that was causing us to only ever get one Permutation out of FindSmallestPermutationsInTermsOfConceptTypes(). Added EliminatePermutationsWithIdenticalResults(). refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:26:19 UTC (rev 1102) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:27:46 UTC (rev 1103) @@ -278,6 +278,7 @@ PermuteFactTypeMappings(chain.PossiblePermutations, chain.UndecidedOneToOneFactTypeMappings, newlyDecidedFactTypeMappings, deeplyMappedObjectTypes, 0); EliminateInvalidPermutations(chain); FindSmallestPermutationsInTermsOfConceptTypes(chain); + EliminatePermutationsWithIdenticalResults(chain); // Add each mapping from the optimal permutation to the "global" set of decided mappings. foreach (FactTypeMapping optimalMapping in ChooseOptimalPermutation(chain).Mappings) @@ -441,7 +442,7 @@ else { // We have the same number of top-level concept types as the minimum, so we need to check the number of non-top-level concept types. - if (nonTopLevelConceptTypes.Count > minTopLevelConceptTypesCount) + if (nonTopLevelConceptTypes.Count > minNonTopLevelConceptTypesCount) { // This isn't an optimal permutation, so go on to the next one. continue; @@ -458,8 +459,55 @@ } } + /// <summary> + /// Eliminates <see cref="Permutation"/>s that have the same set of top-level concept types and non-top-level concept types, + /// which will always result in the same OIAL. + /// </summary> + private static void EliminatePermutationsWithIdenticalResults(Chain chain) + { + PermutationList smallestPermutationsInTermsOfConceptTypes = chain.SmallestPermutationsInTermsOfConceptTypes; + for (int currentPermutationIndex = 0; currentPermutationIndex < smallestPermutationsInTermsOfConceptTypes.Count - 1; currentPermutationIndex++) + { + Permutation currentPermutation = smallestPermutationsInTermsOfConceptTypes[currentPermutationIndex]; + for (int comparisonPermutationIndex = smallestPermutationsInTermsOfConceptTypes.Count - 1; comparisonPermutationIndex > currentPermutationIndex; comparisonPermutationIndex--) + { + Permutation comparisonPermutation = smallestPermutationsInTermsOfConceptTypes[comparisonPermutationIndex]; + bool hasIdenticalConceptTypes = true; + // Check if comparisonPermutation has the same top-level concept types. + foreach (ObjectType topLevelConceptType in currentPermutation.TopLevelConceptTypes.Keys) + { + if (!comparisonPermutation.TopLevelConceptTypes.ContainsKey(topLevelConceptType)) + { + hasIdenticalConceptTypes = false; + break; + } + } + if (hasIdenticalConceptTypes) + { + // Check if comparisonPermutation has the same non-top-level concept types. + foreach (ObjectType nonTopLevelConceptType in currentPermutation.NonTopLevelConceptTypes.Keys) + { + if (!comparisonPermutation.NonTopLevelConceptTypes.ContainsKey(nonTopLevelConceptType)) + { + hasIdenticalConceptTypes = false; + break; + } + } + if (hasIdenticalConceptTypes) + { + // comparisonPermutation has the same set of top-level and non-top-level concept types, so we can get rid of it. + // It is entirely arbitrary which one we get rid of, so we'll keep the first since it is easier. + smallestPermutationsInTermsOfConceptTypes.RemoveAt(comparisonPermutationIndex); + } + } + } + } + } + + + private static Permutation ChooseOptimalPermutation(Chain chain) { // UNDONE: This should do something smart! This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:24:14
|
Revision: 1101 http://orm.svn.sourceforge.net/orm/?rev=1101&view=rev Author: mcurland Date: 2007-08-30 10:24:00 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Improved top-level concept type and non-top-level concept type count detection used by FactTypeMappingPermuter. Various other bug fixes and tweaks. refs #327 Modified Paths: -------------- trunk/ORMModel/ObjectModel/ObjectType.cs trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/ORMModel/ObjectModel/ObjectType.cs =================================================================== --- trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-30 17:21:57 UTC (rev 1100) +++ trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-30 17:24:00 UTC (rev 1101) @@ -1569,6 +1569,20 @@ } } /// <summary> + /// Indicates if this <see cref="ObjectType"/> is implied independent. + /// </summary> + public bool IsImpliedIndependent() + { + return !this.IsIndependent && this.ImpliedMandatoryConstraint == null && this.AllowIsIndependent(false); + } + /// <summary> + /// Indicates if this <see cref="ObjectType"/> is either implied independent or explicity independent. + /// </summary> + public bool IsAnyIndependent() + { + return this.IsIndependent || this.IsImpliedIndependent(); + } + /// <summary> /// Test if the <see cref="IsIndependent"/> property can be set to true. /// </summary> /// <param name="throwIfFalse">Set to <see langword="true"/> to throw an exception instead of returning false.</param> Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:21:57 UTC (rev 1100) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-30 17:24:00 UTC (rev 1101) @@ -113,8 +113,14 @@ Chain chain = new Chain(); myChains.Add(chain); + // Assuming ProcessObjectType works correctly, we will never hit an object type a second time, + // so we can clear the Dictionary here and then use it as a record of all object types in the chain. + visitedObjectTypes.Clear(); + ProcessObjectType(factType.RoleCollection[0].Role.RolePlayer, chain, visitedFactTypes, visitedObjectTypes); + // Record all object types that are in the chain. + chain.ObjectTypes.AddRange(visitedObjectTypes.Keys); } } private void ProcessObjectType(ObjectType objectType, Chain chain, Dictionary<FactType, object> visitedFactTypes, Dictionary<ObjectType, object> visitedObjectTypes) @@ -205,22 +211,14 @@ private readonly FactTypeMappingDictionary myDecidedFactTypeMappings; - // Stores a list of object types that had been considered valid top-level, but was later found to be deeply mapped away - private readonly ObjectTypeDictionary myInvalidObjectTypes; - // A single set of possible fact type mappings represented at a given iteration through all possible fact type mappings - private readonly ObjectTypeDictionary myPossibleTopLevelConceptTypes; - private readonly ObjectTypeDictionary myPossibleConceptTypes; - - public FactTypeMappingPermuter(FactTypeMappingDictionary predecidedManyToOneFactTypeMappings, FactTypeMappingDictionary predecidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { myPredecidedManyToOneFactTypeMappings = predecidedManyToOneFactTypeMappings; myPredecidedOneToOneFactTypeMappings = predecidedOneToOneFactTypeMappings; myUndecidedOneToOneFactTypeMappings = undecidedOneToOneFactTypeMappings; - int oneToOneFactTypeCount = predecidedOneToOneFactTypeMappings.Count + undecidedOneToOneFactTypeMappings.Count; - myDecidedFactTypeMappings = new FactTypeMappingDictionary(predecidedManyToOneFactTypeMappings.Count + oneToOneFactTypeCount); + myDecidedFactTypeMappings = new FactTypeMappingDictionary(predecidedManyToOneFactTypeMappings.Count + predecidedOneToOneFactTypeMappings.Count + undecidedOneToOneFactTypeMappings.Count); foreach (KeyValuePair<FactType, FactTypeMapping> pair in predecidedManyToOneFactTypeMappings) { @@ -230,11 +228,6 @@ { myDecidedFactTypeMappings.Add(pair.Key, pair.Value); } - - // Stores a list of object types that had been considered valid top-level, but was later found to be deeply mapped away - myInvalidObjectTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); - myPossibleTopLevelConceptTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); - myPossibleConceptTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); } /// <summary> @@ -248,13 +241,17 @@ private void PermuteFactTypeMappings() { + // UNDONE: We should consider whether we can determine what object types will collapse earlier in the process, which would allow us to + // potentially eliminate multiple permutations that have the same result. (Rationale: When an object type is collapsed, it doesn't matter + // whether the mappings away from it are shallow or deep; they both result in the same output.) + int largestChainCount; // Break up the chains of contiguous one-to-one fact types FactTypeChainer chainer = new FactTypeChainer(myPredecidedManyToOneFactTypeMappings, myPredecidedOneToOneFactTypeMappings, myUndecidedOneToOneFactTypeMappings); largestChainCount = chainer.Run(); // Perform one-time pass of top-level types for the decided mappings - PrecalculateDecidedConceptTypes(); + //PrecalculateDecidedConceptTypes(); // This is used in PermuteFactTypeMappings(). We allocate it once, here, for permformance reasons. FactTypeMappingList newlyDecidedFactTypeMappings = new FactTypeMappingList(largestChainCount); @@ -280,7 +277,7 @@ PermuteFactTypeMappings(chain.PossiblePermutations, chain.UndecidedOneToOneFactTypeMappings, newlyDecidedFactTypeMappings, deeplyMappedObjectTypes, 0); EliminateInvalidPermutations(chain); - CalculateTopLevelConceptTypes(chain); + FindSmallestPermutationsInTermsOfConceptTypes(chain); // Add each mapping from the optimal permutation to the "global" set of decided mappings. foreach (FactTypeMapping optimalMapping in ChooseOptimalPermutation(chain).Mappings) @@ -313,166 +310,165 @@ return null; } - private static Permutation ChooseOptimalPermutation(Chain chain) + private static void FindSmallestPermutationsInTermsOfConceptTypes(Chain chain) { - // UNDONE: This should do something smart! - PermutationList smallestPermutationsList = chain.SmallestPermutations; - Permutation firstFinalMappingState = smallestPermutationsList[0]; - smallestPermutationsList.Clear(); - return firstFinalMappingState; - } + int maxPossibleObjectTypes = chain.ObjectTypes.Count; - private void PrecalculateDecidedConceptTypes() - { - // Calculate decided top-level types (these are *not* final until individual permutations have been considered) - foreach (KeyValuePair<FactType, FactTypeMapping> pair in myDecidedFactTypeMappings) - { - ProcessEntity(new ProcessEntityState(pair.Value, null, null, null)); - } - } + // These object types definitely DO result in concept types, but MAY or MAY NOT result in top-level concept types + Dictionary<ObjectType, object> predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); - /// <summary> - /// An object type (A) is a concept type when: - /// 1. It is independent, or - /// 2. It is a subtype, or - /// 3. Another object type (B) is mapped to it, and - /// a. There exists a role being mapped to object type A on which there are no constraints, or - /// b. There exists a role being mapped to object type A on which there is not a preferred uniqueness. - /// - /// A concept type is a top-level concept type when: - /// 1. It is not deeply mapped towards any other concept type. - /// - /// As this method processes the ObjectType passed in it gradually (and probably not in the same pass) executes each of - /// the above checks to see whether the ObjectType is a concept type or top-level concept type. - /// </summary> - /// <param name="state"></param> - private void ProcessEntity(ProcessEntityState state) - { - ObjectType towards = state.Mapping.TowardsObjectType; - if (myInvalidObjectTypes.ContainsKey(towards)) + // These object types definitely DO NOT result in top-level concept types, but MAY or MAY NOT result in concept types + Dictionary<ObjectType, object> predecidedObjectTypesThatHaveDeepMappingsAway = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + + // By just examining the predecided mappings, we can determine the specified truth values for the following: + // Object Type is Concept Type {true, unknown} + // Object Type is Top Level Concept Type {false, unknown} + + foreach (FactTypeMapping mapping in chain.PredecidedManyToOneFactTypeMappings) { - return; - } - ObjectType from = state.Mapping.FromObjectType; - Role fromRole = state.Mapping.FromRole; - if (from.IsIndependent && !(fromRole is SubtypeMetaRole) && !myPossibleConceptTypes.ContainsKey(from)) - { - // Add the object type as a concept type if it's independent. - myPossibleConceptTypes.Add(from, true); - if (state.ConceptTypeGarbage != null) + Debug.Assert(mapping.MappingDepth == MappingDepth.Shallow); + if (!mapping.IsFromPreferredIdentifier) { - state.ConceptTypeGarbage.Add(from); + predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards[mapping.TowardsObjectType] = null; } } - // If the |from| OT is a primary identifier, DO NOT add the |towards| OT to the top-level list - // (Note that it doesn't mean it cannot be added earlier/later, but will not if only role played is primary identifier) - if (state.Mapping.IsFromPreferredIdentifier) + + foreach (FactTypeMapping mapping in chain.PredecidedOneToOneFactTypeMappings) { - return; - } - if (!myPossibleConceptTypes.ContainsKey(from)) - { - // All top-level concept types are at least concept types - myPossibleConceptTypes.Add(from, true); - if (state.ConceptTypeGarbage != null && !state.ConceptTypeGarbage.Contains(from)) + if (!mapping.IsFromPreferredIdentifier) { - state.ConceptTypeGarbage.Add(from); + predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards[mapping.TowardsObjectType] = null; } - } - MappingDepth mappingType = state.Mapping.MappingDepth; - // If the |from| OT is mapped away deeply, and has objects mapped to it, remove it and invalidate it as a possible top-level type - if (myPossibleTopLevelConceptTypes.ContainsKey(from) && mappingType == MappingDepth.Deep) - { - myPossibleTopLevelConceptTypes.Remove(from); - myInvalidObjectTypes.Add(from, true); - if (state.Restore != null) + if (mapping.FromRole is SubtypeMetaRole) { - state.Restore.Add(from); + predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards[mapping.FromObjectType] = null; } + if (mapping.MappingDepth == MappingDepth.Deep) + { + predecidedObjectTypesThatHaveDeepMappingsAway[mapping.FromObjectType] = null; + } } - // First clause in there because |from| could equal |towards|, and may be invalidated in prior conditional - if (!myInvalidObjectTypes.ContainsKey(towards) && !myPossibleTopLevelConceptTypes.ContainsKey(towards)) + + foreach (ObjectType objectType in chain.ObjectTypes) { - if (state.Garbage != null) + if (objectType.IsAnyIndependent()) { - state.Garbage.Add(towards); + predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards[objectType] = null; } - myPossibleTopLevelConceptTypes.Add(towards, true); } - } - /// <summary> - /// This method processes concept type and top-level concept type conditions gradually as it iterates over the chain, rather than - /// calculating top-level-ness immediately for every concept type. The final state of each concept type is valid after this - /// method is finished executing. - /// - /// See <see cref="ProcessEntity">ProcessEntity</see> for the algorithm. - /// </summary> - /// <param name="chain"></param> - private void CalculateTopLevelConceptTypes(Chain chain) - { - // The smallest overall mapping that we've found - int smallest = int.MaxValue; - // These dictionaries track the OTs that are temporarily removed or added for each permutation in the list - ObjectTypeList garbage = new ObjectTypeList(myDecidedFactTypeMappings.Count); - ObjectTypeList restore = new ObjectTypeList(myDecidedFactTypeMappings.Count); - ObjectTypeList conceptTypeGarbage = new ObjectTypeList(myDecidedFactTypeMappings.Count); - // Now include the permutations in the calculation of top-level types. - for (int i = 0; i < chain.PossiblePermutations.Count; i++) + Dictionary<ObjectType, object> permutationObjectTypesThatHaveNonPreferredIdentifierMappingsTowards = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + Dictionary<ObjectType, object> permutationObjectTypesThatHaveDeepMappingsAway = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + + Dictionary<ObjectType, object> notConceptTypes = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + Dictionary<ObjectType, object> nonTopLevelConceptTypes = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + Dictionary<ObjectType, object> topLevelConceptTypes = new Dictionary<ObjectType, object>(maxPossibleObjectTypes); + + PermutationList smallestPermutationsInTermsOfConceptTypes = chain.SmallestPermutationsInTermsOfConceptTypes; + + int minTopLevelConceptTypesCount = int.MaxValue; + int minNonTopLevelConceptTypesCount = int.MaxValue; + + foreach (Permutation permutation in chain.PossiblePermutations) { - garbage.Clear(); - restore.Clear(); - Permutation state = chain.PossiblePermutations[i]; - foreach (FactTypeMapping mapping in state.Mappings) + bool isNotOptimalPermutation = false; + + permutationObjectTypesThatHaveDeepMappingsAway.Clear(); + permutationObjectTypesThatHaveNonPreferredIdentifierMappingsTowards.Clear(); + + notConceptTypes.Clear(); + nonTopLevelConceptTypes.Clear(); + topLevelConceptTypes.Clear(); + + foreach (FactTypeMapping mapping in permutation.Mappings) { - ProcessEntityState entitystate = new ProcessEntityState(mapping, restore, garbage, conceptTypeGarbage); - ProcessEntity(entitystate); - if (myPossibleTopLevelConceptTypes.Count > smallest) + if (!mapping.IsFromPreferredIdentifier) { - break; + permutationObjectTypesThatHaveNonPreferredIdentifierMappingsTowards[mapping.TowardsObjectType] = null; } + if (mapping.MappingDepth == MappingDepth.Deep) + { + permutationObjectTypesThatHaveDeepMappingsAway[mapping.FromObjectType] = null; + } } - // Done for this state, so finalize and clean up - state.TopLevelConceptTypes = myPossibleTopLevelConceptTypes.Count; - state.ConceptTypes = myPossibleConceptTypes.Count; - if (state.TopLevelConceptTypes <= smallest) + + foreach (ObjectType objectType in chain.ObjectTypes) { - smallest = state.TopLevelConceptTypes; - PermutationList smallestList = chain.SmallestPermutations; - if (smallestList.Count > 0) + bool isIndependentOrSubtypeOrHasNonPreferredIdentifierMappingsTowards = predecidedObjectTypesThatAreIndependentOrSubtypesOrHaveNonPreferredIdentifierMappingsTowards.ContainsKey(objectType) || + permutationObjectTypesThatHaveNonPreferredIdentifierMappingsTowards.ContainsKey(objectType); + bool hasDeepMappingsAway = predecidedObjectTypesThatHaveDeepMappingsAway.ContainsKey(objectType) || permutationObjectTypesThatHaveDeepMappingsAway.ContainsKey(objectType); + + if (isIndependentOrSubtypeOrHasNonPreferredIdentifierMappingsTowards) { - if (smallestList[0].TopLevelConceptTypes > state.TopLevelConceptTypes) + if (hasDeepMappingsAway) { - smallestList.Clear(); + nonTopLevelConceptTypes[objectType] = null; + if ((topLevelConceptTypes.Count == minTopLevelConceptTypesCount) && (nonTopLevelConceptTypes.Count > minNonTopLevelConceptTypesCount)) + { + // We now have more non-top-level concept types than the minimum, and the same number of top-level concept types as the minimum, so throw this permutation out. + isNotOptimalPermutation = true; + break; + } } - // Be sure the logic works if you put this |else if| into the primary |if|. - else if (smallestList[0].ConceptTypes > state.ConceptTypes) + else { - smallestList.Clear(); + topLevelConceptTypes[objectType] = null; + if (topLevelConceptTypes.Count > minTopLevelConceptTypesCount) + { + // We now have more top-level concept types than the minimum, so throw this permutation out. + isNotOptimalPermutation = true; + break; + } } } - if (smallestList.Count == 0 || smallestList[0].ConceptTypes == state.ConceptTypes) - { - smallestList.Add(state); - } } - // Restore OTs removed from the |myPossibleTopLevelConceptTypes| collection; remove elements that were added to the collection - foreach (ObjectType ot in garbage) + + if (isNotOptimalPermutation) { - myPossibleTopLevelConceptTypes.Remove(ot); + // This isn't an optimal permutation, so go on to the next one. + continue; } - foreach (ObjectType ot in restore) + + Debug.Assert(topLevelConceptTypes.Count <= minTopLevelConceptTypesCount, "Permutations with greater than the minimum number of top-level concept types should have been rejected inline."); + + if (topLevelConceptTypes.Count < minTopLevelConceptTypesCount) { - myPossibleTopLevelConceptTypes.Add(ot, true); - myInvalidObjectTypes.Remove(ot); + // We have a new minimum number of top-level concept types (and hence a new minimum number of non-top-level concept types as well). + minTopLevelConceptTypesCount = topLevelConceptTypes.Count; + minNonTopLevelConceptTypesCount = nonTopLevelConceptTypes.Count; + smallestPermutationsInTermsOfConceptTypes.Clear(); } - foreach (ObjectType ot in conceptTypeGarbage) + else { - myPossibleConceptTypes.Remove(ot); + // We have the same number of top-level concept types as the minimum, so we need to check the number of non-top-level concept types. + if (nonTopLevelConceptTypes.Count > minTopLevelConceptTypesCount) + { + // This isn't an optimal permutation, so go on to the next one. + continue; + } + else if (nonTopLevelConceptTypes.Count < minNonTopLevelConceptTypesCount) + { + // We have a new minimum number of non-top-level concept type. + minNonTopLevelConceptTypesCount = nonTopLevelConceptTypes.Count; + smallestPermutationsInTermsOfConceptTypes.Clear(); + } } + permutation.SetConceptTypes(topLevelConceptTypes, nonTopLevelConceptTypes); + smallestPermutationsInTermsOfConceptTypes.Add(permutation); } } + + + private static Permutation ChooseOptimalPermutation(Chain chain) + { + // UNDONE: This should do something smart! + PermutationList smallestPermutationsInTermsOfConceptTypes = chain.SmallestPermutationsInTermsOfConceptTypes; + Permutation firstFinalMappingState = smallestPermutationsInTermsOfConceptTypes[0]; + //smallestPermutationsInTermsOfConceptTypes.Clear(); + return firstFinalMappingState; + } + /// <summary> /// Returns the maximum number of <see cref="Permutation"/>s that could result for the specified set of undecided <see cref="FactTypeMapping"/>s. /// </summary> @@ -632,4 +628,4 @@ } } #endregion -} +} \ No newline at end of file Modified: trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-30 17:21:57 UTC (rev 1100) +++ trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-30 17:24:00 UTC (rev 1101) @@ -55,7 +55,7 @@ } [Serializable] - [DebuggerDisplay("FactTypeMapping (TowardsRole={FactType.RoleCollection.IndexOf(FromRole)}, Depth={MappingDepth}, FactType={FactType.Name})")] + [DebuggerDisplay("FactTypeMapping (TowardsRole={FactType.RoleCollection.IndexOf(TowardsRoleDebug)}, Depth={MappingDepth}, FactType={FactType.Name})")] sealed class FactTypeMapping { private readonly FactType factType; @@ -106,6 +106,14 @@ get { return towardsRole; } } + /// <summary> + /// Used by the <see cref="DebuggerDisplayAttribute"/> for this type. + /// </summary> + private RoleBase TowardsRoleDebug + { + get { return (RoleBase)towardsRole.Proxy ?? towardsRole; } + } + public MappingDepth MappingDepth { get { return mappingDepth; } @@ -251,8 +259,8 @@ sealed class Permutation { private readonly FactTypeMappingList myMappings; - private int myTopLevelConceptTypes; - private int myConceptTypes; + private Dictionary<ObjectType, object> myTopLevelConceptTypes; + private Dictionary<ObjectType, object> myNonTopLevelConceptTypes; public Permutation(FactTypeMappingList mappings) { @@ -264,17 +272,28 @@ get { return myMappings; } } - public int TopLevelConceptTypes + public void SetConceptTypes(Dictionary<ObjectType, object> topLevelConceptTypes, Dictionary<ObjectType, object> nonTopLevelConceptTypes) { - get { return myTopLevelConceptTypes; } - set { myTopLevelConceptTypes = value; } + Debug.Assert(myTopLevelConceptTypes == null && myNonTopLevelConceptTypes == null); + myTopLevelConceptTypes = new Dictionary<ObjectType,object>(topLevelConceptTypes); + myNonTopLevelConceptTypes = new Dictionary<ObjectType,object>(nonTopLevelConceptTypes); } - public int ConceptTypes + public Dictionary<ObjectType, object> TopLevelConceptTypes { - get { return myConceptTypes; } - set { myConceptTypes = value; } + get + { + return myTopLevelConceptTypes; + } } + + public Dictionary<ObjectType, object> NonTopLevelConceptTypes + { + get + { + return myNonTopLevelConceptTypes; + } + } } [Serializable] @@ -302,19 +321,21 @@ [Serializable] sealed class Chain { + private readonly ObjectTypeList myObjectTypes; private readonly FactTypeMappingList myPredecidedManyToOneFactTypeMappings; private readonly FactTypeMappingList myPredecidedOneToOneFactTypeMappings; private readonly FactTypeMappingListList myUndecidedOneToOneFactTypeMappings; private readonly PermutationList myPossiblePermutations; - private readonly PermutationList mySmallestPermutations; + private readonly PermutationList mySmallestPermutationsInTermsOfConceptTypes; public Chain() { + myObjectTypes = new ObjectTypeList(); myPredecidedManyToOneFactTypeMappings = new FactTypeMappingList(); myPredecidedOneToOneFactTypeMappings = new FactTypeMappingList(); myUndecidedOneToOneFactTypeMappings = new FactTypeMappingListList(); myPossiblePermutations = new PermutationList(); - mySmallestPermutations = new PermutationList(); + mySmallestPermutationsInTermsOfConceptTypes = new PermutationList(); } /// <summary> @@ -329,6 +350,18 @@ } /// <summary> + /// The set of all <see cref="ObjectType"/>s that play a role in a one-to-one <see cref="FactType"/> + /// in this <see cref="Chain"/>. + /// </summary> + public ObjectTypeList ObjectTypes + { + get + { + return myObjectTypes; + } + } + + /// <summary> /// Many-to-one FactTypeMappings that are part of this chain but were decided before the permutation phase. /// </summary> public FactTypeMappingList PredecidedManyToOneFactTypeMappings @@ -367,11 +400,11 @@ } /// <summary> - /// The entries from PossiblePermutations which map to the smallest number of top-level concept types. + /// The entries from PossiblePermutations which map to the smallest number of top-level concept types and overall concept types. /// </summary> - public PermutationList SmallestPermutations + public PermutationList SmallestPermutationsInTermsOfConceptTypes { - get { return mySmallestPermutations; } + get { return mySmallestPermutationsInTermsOfConceptTypes; } } } #endregion Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-30 17:21:57 UTC (rev 1100) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-30 17:24:00 UTC (rev 1101) @@ -466,13 +466,13 @@ /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> private void FilterFactTypeMappings(FactTypeMappingDictionary decidedManyToOneFactTypeMappings, FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - RemoveImpossiblePotentialFactTypeMappings(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); - - int changeCount = 0; + bool changed; do { - changeCount = MapTrivialOneToOneFactTypesWithTwoMandatories(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); - } while (changeCount > 0); + RemoveImpossiblePotentialFactTypeMappings(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); + + changed = MapTrivialOneToOneFactTypesWithTwoMandatories(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings) > 0; + } while (changed); } #region Filter Algorithms Methods @@ -484,17 +484,15 @@ /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> private void RemoveImpossiblePotentialFactTypeMappings(FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - ObjectTypeList deeplyMappedObjectTypes = new ObjectTypeList(); + Dictionary<ObjectType, object> deeplyMappedObjectTypes = new Dictionary<ObjectType,object>(decidedOneToOneFactTypeMappings.Count + undecidedOneToOneFactTypeMappings.Count); // For each decided fact type mapping... - foreach (KeyValuePair<FactType, FactTypeMapping> decidedFactTypeMapping in decidedOneToOneFactTypeMappings) + foreach (FactTypeMapping factTypeMapping in decidedOneToOneFactTypeMappings.Values) { - FactTypeMapping factTypeMapping = decidedFactTypeMapping.Value; - // If it's a deep mapping... if (factTypeMapping.MappingDepth == MappingDepth.Deep) { - deeplyMappedObjectTypes.Add(factTypeMapping.FromObjectType); + deeplyMappedObjectTypes[factTypeMapping.FromObjectType] = null; } } @@ -511,13 +509,15 @@ FactTypeMapping potentialFactTypeMapping = potentialFactTypeMappings[i]; // If it is maped away from an ObjectType that is already determined to be mapped elsewhere... - if (deeplyMappedObjectTypes.Contains(potentialFactTypeMapping.FromObjectType) && potentialFactTypeMapping.MappingDepth == MappingDepth.Deep) + if (potentialFactTypeMapping.MappingDepth == MappingDepth.Deep && deeplyMappedObjectTypes.ContainsKey(potentialFactTypeMapping.FromObjectType)) { // Remove it as a possibility. potentialFactTypeMappings.RemoveAt(i); } } + Debug.Assert(potentialFactTypeMappings.Count > 0); + // If there is only one possibility left... if (potentialFactTypeMappings.Count == 1) { @@ -544,13 +544,12 @@ /// <returns>The number of previously potential one-to-one fact type mappings that are now decided.</returns> private int MapTrivialOneToOneFactTypesWithTwoMandatories(FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - int changeCount = 0; - FactTypeList factsPendingDeletion = new FactTypeList(); + FactTypeList factTypesPendingDeletion = new FactTypeList(); - foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedFactTypeMapping in undecidedOneToOneFactTypeMappings) + foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedPair in undecidedOneToOneFactTypeMappings) { - FactType factType = undecidedFactTypeMapping.Key; - FactTypeMappingList potentialFactTypeMappings = undecidedFactTypeMapping.Value; + FactType factType = undecidedPair.Key; + FactTypeMappingList potentialFactTypeMappings = undecidedPair.Value; LinkedElementCollection<RoleBase> roles = factType.RoleCollection; Debug.Assert(roles.Count == 2, "All fact type mappings should be for fact types with exactly two roles."); @@ -559,48 +558,77 @@ Role secondRole = roles[1].Role; ObjectType firstRolePlayer = firstRole.RolePlayer; ObjectType secondRolePlayer = secondRole.RolePlayer; - bool firstRoleIsMandatory = null != firstRole.SingleRoleAlethicMandatoryConstraint; - bool secondRoleIsMandatory = null != secondRole.SingleRoleAlethicMandatoryConstraint; // If this is a one-to-one fact type with two simple alethic mandatories... - if (firstRoleIsMandatory && secondRoleIsMandatory) + if (firstRole.SingleRoleAlethicMandatoryConstraint != null && secondRole.SingleRoleAlethicMandatoryConstraint != null) { + FactTypeMapping deepMappingTowardsFirstRole = null; + FactTypeMapping deepMappingTowardsSecondRole = null; + + // Find our potential deep mappings. + foreach (FactTypeMapping potentialFactTypeMapping in potentialFactTypeMappings) + { + if (potentialFactTypeMapping.MappingDepth == MappingDepth.Deep) + { + if (potentialFactTypeMapping.TowardsRole == firstRole) + { + deepMappingTowardsFirstRole = potentialFactTypeMapping; + } + else + { + Debug.Assert(potentialFactTypeMapping.TowardsRole == secondRole); + deepMappingTowardsSecondRole = potentialFactTypeMapping; + } + } + } + bool firstRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(firstRolePlayer, factType, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); bool secondRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(secondRolePlayer, factType, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); - // UNDONE: I think we need to be checking that the deep mappings we decide on here are actually in the list of potentials... - // UNDONE: Also, this can create new decided deep mappings, so we need to be applying the related filters after this runs. - - // TODO: This may not be strong enough. - // If secondRolePlayer has no possible deep mappings away from it... + // If secondRolePlayer has no possible deep mappings away from it, and firstRolePlayer does... if (firstRolePlayerHasPossibleDeepMappingsAway && !secondRolePlayerHasPossibleDeepMappingsAway) { - // Deep map toward firstRolePlayer - FactTypeMapping factTypeMapping = new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Deep); - - decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); - factsPendingDeletion.Add(factType); - ++changeCount; + // Make sure that this deep mapping was one of our potentials. + if (deepMappingTowardsFirstRole != null) + { + Debug.Assert(firstRole.SingleRoleAlethicUniquenessConstraint != null); + // Make sure we're not going towards a preferred identifier. Doing so is valid, and sometimes optimal, + // but not always, hence the permuter needs to consider it. + if (!firstRole.SingleRoleAlethicUniquenessConstraint.IsPreferred) + { + // Deep map toward firstRolePlayer + decidedOneToOneFactTypeMappings.Add(factType, deepMappingTowardsFirstRole); + factTypesPendingDeletion.Add(factType); + } + } } - else if (!firstRolePlayerHasPossibleDeepMappingsAway && secondRolePlayerHasPossibleDeepMappingsAway) // ...firstRolePlayer... + // ...and vice-versa... + else if (!firstRolePlayerHasPossibleDeepMappingsAway && secondRolePlayerHasPossibleDeepMappingsAway) { - // Deep map toward secondRolePlayer - FactTypeMapping factTypeMapping = new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Deep); - - decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); - factsPendingDeletion.Add(factType); - ++changeCount; + // Make sure that this deep mapping was one of our potentials. + if (deepMappingTowardsSecondRole != null) + { + Debug.Assert(secondRole.SingleRoleAlethicUniquenessConstraint != null); + // Make sure we're not going towards a preferred identifier. Doing so is valid, and sometimes optimal, + // but not always, hence the permuter needs to consider it. + if (!secondRole.SingleRoleAlethicUniquenessConstraint.IsPreferred) + { + // Deep map toward secondRolePlayer + decidedOneToOneFactTypeMappings.Add(factType, deepMappingTowardsSecondRole); + factTypesPendingDeletion.Add(factType); + } + } } } } // Delete each undecided (now decided) fact type mapping marked for deletion. - foreach (FactType key in factsPendingDeletion) + foreach (FactType key in factTypesPendingDeletion) { undecidedOneToOneFactTypeMappings.Remove(key); } - return changeCount; + return factTypesPendingDeletion.Count; } /// <summary> @@ -787,6 +815,16 @@ bool fromRoleIsPreferred = fromRoleUniquenessConstraint.IsPreferred; bool towardsRoleIsPreferred = towardsRoleUniquenessConstraint.IsPreferred; + // UNDONE: Once subtyping is handled correctly on the ORM side, this may need to be adjusted. + // If the from object type doesn't have its own preferred identifier and this is a primary subtyping relationship, mark it as being preferred. + if (!towardsRoleIsPreferred && factTypeIsSubtype && factTypeMapping.FromObjectType.PreferredIdentifier == null) + { + if (((SubtypeFact)factTypeMapping.FactType).IsPrimary) + { + towardsRoleIsPreferred = true; + } + } + RoleAssignment assimilatorConceptType = new RoleAssignment(ConceptTypeAssimilatesConceptType.AssimilatorConceptTypeDomainRoleId, towardsConceptType); RoleAssignment assimilatedConceptType = new RoleAssignment(ConceptTypeAssimilatesConceptType.AssimilatedConceptTypeDomainRoleId, fromConceptType); RoleAssignment[] roleAssignments = { assimilatorConceptType, assimilatedConceptType }; @@ -1071,7 +1109,7 @@ private bool ObjectTypeIsConceptType(ObjectType objectType, FactTypeMappingDictionary factTypeMappings) { // If objectType is independent... - if (objectType.IsIndependent) + if (objectType.IsAnyIndependent()) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:22:09
|
Revision: 1100 http://orm.svn.sourceforge.net/orm/?rev=1100&view=rev Author: mcurland Date: 2007-08-30 10:21:57 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Provides a basic and intelligent relational schema name generation algorithm, and reruns the algorithm on name changes to the conceptual model. Includes a minor name and access change on FactType. refs #334 Modified Paths: -------------- trunk/ORMModel/ObjectModel/FactType.cs trunk/ORMModel/Shell/ReadingEditor.cs trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj Added Paths: ----------- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs Modified: trunk/ORMModel/ObjectModel/FactType.cs =================================================================== --- trunk/ORMModel/ObjectModel/FactType.cs 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/ORMModel/ObjectModel/FactType.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -66,7 +66,7 @@ /// it will then create a new ReadingOrder. It operates under the assumption /// that a transaction has already been started. /// </summary> - public ReadingOrder GetReadingOrder(IList<RoleBase> roleOrder) + public ReadingOrder EnsureReadingOrder(IList<RoleBase> roleOrder) { ReadingOrder retVal = FindMatchingReadingOrder(roleOrder); if (retVal == null) @@ -118,7 +118,7 @@ /// the assumption that a transaction has already been started. /// </summary> /// <returns>Should always return a value unless there was an error creating the ReadingOrder</returns> - public ReadingOrder CreateReadingOrder(IList<RoleBase> roleOrder) + private ReadingOrder CreateReadingOrder(IList<RoleBase> roleOrder) { ReadingOrder retval = null; if (roleOrder.Count > 0) Modified: trunk/ORMModel/Shell/ReadingEditor.cs =================================================================== --- trunk/ORMModel/Shell/ReadingEditor.cs 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/ORMModel/Shell/ReadingEditor.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -1695,7 +1695,7 @@ myInsertedRow = row; using (Transaction t = store.TransactionManager.BeginTransaction(ResourceStrings.ModelReadingEditorNewReadingTransactionText)) { - ReadingOrder theOrder = myFact.GetReadingOrder(myReadingOrderKeyedCollection[row].RoleOrder); + ReadingOrder theOrder = myFact.EnsureReadingOrder(myReadingOrderKeyedCollection[row].RoleOrder); Debug.Assert(theOrder != null, "A ReadingOrder should have been found or created."); theNewReading = new Reading(store); LinkedElementCollection<Reading> readings = theOrder.ReadingCollection; @@ -2560,7 +2560,7 @@ { if (myReadingOrder == null) //obtain new readingOrder to commit a new reading (in readingOrder is non-existent) { - myReadingOrder = myParentBranch.Fact.GetReadingOrder(this.myRoleOrder); + myReadingOrder = myParentBranch.Fact.EnsureReadingOrder(this.myRoleOrder); } myReadingBranch = new ReadingBranch(myParentBranch.Fact, myReadingOrder, this); return myReadingBranch; Modified: trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -180,6 +180,98 @@ } } #endregion // Bridge element modification rules + #region Name modification rules + /// <summary> + /// ChangeRule: typeof(Neumont.Tools.ORMAbstraction.ConceptType) + /// </summary> + private static void ConceptTypeChangedRule(ElementPropertyChangedEventArgs e) + { + if (e.DomainProperty.Id == ConceptType.NameDomainPropertyId) + { + ValidateTableNameChanged(TableIsPrimarilyForConceptType.GetTable((ConceptType)e.ModelElement)); + } + } + /// <summary> + /// ChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.FactType) + /// </summary> + private static void FactTypeNameChangedRule(ElementPropertyChangedEventArgs e) + { + if (e.DomainProperty.Id == ORMCore.FactType.NameChangedDomainPropertyId) + { + foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild((ORMCore.FactType)e.ModelElement)) + { + ValidateConceptTypeChildNameChanged(child); + } + } + } + /// <summary> + /// ChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.Role) + /// </summary> + private static void RoleNameChangedRule(ElementPropertyChangedEventArgs e) + { + if (e.DomainProperty.Id == ORMCore.Role.NameDomainPropertyId) + { + ORMCore.FactType factType = ((ORMCore.Role)e.ModelElement).FactType; + if (factType != null) + { + foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType)) + { + ValidateConceptTypeChildNameChanged(child); + } + } + } + } + private static void ValidateConceptTypeChildNameChanged(ConceptTypeChild child) + { + if (child != null) + { + FrameworkDomainModel.DelayValidateElement(child, DelayValidateConceptTypeChildNameChanged); + } + } + [DelayValidatePriority(20, DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] + private static void DelayValidateConceptTypeChildNameChanged(ModelElement element) + { + if (!element.IsDeleted) + { + ConceptTypeChild child = (ConceptTypeChild)element; + foreach (Column column in ColumnHasConceptTypeChild.GetColumn(child)) + { + ValidateSchemaNamesChanged(column.Table.Schema); + break; + } + } + } + private static void ValidateTableNameChanged(Table table) + { + if (table != null) + { + FrameworkDomainModel.DelayValidateElement(table, DelayValidateTableNameChanged); + } + } + [DelayValidatePriority(20, DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] + private static void DelayValidateTableNameChanged(ModelElement element) + { + if (!element.IsDeleted) + { + ValidateSchemaNamesChanged(((Table)element).Schema); + } + } + private static void ValidateSchemaNamesChanged(Schema schema) + { + if (schema != null) + { + FrameworkDomainModel.DelayValidateElement(schema, DelayValidateSchemaNamesChanged); + } + } + [DelayValidatePriority(30, DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] + private static void DelayValidateSchemaNamesChanged(ModelElement element) + { + if (!element.IsDeleted) + { + NameGeneration.GenerateAllNames((Schema)element); + } + } + #endregion // Name modification rules } #endregion // Regeneration rule delay validation methods } Added: trunk/RelationalModel/OialDcilBridge/NameGeneration.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/NameGeneration.cs (rev 0) +++ trunk/RelationalModel/OialDcilBridge/NameGeneration.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -0,0 +1,508 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Neumont.Tools.ORM.ObjectModel; +using Microsoft.VisualStudio.Modeling; +using Neumont.Tools.ORMAbstraction; +using Neumont.Tools.ORMToORMAbstractionBridge; +using Neumont.Tools.RelationalModels.ConceptualDatabase; +using System.Text.RegularExpressions; +using System.Diagnostics; + +namespace Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge +{ + #region IDatabaseNameGenerator interface + /// <summary> + /// Generate relational names for elements contained in a <see cref="Schema"/> + /// </summary> + public interface IDatabaseNameGenerator + { + /// <summary> + /// Generate a name for the provided <paramref name="table"/> + /// </summary> + /// <param name="table">A <see cref="Table"/> element</param> + /// <param name="longerThan">Generate a more specific name than provided. + /// If this is set, then the passed in name will have been generated by + /// this method on this instance. Can be <see langword="null"/></param> + /// <returns>A name for <paramref name="table"/>.</returns> + string GenerateTableName(Table table, string longerThan); + /// <summary> + /// Generate a name for the provided <paramref name="column"/> + /// </summary> + /// <param name="column">A <see cref="Column"/> element</param> + /// <param name="longerThan">Generate a more specific name than provided. + /// If this is set, then the passed in name will have been generated by + /// this method on this instance. Can be <see langword="null"/></param> + /// <returns>A name for <paramref name="column"/>.</returns> + string GenerateColumnName(Column column, string longerThan); + /// <summary> + /// Generate a name for the provided <paramref name="constraint"/> + /// </summary> + /// <param name="constraint">A <see cref="Constraint"/> element</param> + /// <param name="longerThan">Generate a more specific name than provided. + /// If this is set, then the passed in name will have been generated by + /// this method on this instance. Can be <see langword="null"/></param> + /// <returns>A name for <paramref name="constraint"/>.</returns> + string GenerateConstraintName(Constraint constraint, string longerThan); + } + #endregion // IDatabaseNameGenerator interface + partial class ORMAbstractionToConceptualDatabaseBridgeDomainModel + { + private static class NameGeneration + { + #region GenerateAllNames method + public static void GenerateAllNames(Schema schema) + { + Dictionary<string, ConceptualDatabaseModelElement> tableNames = new Dictionary<string, ConceptualDatabaseModelElement>(); + Dictionary<string, ConceptualDatabaseModelElement> tempNames = new Dictionary<string, ConceptualDatabaseModelElement>(); + LinkedElementCollection<Table> tables = schema.TableCollection; + foreach (Table table in tables) + { + CallGeneratorForTableName(table, tableNames, null); + + //column names + tempNames.Clear(); + LinkedElementCollection<Column> columns = table.ColumnCollection; + foreach (Column column in columns) + { + CallGeneratorForColumnName(column, tempNames, null); + } + + //constraint names + LinkedElementCollection<ReferenceConstraint> constraints; + if ((constraints = table.ReferenceConstraintCollection) != null) + { + tempNames.Clear(); + foreach (ReferenceConstraint constraint in constraints) + { + CallGeneratorForConstraintName(constraint, tempNames, null); + } + } + } + } + #endregion // GenerateAllNames method + #region private helper methods + private static void CallGeneratorForTableName(Table table, Dictionary<string, ConceptualDatabaseModelElement> tableNames, string tableName) + { + CallGenerator(table, tableNames, tableName, + new GeneratorCall(delegate(ConceptualDatabaseModelElement element, string longerThan) + { + return GenerateTableName(element as Table, longerThan); + })); + } + private static void CallGeneratorForColumnName(Column column, Dictionary<string, ConceptualDatabaseModelElement> columnNames, string columnName) + { + CallGenerator(column, columnNames, columnName, + new GeneratorCall(delegate(ConceptualDatabaseModelElement element, string longerThan) + { + return GenerateColumnName(element as Column, longerThan); + })); + } + private static void CallGeneratorForConstraintName(Constraint constraint, Dictionary<string, ConceptualDatabaseModelElement> constraintNames, string constraintName) + { + CallGenerator(constraint, constraintNames, constraintName, + new GeneratorCall(delegate(ConceptualDatabaseModelElement element, string longerThan) + { + return GenerateConstraintName(element as Constraint, longerThan); + })); + } + delegate string GeneratorCall(ConceptualDatabaseModelElement element, string longerThan); + private static void CallGenerator(ConceptualDatabaseModelElement element, Dictionary<string, ConceptualDatabaseModelElement> existingNames, string curName, GeneratorCall generatorCall) + { + ConceptualDatabaseModelElement nameConflictElement = null; + while (true) + { + if (nameConflictElement != null) + { + existingNames[curName] = null; + CallGenerator(nameConflictElement, existingNames, curName, generatorCall); + } + curName = generatorCall(element, curName); + + if (existingNames.ContainsKey(curName)) + { + nameConflictElement = existingNames[curName]; + } + else + { + break; + } + } + existingNames.Add(curName, element); + Table table; + Column column; + Constraint constraint; + if ((constraint = element as Constraint) != null) + { + constraint.Name = curName; + } + else if ((column = element as Column) != null) + { + column.Name = curName; + } + else if ((table = element as Table) != null) + { + table.Name = curName; + } + } + #endregion // private helper methods + #region UNDONE: temporary static imitation of an IDatabaseNameGenerator implementation + private static Regex myReplaceStrings; + private static Regex myIsNumber; + // UNDONE: This field will not remain static when this is moved + // into an object model with additional information + private static Dictionary<string, int> myCounts; + private static string GenerateTableName(Table table, string longerThan) + { + CasingOption tableCase = CasingOption.Pascal; + string tableStringReplace = ""; + + ConceptType primaryConceptType = TableIsPrimarilyForConceptType.GetConceptType(table); + LinkedElementCollection<ConceptType> secondaryConceptTypes = TableIsAlsoForConceptType.GetConceptType(table); + StringBuilder name = new StringBuilder(); + name.Append(primaryConceptType.Name); + if (secondaryConceptTypes != null) + { + foreach (ConceptType conceptType in secondaryConceptTypes) + { + name.Append(conceptType.Name); + if (longerThan == null || FinalizeName(name.ToString(), tableCase, tableStringReplace) != longerThan) + { + break; + } + } + } + + if (myCounts != null) + { + myCounts.Clear(); + } + + string finalName = FinalizeName(name.ToString(), tableCase, tableStringReplace); + while (finalName == longerThan) + { + finalName += "_"; + } + return finalName; + } + private static string GenerateColumnName(Column column, string longerThan) + { + CasingOption columnCasing = CasingOption.Pascal; + string columnStringReplace = ""; + + string finalName; + LinkedElementCollection<ConceptTypeChild> path = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column); + if (path.Count < 1) + { + finalName = FinalizeName(column.Name, columnCasing, columnStringReplace); + return EnsureDiff(finalName, longerThan); + } + + Guid tableObjectTypeID = ConceptTypeIsForObjectType.GetObjectType(TableIsPrimarilyForConceptType.GetConceptType(column.Table)).Id; + StringBuilder name = new StringBuilder(); + + bool hasUnary = false; + int predicateTextCount = 0; + bool alwaysKeepText = false; + bool hasRoleOrHyphenBound = false; + foreach (ConceptTypeChild link in path) + { + LinkedElementCollection<FactType> factTypes = ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(link); + //get a role name for each fact type, or generate one from the reading + foreach (FactType factType in factTypes) + { + string roleName; + LinkedElementCollection<RoleBase> factTypeRoles = factType.RoleCollection; + int? unaryRoleIndex = FactType.GetUnaryRoleIndex(factTypeRoles); + if (unaryRoleIndex.HasValue) + { + Role unaryRole = factTypeRoles[unaryRoleIndex.Value].Role; + //get the role name, if supplied + roleName = unaryRole.Name; + if (string.IsNullOrEmpty(roleName)) + { + if (IsPreferredIdentifierFactType(factType, unaryRole)) + { + alwaysKeepText = true; + //we don't generate a role name from the reading if the fact type participates in the primary reference scheme + continue; + } + + roleName = GetRoleName(factType, factTypeRoles, unaryRole, unaryRoleIndex, ref hasRoleOrHyphenBound); + } + else + { + hasRoleOrHyphenBound = true; + } + hasUnary = true; + } + else + { + RoleBase towardsRoleBase = FactTypeMapsTowardsRole.GetTowardsRole(factType); + RoleBase oppositeRoleBase = towardsRoleBase.OppositeRoleAlwaysResolveProxy; + roleName = oppositeRoleBase.Role.Name; + if (string.IsNullOrEmpty(roleName)) + { + if (IsPreferredIdentifierFactType(factType, towardsRoleBase.Role)) + { + alwaysKeepText = true; + continue; + } + + roleName = GetRoleName(factType, factTypeRoles, oppositeRoleBase, null, ref hasRoleOrHyphenBound); + } + else + { + hasRoleOrHyphenBound = true; + } + } + if (!string.IsNullOrEmpty(roleName)) + { + ++predicateTextCount; + } + name.Append(roleName); + } + + //value type name + InformationTypeFormat informationTypeFormat; + if ((informationTypeFormat = link.Target as InformationTypeFormat) != null) + { + string valueTypeName = ""; + + //check if this value type is the preferred identifier, + //and if so prepend the object type name to the value type name + LinkedElementCollection<ConceptType> types = informationTypeFormat.ConceptTypeCollection; + if (types.Count == 1) + { + ObjectType preferredFor = ConceptTypeIsForObjectType.GetObjectType(types[0]); + LinkedElementCollection<Role> identifiers = preferredFor.ResolvedPreferredIdentifier.RoleCollection; + if (identifiers.Count == 1) + { + if (identifiers[0].RolePlayer.Id == InformationTypeFormatIsForValueType.GetValueType(informationTypeFormat).Id) + { + if (!informationTypeFormat.Name.StartsWith(preferredFor.Name)) + { + valueTypeName = preferredFor.Name + "_"; + } + } + } + } + + valueTypeName += informationTypeFormat.Name; + + if (!hasUnary || (longerThan != null && longerThan == FinalizeName(name.ToString(), columnCasing, columnStringReplace))) + { + if (!(hasRoleOrHyphenBound || alwaysKeepText) && (predicateTextCount == 1 && + (longerThan == null || longerThan != FinalizeName(valueTypeName, columnCasing, columnStringReplace)))) + { + //if the only existing text is a single role name generated from predicate text, remove it + name.Remove(0, name.Length); + name.Append(valueTypeName); + } + else if (!hasRoleOrHyphenBound || FinalizeName(name.ToString(), columnCasing, columnStringReplace) == longerThan) + { + name.Append(valueTypeName); + } + } + } + } + + finalName = FinalizeName(name.ToString(), columnCasing, columnStringReplace); + return EnsureDiff(finalName, longerThan); + } + + private static string GenerateConstraintName(Constraint constraint, string longerThan) + { + ReferenceConstraint refConstraint = constraint as ReferenceConstraint; + if (refConstraint != null) + { + StringBuilder name = new StringBuilder(refConstraint.SourceTable.Name); + name.Append("_FK"); + return EnsureDiff(name.ToString(), longerThan); + } + return constraint.Name; + } + private enum CasingOption + { + Pascal, + Camel, + Flat, + Upper, + } + private static string FinalizeName(string name, CasingOption casing, string spaceReplaceString) + { + for (int i = name.Length; --i > -1; ) + { + if (char.IsUpper(name, i)) + { + name = name.Insert(i, " "); + } + } + + string[] words = name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + if (words.Length > 0) + { + switch (casing) + { + case CasingOption.Camel: + words[0] = words[0].ToLowerInvariant(); + CapitalizeWords(words, 1); + break; + case CasingOption.Pascal: + CapitalizeWords(words, 0); + break; + } + StringBuilder builder = new StringBuilder(words[0]); + for (int i = 1; i < words.Length; ++i) + { + builder.Append(spaceReplaceString); + builder.Append(words[i]); + } + name = builder.ToString(); + + switch (casing) + { + case CasingOption.Flat: + name = name.ToLowerInvariant(); + break; + case CasingOption.Upper: + name = name.ToUpperInvariant(); + break; + } + } + else + { + name = ""; + } + + return name; + } + + private static void CapitalizeWords(string[] words, int startIndex) + { + for (int i = startIndex; i < words.Length; ++i) + { + words[i] = System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(words[i]); + } + } + private static string EnsureDiff(string name, string longerThan) + { + if (longerThan != null && longerThan.StartsWith(name)) + { + bool isSame = name == longerThan; + if (!isSame) + { + if (myIsNumber == null) + { + myIsNumber = new Regex(@"\d+", RegexOptions.RightToLeft | RegexOptions.Compiled); + } + string endNumbers = longerThan.Substring(name.Length); + Match longerThanMatches = myIsNumber.Match(endNumbers); + if (longerThanMatches.Success && longerThanMatches.Index + longerThanMatches.Length == endNumbers.Length) + { + isSame = true; + } + } + + if (isSame) + { + if (myCounts == null) + { + myCounts = new Dictionary<string, int>(); + } + int curCount; + if (myCounts.ContainsKey(name)) + { + curCount = myCounts[name]; + ++myCounts[name]; + } + else + { + curCount = 1; + myCounts.Add(name, 2); + } + name += curCount.ToString(); + } + } + return name; + } + private static bool IsPreferredIdentifierFactType(FactType factType, Role role) + { + return role.RolePlayer.ResolvedPreferredIdentifier.FactTypeCollection.Contains(factType); + } + private static ReadingOrder GetReading(FactType factType, Role role, bool isUnary) + { + if (!isUnary) + { + //get the reading in the correct direction, if possible + ReadingOrder readingOrder = factType.FindMatchingReadingOrder(new RoleBase[] { role.OppositeRoleAlwaysResolveProxy, role }); + if (null != readingOrder) + { + return readingOrder; + } + } + + LinkedElementCollection<ReadingOrder> readingOrders = factType.ReadingOrderCollection; + + foreach (ReadingOrder readingOrder in readingOrders) + { + return readingOrder; + } + + //if there is no reading return the object type name + return null; + } + private static string GetRoleName(FactType factType, LinkedElementCollection<RoleBase> factTypeRoles, RoleBase role, int? unaryRoleIndex, ref bool alwaysKeepText) + { + string roleName = role.Role.Name; + if (string.IsNullOrEmpty(roleName)) + { + roleName = GetRoleNameFromPredicateText(factType, factTypeRoles, role, unaryRoleIndex, ref alwaysKeepText); + } + return roleName; + } + private static string GetRoleNameFromPredicateText(FactType factType, LinkedElementCollection<RoleBase> factTypeRoles, RoleBase role, int? unaryRoleIndex, ref bool alwaysKeepText) + { + bool isUnary = unaryRoleIndex.HasValue; + ReadingOrder readingOrder = GetReading(factType, role.Role, isUnary); + string rolePlayerName = role.Role.RolePlayer.Name; + if (readingOrder == null) + { + return rolePlayerName; + } + else + { + IReading reading = readingOrder.PrimaryReading; + // UNDONE: The hyphen binder does a lot of stuff we don't need, including + // building replacement strings for each role and rebuilding the predicate text. + // Add another method to the hyphenBinder to support binding one role only. + VerbalizationHyphenBinder hyphenBinder = new VerbalizationHyphenBinder(reading, factTypeRoles, unaryRoleIndex, "{0}{{0}}{1}"); + string hyphenBoundRolePlayerName = hyphenBinder.HyphenBindRoleReplacement(rolePlayerName, factTypeRoles.IndexOf(role)); + if ((object)hyphenBoundRolePlayerName != (object)rolePlayerName) + { + alwaysKeepText = true; + // The hyphen binder had an opinion + return hyphenBoundRolePlayerName; + } + string text = reading.Text; + if (myReplaceStrings == null) + { + myReplaceStrings = new Regex(@"{\d+}", RegexOptions.Compiled); + } + text = myReplaceStrings.Replace(text, ""); + text = text.Replace(" a ", " ").Replace(" an ", " ").Replace(" the ", " "); + if (!isUnary) + { + text = text.Replace(" has ", " "); + } + else if (text.Trim().ToLowerInvariant() == "has") + { + text = " "; + } + return text; + } + } + #endregion //UNDONE: temporary static immitation of an IDatabaseNameGenerator implementation + } + } +} Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -38,10 +38,13 @@ typeof(ModificationTracker).GetNestedType("AssimilationMappingAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("AssimilationMappingChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("ConceptTypeAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(ModificationTracker).GetNestedType("ConceptTypeChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("ConceptTypeChildChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("ConceptTypeDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(ModificationTracker).GetNestedType("FactTypeNameChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("InformationTypeFormatAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("InformationTypeFormatDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(ModificationTracker).GetNestedType("RoleNameChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("UniquenessDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AssimilationMapping).GetNestedType("AssimilationMappingAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AssimilationMapping).GetNestedType("AssimilationMappingChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic)}; @@ -78,7 +81,7 @@ { Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager; Type[] disabledRuleTypes = ORMAbstractionToConceptualDatabaseBridgeDomainModel.CustomDomainModelTypes; - for (int i = 0; i < 11; ++i) + for (int i = 0; i < 14; ++i) { ruleManager.EnableRule(disabledRuleTypes[i]); } @@ -199,6 +202,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeAddedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORMAbstraction.ConceptType))] + private sealed class ConceptTypeChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public ConceptTypeChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker + /// /// <summary> + /// /// ChangeRule: typeof(Neumont.Tools.ORMAbstraction.ConceptType) + /// /// </summary> + /// private static void ConceptTypeChangedRule(ElementPropertyChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementPropertyChanged(Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeChangedRule"); + ModificationTracker.ConceptTypeChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORMAbstraction.ConceptTypeChild))] private sealed class ConceptTypeChildChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule { @@ -251,6 +280,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeDeletedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.FactType))] + private sealed class FactTypeNameChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public FactTypeNameChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker + /// /// <summary> + /// /// ChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.FactType) + /// /// </summary> + /// private static void FactTypeNameChangedRule(ElementPropertyChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementPropertyChanged(Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.FactTypeNameChangedRule"); + ModificationTracker.FactTypeNameChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.FactTypeNameChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORMAbstraction.AbstractionModelHasInformationTypeFormat))] private sealed class InformationTypeFormatAddedRuleClass : Microsoft.VisualStudio.Modeling.AddRule { @@ -303,6 +358,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.InformationTypeFormatDeletedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.Role))] + private sealed class RoleNameChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public RoleNameChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker + /// /// <summary> + /// /// ChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.Role) + /// /// </summary> + /// private static void RoleNameChangedRule(ElementPropertyChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementPropertyChanged(Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.RoleNameChangedRule"); + ModificationTracker.RoleNameChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.RoleNameChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(UniquenessConstraintIsForUniqueness))] private sealed class UniquenessDeletedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule { Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml 2007-08-30 17:21:57 UTC (rev 1100) @@ -29,18 +29,27 @@ <arg:AddRule methodName="ConceptTypeAddedRule"> <arg:RuleOn targetType="AbstractionModelHasConceptType" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:AddRule> + <arg:ChangeRule methodName="ConceptTypeChangedRule"> + <arg:RuleOn targetType="ConceptType" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> + </arg:ChangeRule> <arg:ChangeRule methodName="ConceptTypeChildChangedRule"> <arg:RuleOn targetType="ConceptTypeChild" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:ChangeRule> <arg:DeleteRule methodName="ConceptTypeDeletedRule"> <arg:RuleOn targetType="AbstractionModelHasConceptType" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:DeleteRule> + <arg:ChangeRule methodName="FactTypeNameChangedRule"> + <arg:RuleOn targetType="FactType" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:ChangeRule> <arg:AddRule methodName="InformationTypeFormatAddedRule"> <arg:RuleOn targetType="AbstractionModelHasInformationTypeFormat" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:AddRule> <arg:DeleteRule methodName="InformationTypeFormatDeletedRule"> <arg:RuleOn targetType="AbstractionModelHasInformationTypeFormat" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:DeleteRule> + <arg:ChangeRule methodName="RoleNameChangedRule"> + <arg:RuleOn targetType="Role" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:ChangeRule> <arg:DeleteRule methodName="UniquenessDeletedRule"> <arg:RuleOn targetType="UniquenessConstraintIsForUniqueness"/> </arg:DeleteRule> Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:21:57 UTC (rev 1100) @@ -196,7 +196,7 @@ } // Change all names to a more apropriate verson. - //NameGeneration.GenerateAllNames(schema); + NameGeneration.GenerateAllNames(schema); } /// <summary> Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-30 17:19:27 UTC (rev 1099) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-30 17:21:57 UTC (rev 1100) @@ -134,6 +134,7 @@ <Compile Include="AssimilationMapping.cs" /> <Compile Include="MappingCustomizationModel.cs" /> <Compile Include="ModificationTracker.cs" /> + <Compile Include="NameGeneration.cs" /> <Compile Include="OialDcilBridge.AttachRules.cs"> <AutoGen>True</AutoGen> <DependentUpon>OialDcilBridge.AttachRules.xml</DependentUpon> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-30 17:14:29
|
Revision: 1098 http://orm.svn.sourceforge.net/orm/?rev=1098&view=rev Author: mcurland Date: 2007-08-30 10:14:17 -0700 (Thu, 30 Aug 2007) Log Message: ----------- Fixed a problem with assimilation chains not mapping correctly, refs #328. Modified Paths: -------------- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:12:15 UTC (rev 1097) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-30 17:14:17 UTC (rev 1098) @@ -70,7 +70,9 @@ #endregion // AssimilationPath structure /// <summary> - /// + /// Generates the conceptual database model for a given Schema and AbstractionModel. + /// The generation of the Conceptual Database Model includes the population of all tables with + /// Columns, Uniquenesses, Foreign Keys, and Manditory restrictions. /// </summary> private static void FullyGenerateConceptualDatabaseModel(Schema schema, AbstractionModel sourceModel) { @@ -90,7 +92,6 @@ // new DomainIsForInformationTypeFormat(domain, itf); // notifyAdded.ElementAdded(domain, true); //} - Dictionary<TableIsAlsoForConceptType, AssimilationPath> assimilationPath = new Dictionary<TableIsAlsoForConceptType, AssimilationPath>(); Dictionary<Column, List<ConceptTypeChild>> columnHasConceptTypeChildPath = new Dictionary<Column, List<ConceptTypeChild>>(); @@ -131,20 +132,26 @@ // Create the table mappings for all Absorption and Partioning cases Dictionary<ConceptType, List<ConceptType>> mappingPaths = new Dictionary<ConceptType, List<ConceptType>>(); Dictionary<ConceptType, ConceptType> pathDictonary = new Dictionary<ConceptType, ConceptType>(); + + // When there is a assimilation path larger then a single assimilation, it is possible the grandchild elements + // will not intially map to the superparent table + // With the do / while we iterate through the assimilations, mapping the closest, and then using that mapping to find the correct mapping + // for it's children. do { - foreach (KeyValuePair<ConceptType, ConceptTypeAssimilatesConceptType> conceptType in assimilatedConceptTypes) + foreach (KeyValuePair<ConceptType, ConceptTypeAssimilatesConceptType> keyedAssimilation in assimilatedConceptTypes) { - if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(conceptType.Value) == AssimilationAbsorptionChoice.Absorb) - { - MapAbsorbedConceptType(conceptType.Key, pathDictonary, allAssimilations, assimilationPath, new List<ConceptTypeAssimilatesConceptType>()); - } - else if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(conceptType.Value) == AssimilationAbsorptionChoice.Partition) - { - MapPartitionedConceptType(conceptType.Key, mappingPaths, pathDictonary, allAssimilations, assimilationPath, new List<ConceptTypeAssimilatesConceptType>()); - } + if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(keyedAssimilation.Value) == AssimilationAbsorptionChoice.Absorb) + { + MapAbsorbedConceptType(keyedAssimilation.Key, pathDictonary, allAssimilations, assimilationPath, new List<ConceptTypeAssimilatesConceptType>()); + } + else if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(keyedAssimilation.Value) == AssimilationAbsorptionChoice.Partition) + { + MapPartitionedConceptType(keyedAssimilation.Key, mappingPaths, pathDictonary, allAssimilations, assimilationPath, new List<ConceptTypeAssimilatesConceptType>()); + } } } while (pathDictonary.ContainsValue(null)); + foreach (KeyValuePair<ConceptType, List<ConceptType>> kvp in mappingPaths) { foreach (ConceptType myConceptType in kvp.Value) @@ -187,10 +194,14 @@ CreateForeignKeys(table); GenerateMandatoryConstraints(table); } + + // Change all names to a more apropriate verson. + //NameGeneration.GenerateAllNames(schema); } /// <summary> - /// Gets all ConceptType Assimilates ConceptType retaitions containing a given ConceptType as either the Asimmilator or the Assimilated ConceptType + /// Gets all ConceptType Assimilates ConceptType retaitions containing a given ConceptType as either the Asimmilator + /// or the Assimilated ConceptType. /// </summary> private static IEnumerable<ConceptTypeAssimilatesConceptType> GetAssimilationsForConceptType(ConceptType conceptType) { @@ -206,7 +217,7 @@ /// <summary> /// Maps all Absorbed ConceptTypes - /// For a ConceptType it finds the Primary Tables that they map to, + /// for a ConceptType it finds the Primary Tables that they map to, /// and then map a TableIsAlsoForConceptType to the Primary Table with that ConceptType. /// </summary> /// <param name="conceptType">The ConceptType that is to be checked for Absorbtion.</param> @@ -245,9 +256,13 @@ } else if (assimilatedConceptTypes.ContainsKey(assimilation.AssimilatorConceptType) && assimilatedConceptTypes[conceptType] == null) { - assimilatedConceptTypes[conceptType] = assimilatedConceptTypes[assimilation.AssimilatorConceptType]; - TableIsAlsoForConceptType tableForConceptType = new TableIsAlsoForConceptType(TableIsPrimarilyForConceptType.GetTable(assimilatedConceptTypes[assimilation.AssimilatorConceptType]), conceptType); - assimilationPathDictionary[tableForConceptType] = new AssimilationPath(assimilationPath); + ConceptType targetMappingPath = assimilatedConceptTypes[assimilation.AssimilatorConceptType]; + if (targetMappingPath != null) + { + assimilatedConceptTypes[conceptType] = targetMappingPath; + TableIsAlsoForConceptType tableForConceptType = new TableIsAlsoForConceptType(TableIsPrimarilyForConceptType.GetTable(targetMappingPath), conceptType); + assimilationPathDictionary[tableForConceptType] = new AssimilationPath(assimilationPath); + } } else { @@ -288,7 +303,7 @@ assimilationPath.Add(assimilation); Table isPrimarilyForTable = TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatedConceptType); - if (isPrimarilyForTable != null) + if (isPrimarilyForTable != null && !TableIsAlsoForConceptType.GetConceptType(isPrimarilyForTable).Contains(conceptType)) { TableIsAlsoForConceptType tableIsAlsoForConceptType = new TableIsAlsoForConceptType(isPrimarilyForTable, conceptType); assimilationPathDictionary[tableIsAlsoForConceptType] = new AssimilationPath(assimilationPath); @@ -333,6 +348,10 @@ { columnsForConceptType.AddRange(GetColumnsForConceptTypeChild(assimilatedConceptType, new List<ConceptTypeChild>())); } + else if (assimilatedConceptType.GetType() == typeof(InformationType)) + { + //columnsForConceptType.AddRange(GetColumnsForConceptTypeChild(assimilatedConceptType, new List<ConceptTypeChild>())); + } } // TESTING - UNDONE#1 -- Not needed, should be contained within the first Foreach //foreach(ConceptTypeChild relatedConceptType in preferredConceptTypeChildList) @@ -403,6 +422,11 @@ { Column clonedColumn = new Column(column.Store, new PropertyAssignment[] { new PropertyAssignment(Column.NameDomainPropertyId, column.Name) }); List<ConceptTypeChild> clonedConceptTypeChildPath = new List<ConceptTypeChild>(ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)); + if (!assimilationPath.ContainsKey(table)) + { + assimilationPath[table] = new AssimilationPath(new List<ConceptTypeAssimilatesConceptType>(ConceptTypeAssimilatesConceptType.GetLinksToAssimilatedConceptTypeCollection(conceptType))); + } + AssimilationPath assimPath = new AssimilationPath(assimilationPath[table].Path); int inumerator = 0; @@ -607,7 +631,7 @@ } /// <summary> - /// + /// DoSeperation handles the generation of columns and foreign keys when an assimilation is set to seperate. /// </summary> private static void DoSeparation(ConceptTypeAssimilatesConceptType assimilation, ref bool isPreferredForChildFound) { @@ -660,20 +684,51 @@ else if (assimilation.IsMandatory) { ReferenceConstraint referenceConstraint = new ReferenceConstraint(assimilation.Store, new PropertyAssignment[] { new PropertyAssignment(ReferenceConstraint.NameDomainPropertyId, assimilation.Name) }); - TableContainsReferenceConstraint tableContainsReferenceConstraint = new TableContainsReferenceConstraint(TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatorConceptType), referenceConstraint); - ReferenceConstraintTargetsTable referenceConstraintTargetsTable = new ReferenceConstraintTargetsTable(referenceConstraint, table); + TableContainsReferenceConstraint tableContainsReferenceConstraint = new TableContainsReferenceConstraint(TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatedConceptType), referenceConstraint); + ReferenceConstraintTargetsTable referenceConstraintTargetsTable = new ReferenceConstraintTargetsTable(referenceConstraint, TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatorConceptType)); + LinkedElementCollection<ConceptType> assimilations; + ConceptType conceptType = assimilation.AssimilatedConceptType; + List<Column> primaryIdentifierColumns = new List<Column>(); - // UC + bool primaryIdentifierFound = false; + while ((assimilations = conceptType.AssimilatorConceptTypeCollection).Count != 0 && !primaryIdentifierFound) + { + Table primaryTable = TableIsPrimarilyForConceptType.GetTable(conceptType); - List<Column> primaryIdentifierColumns = ConceptTypeHasPrimaryIdentifierColumns(null, assimilation.AssimilatedConceptType); + conceptType = assimilations[0]; + if (primaryTable != null) + { + + foreach (UniquenessConstraint uniqueness in primaryTable.UniquenessConstraintCollection) + { + if (uniqueness.IsPrimary) + { + primaryIdentifierColumns.AddRange(uniqueness.ColumnCollection); + assimilation.IsMandatory = true; + primaryIdentifierFound = true; + } + } + } + + } + if (primaryIdentifierColumns.Count == 0) + { + primaryIdentifierColumns.AddRange(GetColumnsForConceptTypeChild(assimilation as ConceptTypeChild, new List<ConceptTypeChild>())); + } + foreach (Column identifierColumn in primaryIdentifierColumns) { Column clonedColumn = new Column(identifierColumn.Store, new PropertyAssignment[] { new PropertyAssignment(Column.NameDomainPropertyId, identifierColumn.Name) }); List<ConceptTypeChild> clonedConceptTypeChildPath = new List<ConceptTypeChild>(ColumnHasConceptTypeChild.GetConceptTypeChildPath(identifierColumn)); + + foreach (ConceptTypeChild conceptTypeChild in clonedConceptTypeChildPath) + { + conceptTypeChild.IsMandatory = true; + } ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).Clear(); ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).AddRange(clonedConceptTypeChildPath); - ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).Insert(0, (ConceptTypeChild)assimilation); - TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatorConceptType).ColumnCollection.Add(clonedColumn); + + TableIsPrimarilyForConceptType.GetTable(assimilation.AssimilatedConceptType).ColumnCollection.Add(clonedColumn); ColumnReference relationship = new ColumnReference(clonedColumn, identifierColumn); referenceConstraint.ColumnReferenceCollection.Add(relationship); } @@ -684,8 +739,6 @@ if (targetTable != null) { - - ReferenceConstraint referenceConstraint = new ReferenceConstraint(assimilation.Store, new PropertyAssignment[] { new PropertyAssignment(ReferenceConstraint.NameDomainPropertyId, assimilation.Name) }); TableContainsReferenceConstraint tableContainsReferenceConstraint = new TableContainsReferenceConstraint(table, referenceConstraint); ReferenceConstraintTargetsTable referenceConstraintTargetsTable = new ReferenceConstraintTargetsTable(referenceConstraint, targetTable); @@ -693,14 +746,52 @@ UniquenessConstraint mappedConstraint = new UniquenessConstraint(assimilation.Store, new PropertyAssignment[] { new PropertyAssignment(UniquenessConstraint.NameDomainPropertyId, "Constraint") }); mappedConstraint.IsPrimary = true; - List<Column> primaryIdentifierColumns = ConceptTypeHasPrimaryIdentifierColumns(null, assimilation.Parent); + /*****************************/ + //InformationType matchingBaseType = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)[ColumnHasConceptTypeChild.GetConceptTypeChildPath(column).Count - 1] as InformationType; + + LinkedElementCollection<ConceptType> assimilations; + ConceptType conceptType = assimilation.AssimilatedConceptType; + List<Column> primaryIdentifierColumns = new List<Column>(); + + bool primaryIdentifierFound = false; + while ((assimilations = conceptType.AssimilatorConceptTypeCollection).Count != 0 && !primaryIdentifierFound) + { + conceptType = assimilations[0]; + + Table primaryTable = TableIsPrimarilyForConceptType.GetTable(conceptType); + + if (primaryTable != null) + { + foreach (UniquenessConstraint uniqueness in primaryTable.UniquenessConstraintCollection) + { + if (uniqueness.IsPrimary) + { + primaryIdentifierColumns.AddRange(uniqueness.ColumnCollection); + assimilation.IsMandatory = true; + primaryIdentifierFound = true; + } + } + } + } + if (primaryIdentifierColumns.Count == 0) + { + primaryIdentifierColumns.AddRange(GetColumnsForConceptTypeChild(assimilation as ConceptTypeChild, new List<ConceptTypeChild>())); + } + /*************************/ + + + foreach (Column identifierColumn in primaryIdentifierColumns) { + LinkedElementCollection<ConceptTypeChild> ctcpath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(identifierColumn); + foreach (ConceptTypeChild ctc in ctcpath) + { + ctc.IsMandatory = true; + } Column clonedColumn = new Column(identifierColumn.Store, new PropertyAssignment[] { new PropertyAssignment(Column.NameDomainPropertyId, identifierColumn.Name) }); List<ConceptTypeChild> clonedConceptTypeChildPath = new List<ConceptTypeChild>(ColumnHasConceptTypeChild.GetConceptTypeChildPath(identifierColumn)); ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).Clear(); ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).AddRange(clonedConceptTypeChildPath); - ColumnHasConceptTypeChild.GetConceptTypeChildPath(clonedColumn).Insert(0, (ConceptTypeChild)assimilation); table.ColumnCollection.Add(clonedColumn); ColumnReference relationship = new ColumnReference(clonedColumn, identifierColumn); referenceConstraint.ColumnReferenceCollection.Add(relationship); @@ -714,7 +805,7 @@ } /// <summary> - /// CreateForeignKeys looks at a table and creates the foreign keys between it. + /// CreateForeignKeys looks at a table and generates all Foreign Keys (<see cref="ReferenceConstraint"/>) required by the columns in that table. /// </summary> /// <param name="table">The table to check for foreign keys on.</param> private static void CreateForeignKeys(Table table) @@ -801,6 +892,21 @@ } } } + else if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(conceptTypeAssimilatesConceptType) == AssimilationAbsorptionChoice.Separate) + { + Table targetTable = TableIsPrimarilyForConceptType.GetTable(conceptTypeAssimilatesConceptType.AssimilatedConceptType); + + foreach (Column target in targetTable.ColumnCollection) + { + foreach (ConceptTypeChild conceptTypeChild in ColumnHasConceptTypeChild.GetConceptTypeChildPath(target)) + { + if (ColumnHasConceptTypeChild.GetConceptTypeChildPath(target).Contains(conceptTypeChild) && target != column) + { + columns.Add(target); + } + } + } + } } foreach (ConceptTypeAssimilatesConceptType conceptTypeAssimilatesConceptType in ConceptTypeAssimilatesConceptType.GetLinksToAssimilatedConceptTypeCollection(conceptType)) { @@ -817,8 +923,25 @@ } } } + else if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(conceptTypeAssimilatesConceptType) == AssimilationAbsorptionChoice.Separate) + { + Table targetTable = TableIsPrimarilyForConceptType.GetTable(conceptTypeAssimilatesConceptType.AssimilatedConceptType); + + foreach (Column target in targetTable.ColumnCollection) + { + foreach (ConceptTypeChild conceptTypeChild in ColumnHasConceptTypeChild.GetConceptTypeChildPath(target)) + { + if (ColumnHasConceptTypeChild.GetConceptTypeChildPath(target).Contains(conceptTypeChild) && target != column) + { + columns.Add(target); + } + } + } + } } + + // Walk the assimililating path looking for possible relationships that may hold the key. if (columns.Count == 0) { @@ -831,11 +954,6 @@ Table targetTable = TableIsPrimarilyForConceptType.GetTable(conceptType); - //LinkedElementCollection<ConceptType> relating = ConceptTypeRelatesToConceptType.GetRelatingConceptTypeCollection(conceptType); - //int relatingCount = relating.Count; - //ConceptType[] real = new ConceptType[] { relatingCount }; - //relating.CopyTo(real, 0); - if (targetTable != null) { foreach (Column possibleColumn in targetTable.ColumnCollection) @@ -849,7 +967,7 @@ } } - if(columns.Count == 0) + if (columns.Count == 0) { InformationType matchingBaseType = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)[ColumnHasConceptTypeChild.GetConceptTypeChildPath(column).Count - 1] as InformationType; LinkedElementCollection<ConceptType> assimilations; @@ -967,26 +1085,32 @@ } else { - for (int i = 0; i < ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn).Count; ++i) - { + //for (int i = 0; i < ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn).Count; ++i) + //{ LinkedElementCollection<ConceptTypeChild> leftPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column); LinkedElementCollection<ConceptTypeChild> rightPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn); - // Look through the target path and find the first information type and set its index as the offset. - //for (int j = 0; j < rightPath.Count; ++j) - //{ - // if (rightPath[j].GetType() == typeof(InformationType)) - // { - // offset = j; - // } - //} + int leftBuffer = 0; + int rightBuffer = 0; + + if (rightPath[0].GetType() == typeof(ConceptTypeAssimilatesConceptType)) + { + if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(rightPath[0] as ConceptTypeAssimilatesConceptType) == AssimilationAbsorptionChoice.Separate) + { + rightBuffer += 1; + } + } + if (leftPath[0].GetType() == typeof(ConceptTypeAssimilatesConceptType)) + { + if (AssimilationMapping.GetAbsorptionChoiceFromAssimilation(leftPath[0] as ConceptTypeAssimilatesConceptType) == AssimilationAbsorptionChoice.Separate) + { + leftBuffer += 1; + } + } - // UNDONE Decimal comparision operator ID is breaking here, possibly because it is attempting to map downward, it's an odd FK. good tester - // UNDONE This may also be a part of the reason why we have some FK's that arn't mapping and are apearing outside of the column. - // TEST - if (leftPath.Count >= rightPath.Count) + if (leftPath.Count-leftBuffer >= rightPath.Count-rightBuffer) { - for (int reverseIndex = 0; reverseIndex < rightPath.Count; reverseIndex++) + for (int reverseIndex = 0; reverseIndex < rightPath.Count-rightBuffer; reverseIndex++) { if (rightPath[rightPath.Count - 1 - reverseIndex] != leftPath[leftPath.Count - 1 - reverseIndex]) { @@ -998,7 +1122,7 @@ } else { - for (int reverseIndex = 0; reverseIndex < leftPath.Count; reverseIndex++) + for (int reverseIndex = 0; reverseIndex < leftPath.Count-leftBuffer; reverseIndex++) { if (leftPath[leftPath.Count - 1 - reverseIndex] != rightPath[rightPath.Count - 1 - reverseIndex]) { @@ -1007,7 +1131,7 @@ } } } - } + //} // END TEST //if ((i + 1 < leftPath.Count && i + offset < rightPath.Count && @@ -1187,7 +1311,7 @@ } /// <summary> - /// Set the IsNullable property for all columns on the table + /// Applies Nullable/nonNullable constraints on all columns for a given table. /// </summary> /// <param name="table">The <see cref="Table"/> to set initial constraints for</param> private static void GenerateMandatoryConstraints(Table table) @@ -1198,6 +1322,9 @@ } } + /// <summary> + /// CheckColumnConstraint looks at the the ConceptTypeChildPath for a column, setting the column to nullable when some point in the path is not manditory. + /// </summary> private static void CheckColumnConstraint(Column column) { bool allStepsMandatory = true; @@ -1205,8 +1332,17 @@ { if (!concept.IsMandatory) { - allStepsMandatory = false; - break; + // A ConceptTypeAssimilatesConceptType that is set to partition may(will) not be manditory, but the resulting columns should be, + // Do we wwant to perform a check on the ConceptTypeChild for that case here, or should we eariler change that Assimilation to a manditory one? + if (concept.GetType() == typeof(ConceptTypeAssimilatesConceptType) && AssimilationMapping.GetAbsorptionChoiceFromAssimilation(concept as ConceptTypeAssimilatesConceptType) == AssimilationAbsorptionChoice.Partition) + { + + } + else + { + allStepsMandatory = false; + break; + } } } column.IsNullable = !allStepsMandatory; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 22:32:46
|
Revision: 1096 http://orm.svn.sourceforge.net/orm/?rev=1096&view=rev Author: mcurland Date: 2007-08-20 15:32:49 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Covered additional ORMElementGateway case, extension of work done for [1087] refs #327 Fixed issue adding implied mandatory constraints to non-mandatory preferred identifier roles. refs #330 Modified Paths: -------------- trunk/ORMModel/ObjectModel/ObjectType.cs trunk/Oial/ORMOialBridge/ORMElementGateway.cs Modified: trunk/ORMModel/ObjectModel/ObjectType.cs =================================================================== --- trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-20 22:30:52 UTC (rev 1095) +++ trunk/ORMModel/ObjectModel/ObjectType.cs 2007-08-20 22:32:49 UTC (rev 1096) @@ -1363,6 +1363,7 @@ { bool canBeIndependent = true; LinkedElementCollection<Role> preferredIdentifierRoles = null; + bool checkedPreferredRoles = false; LinkedElementCollection<Role> playedRoles = PlayedRoleCollection; int playedRoleCount = playedRoles.Count; MandatoryConstraint impliedMandatory = ImpliedMandatoryConstraint; @@ -1404,19 +1405,20 @@ currentRoleIsMandatory = true; bool turnedOffCanBeIndependent = false; // The role must be part of a fact type that has a role in the preferred identifier. - if (preferredIdentifierRoles == null) + if (!checkedPreferredRoles) { + checkedPreferredRoles = true; UniquenessConstraint preferredIdentifier = PreferredIdentifier; - if (preferredIdentifier == null) + if (preferredIdentifier != null) { - canBeIndependent = false; - turnedOffCanBeIndependent = true; - } - else - { preferredIdentifierRoles = preferredIdentifier.RoleCollection; } } + if (preferredIdentifierRoles == null) + { + canBeIndependent = false; + turnedOffCanBeIndependent = true; + } if (canBeIndependent) { RoleBase oppositeRole = playedRole.OppositeRole; @@ -1445,9 +1447,29 @@ } } } - if (!currentRoleIsMandatory) + if (!currentRoleIsMandatory && canBeIndependent) { - seenNonMandatoryRole = true; + bool nonMandatoryRoleInPreferredIdentifier = false; + if (!checkedPreferredRoles) + { + checkedPreferredRoles = true; + UniquenessConstraint preferredIdentifier = PreferredIdentifier; + if (preferredIdentifier != null) + { + preferredIdentifierRoles = preferredIdentifier.RoleCollection; + } + } + if (preferredIdentifierRoles != null) + { + RoleBase oppositeRole = playedRole.OppositeRole; + nonMandatoryRoleInPreferredIdentifier = + null != oppositeRole && + preferredIdentifierRoles.Contains(oppositeRole.Role); + } + if (!nonMandatoryRoleInPreferredIdentifier) + { + seenNonMandatoryRole = true; + } } if (impliedMandatory != null && canBeIndependent) { @@ -1565,7 +1587,7 @@ { if (mandatoryConstraint.IsImplied) { - // The pattern has already been validated. Anything object + // The pattern has already been validated. Any object with // an implied mandatory constraint can be independent. return true; } Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:30:52 UTC (rev 1095) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:32:49 UTC (rev 1096) @@ -70,7 +70,7 @@ foreach (ObjectType objectType in model.ObjectTypeCollection) { if (!IsElementExcluded(objectType) && - !ShouldConsiderObjectType(objectType, null)) + !ShouldConsiderObjectType(objectType, null, false)) { ExcludeObjectType(objectType, abstractionModel, true, notifyExcluded); } @@ -92,9 +92,10 @@ /// markings on its preferred identifier. /// </summary> /// <param name="objectType">The <see cref="ObjectType"/> to test</param> + /// <param name="ignoreFactTypesFilteredForThisObjectType">Don't block consideration of this <paramref name="objectType"/> if a <see cref="FactType"/> is excluded because this <see cref="ObjectType"/> is currently excluded.</param> /// <param name="ignoreFactType">Succeed even if this <see cref="FactType"/> is excluded. Can be <see langword="null"/>.</param> /// <returns><see langword="true"/> if the <paramref name="objectType"/> passes all necessary conditions for consideration.</returns> - private static bool ShouldConsiderObjectType(ObjectType objectType, FactType ignoreFactType) + private static bool ShouldConsiderObjectType(ObjectType objectType, FactType ignoreFactType, bool ignoreFactTypesFilteredForThisObjectType) { // Look at the error states we care about. If any of these error // states are present then we do not consider. @@ -118,10 +119,10 @@ if (factType != ignoreFactType && IsElementExcluded(factType)) { - if (ignoreFactType != null && ShouldConsiderFactType(factType, objectType, true)) + if (ignoreFactTypesFilteredForThisObjectType && ShouldConsiderFactType(factType, objectType, true)) { // This pattern is used only during delay validation. A cleaner model would - // be a delagate callback, but it isn't worth the additional overhead given + // be a delegate callback, but it isn't worth the additional overhead given // that this would be the only code that would ever run there. FilterModifiedFactType(factType, true); } @@ -158,7 +159,7 @@ if (rolePlayer == null || (ignoreRolePlayer != rolePlayer && IsElementExcluded(rolePlayer) && - !(!ignoreRolePlayersFilteredForThisFactType || ShouldConsiderObjectType(rolePlayer, factType)))) + !(!ignoreRolePlayersFilteredForThisFactType || ShouldConsiderObjectType(rolePlayer, factType, true)))) { return false; } @@ -188,7 +189,7 @@ { ModelHasObjectType link = element as ModelHasObjectType; ObjectType objectType = link.ObjectType; - if (ShouldConsiderObjectType(objectType, null)) + if (ShouldConsiderObjectType(objectType, null, false)) { AddObjectType(objectType); } @@ -268,7 +269,7 @@ { ObjectType objectType = (ObjectType)element; ExcludedORMModelElement exclusionLink = ExcludedORMModelElement.GetLinkToAbstractionModel(objectType); - if (ShouldConsiderObjectType(objectType, null)) + if (ShouldConsiderObjectType(objectType, null, true)) { if (exclusionLink != null) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 22:30:52
|
Revision: 1095 http://orm.svn.sourceforge.net/orm/?rev=1095&view=rev Author: mcurland Date: 2007-08-20 15:30:52 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added verbalization support for column selections. The items displayed may change in the future, but this is a good start and important for debugging other relational mappings. refs #328 Changed VerbalizationToolWindow to use same main verbalization loop as the report verbalizer. This will be broken out more in the future as we refactor the report engine externally. refs #315 Also sorted the extension manager dialog and added license information to some files. Modified Paths: -------------- trunk/ORMModel/ObjectModel/VerbalizationReport.cs trunk/ORMModel/Shell/ExtensionManager.cs trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs trunk/Oial/ORMOialBridge/ModificationTracker.cs trunk/Oial/ORMOialBridge/ORMElementGateway.cs trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs trunk/RelationalModel/DcilModel/DcilModel.csproj trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs Added Paths: ----------- trunk/RelationalModel/DcilModel/Verbalization.cs trunk/RelationalModel/OialDcilBridge/Verbalization.cs Modified: trunk/ORMModel/ObjectModel/VerbalizationReport.cs =================================================================== --- trunk/ORMModel/ObjectModel/VerbalizationReport.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/ObjectModel/VerbalizationReport.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -218,6 +218,11 @@ false, ref firstCall); + if (!firstCall) + { + writer.WriteDocumentFooter(); + } + textWriter.Flush(); textWriter.Close(); #endregion // Object Type List Report @@ -331,6 +336,11 @@ false, ref firstCall); + if (!firstCall) + { + writer.WriteDocumentFooter(); + } + textWriter.Flush(); textWriter.Close(); } @@ -455,52 +465,6 @@ myDocumentHeaderReplacementFields = documentHeaderReplacementFields; } /// <summary> - /// Retrieves replacement fields for the Document Header snippet from the given IORMFontAndColorService implementation - /// </summary> - /// <param name="colorService"></param> - /// <param name="snippets"></param> - /// <returns></returns> - public static string[] GetDocumentHeaderReplacementFields(IORMFontAndColorService colorService, IVerbalizationSets<CoreVerbalizationSnippetType> snippets) - { - string[] retVal; - // The replacement fields, pulled from VerbalizationGenerator.xsd - //{0} font-family - //{1} font-size - //{2} predicate text color - //{3} predicate text bold - //{4} object name color - //{5} object name bold - //{6} formal item color - //{7} formal item bold - //{8} notes item color - //{9} notes item bold - //{10} refmode item color - //{11} refmode item bold - //{12} instance value item color - //{13} instance value item bold - string boldWeight = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerFontWeightBold); - string normalWeight = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerFontWeightNormal); - retVal = new string[] { "Tahoma", "8", "darkgreen", normalWeight, "purple", normalWeight, "mediumblue", boldWeight, "brown", normalWeight, "darkgray", normalWeight, "brown", normalWeight }; - using (Font font = colorService.GetFont(ORMDesignerColorCategory.Verbalizer)) - { - retVal[0] = font.FontFamily.Name; - retVal[1] = (font.Size * 72f).ToString(CultureInfo.InvariantCulture); - retVal[2] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerPredicateText)); - retVal[3] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerPredicateText) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[4] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerObjectName)); - retVal[5] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerObjectName) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[6] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerFormalItem)); - retVal[7] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerFormalItem) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[8] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerNotesItem)); - retVal[9] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerNotesItem) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[10] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerRefMode)); - retVal[11] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerRefMode) & FontStyle.Bold)) ? boldWeight : normalWeight; - retVal[12] = ColorTranslator.ToHtml(colorService.GetForeColor(ORMDesignerColor.VerbalizerInstanceValue)); - retVal[13] = (0 != (colorService.GetFontStyle(ORMDesignerColor.VerbalizerInstanceValue) & FontStyle.Bold)) ? boldWeight : normalWeight; - } - return retVal; - } - /// <summary> /// Gets the underlying TextWriter /// </summary> public TextWriter Writer Modified: trunk/ORMModel/Shell/ExtensionManager.cs =================================================================== --- trunk/ORMModel/Shell/ExtensionManager.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/Shell/ExtensionManager.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -31,6 +31,8 @@ using Neumont.Tools.Modeling.Design; using Neumont.Tools.ORM.ObjectModel; using Neumont.Tools.Modeling.Shell; +using System.Collections; +using System.Globalization; namespace Neumont.Tools.ORM.Shell { @@ -293,7 +295,23 @@ { AddItemToListView(type); } + lvExtensions.ListViewItemSorter = ItemComparer.Instance; } + + private sealed class ItemComparer : IComparer + { + public static readonly IComparer Instance = new ItemComparer(); + private ItemComparer() + { + } + + public int Compare(object obj1, object obj2) + { + ListViewItem item1 = (ListViewItem) obj1; + ListViewItem item2 = (ListViewItem) obj2; + return string.Compare(item1.SubItems[1].Text, item2.SubItems[1].Text, false, CultureInfo.CurrentCulture); + } + } /// <summary> /// This method adds the passed in ORMExtensionType to the ListView on the ExtensionManager dialogue. /// </summary> Modified: trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs =================================================================== --- trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/ORMModel/Shell/ORMVerbalizationToolWindow.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -33,6 +33,7 @@ using Microsoft.VisualStudio.TextManager.Interop; using Neumont.Tools.ORM.ObjectModel; using Neumont.Tools.Modeling; +using Neumont.Tools.ORM.ObjectModel.Verbalization; namespace Neumont.Tools.ORM.Shell { @@ -289,6 +290,7 @@ ICollection selectedObjects = base.GetSelectedComponents(); IDictionary<Type, IVerbalizationSets> snippetsDictionary = null; IVerbalizationSets<CoreVerbalizationSnippetType> snippets = null; + VerbalizationCallbackWriter callbackWriter = null; bool showNegative = ORMDesignerPackage.VerbalizationWindowSettings.ShowNegativeVerbalizations; bool firstCallPending = true; Dictionary<IVerbalize, IVerbalize> verbalized = myAlreadyVerbalized; @@ -317,16 +319,23 @@ { snippetsDictionary = (mel.Store as IORMToolServices).GetVerbalizationSnippetsDictionary(ORMCoreDomainModel.VerbalizationTargetName); snippets = (IVerbalizationSets<CoreVerbalizationSnippetType>)snippetsDictionary[typeof(CoreVerbalizationSnippetType)]; - myStringWriter.NewLine = snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerNewLine); + callbackWriter = new VerbalizationCallbackWriter(snippets, myStringWriter, GetDocumentHeaderReplacementFields(mel, snippets)); } - VerbalizeElement(mel, snippetsDictionary, verbalized, showNegative, myStringWriter, ref firstCallPending); + VerbalizationHelper.VerbalizeElement( + mel, + snippetsDictionary, + verbalized, + showNegative, + callbackWriter, + true, + ref firstCallPending); } } } if (!firstCallPending) { // Write footer - myStringWriter.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDocumentFooter)); + callbackWriter.WriteDocumentFooter(); // Clear cache verbalized.Clear(); } @@ -341,238 +350,6 @@ } } } - private sealed class VerbalizationContextImpl : IVerbalizationContext - { - /// <summary> - /// A callback delegate enabling a verbalizer to tell - /// the hosting window that it is about to begin verbalizing. - /// This enables the host window to delay writing content outer - /// content until it knows that text is about to be written by - /// the verbalizer to the writer - /// </summary> - /// <param name="content">The style of verbalization content</param> - public delegate void NotifyBeginVerbalization(VerbalizationContent content); - public delegate void NotifyDeferVerbalization(object target, IVerbalizeFilterChildren childFilter); - private NotifyBeginVerbalization myBeginCallback; - private NotifyDeferVerbalization myDeferCallback; - public VerbalizationContextImpl(NotifyBeginVerbalization beginCallback, NotifyDeferVerbalization deferCallback) - { - myBeginCallback = beginCallback; - myDeferCallback = deferCallback; - } - #region IVerbalizationContext Implementation - void IVerbalizationContext.BeginVerbalization(VerbalizationContent content) - { - myBeginCallback(content); - } - void IVerbalizationContext.DeferVerbalization(object target, IVerbalizeFilterChildren childFilter) - { - if (myDeferCallback != null) - { - myDeferCallback(target, childFilter); - } - } - #endregion // IVerbalizationContext Implementation - } - /// <summary> - /// Determine the indentation level for verbalizing a ModelElement, and fire - /// the delegate for verbalization - /// </summary> - /// <param name="element">The element to verbalize</param> - /// <param name="snippetsDictionary">The default or loaded verbalization sets. Passed through all verbalization calls.</param> - /// <param name="alreadyVerbalized">A dictionary of top-level (indentationLevel == 0) elements that have already been verbalized.</param> - /// <param name="isNegative">Use the negative form of the reading</param> - /// <param name="writer">The TextWriter for verbalization output</param> - /// <param name="firstCallPending"></param> - private static void VerbalizeElement(ModelElement element, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IDictionary<IVerbalize, IVerbalize> alreadyVerbalized, bool isNegative, TextWriter writer, ref bool firstCallPending) - { - int lastLevel = 0; - bool firstWrite = true; - bool localFirstCallPending = firstCallPending; - IVerbalizationSets<CoreVerbalizationSnippetType> snippets = (IVerbalizationSets<CoreVerbalizationSnippetType>)snippetsDictionary[typeof(CoreVerbalizationSnippetType)]; - VerbalizeElement( - element, - snippetsDictionary, - null, - delegate(IVerbalize verbalizer, int indentationLevel) - { - if (indentationLevel == 0) - { - if (alreadyVerbalized.ContainsKey(verbalizer)) - { - return VerbalizationResult.AlreadyVerbalized; - } - } - bool retVal = verbalizer.GetVerbalization( - writer, - snippetsDictionary, - new VerbalizationContextImpl( - delegate(VerbalizationContent content) - { - // Prepare for verbalization on this element. Everything - // is delayed to this point in case the verbalization implementation - // does not callback to the text writer. - if (firstWrite) - { - if (localFirstCallPending) - { - localFirstCallPending = false; - // Write the HTML header to the buffer - writer.Write(string.Format(CultureInfo.InvariantCulture, snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDocumentHeader), GetDocumentHeaderReplacementFields(element, snippets))); - } - - // write open tag for new verbalization - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerOpenVerbalization)); - firstWrite = false; - } - else - { - writer.WriteLine(); - } - - // Write indentation tags as needed - if (indentationLevel > lastLevel) - { - do - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerIncreaseIndent)); - ++lastLevel; - } while (lastLevel != indentationLevel); - } - else if (lastLevel > indentationLevel) - { - do - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDecreaseIndent)); - --lastLevel; - } while (lastLevel != indentationLevel); - } - }, - null), - isNegative); - if (retVal) - { - if (indentationLevel == 0) - { - alreadyVerbalized.Add(verbalizer, verbalizer); - } - return VerbalizationResult.Verbalized; - } - else - { - return VerbalizationResult.NotVerbalized; - } - }, - isNegative, - 0); - while (lastLevel > 0) - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerDecreaseIndent)); - --lastLevel; - } - // close the opening tag for the new verbalization - if (!firstWrite) - { - writer.Write(snippets.GetSnippet(CoreVerbalizationSnippetType.VerbalizerCloseVerbalization)); - } - firstCallPending = localFirstCallPending; - } - /// <summary> - /// Verbalize the passed in element and all its children - /// </summary> - private static void VerbalizeElement(ModelElement element, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizeFilterChildren filter, VerbalizationHandler callback, bool isNegative, int indentLevel) - { - IVerbalize parentVerbalize = null; - IRedirectVerbalization surrogateRedirect; - if (indentLevel == 0 && - null != (surrogateRedirect = element as IRedirectVerbalization) && - null != (parentVerbalize = surrogateRedirect.SurrogateVerbalizer)) - { - element = parentVerbalize as ModelElement; - } - else - { - parentVerbalize = element as IVerbalize; - } - bool disposeVerbalizer = false; - if (filter != null && parentVerbalize != null) - { - CustomChildVerbalizer filterResult = filter.FilterChildVerbalizer(parentVerbalize, isNegative); - parentVerbalize = filterResult.Instance; - disposeVerbalizer = filterResult.Options; - } - try - { - VerbalizationResult result = (parentVerbalize != null) ? callback(parentVerbalize, indentLevel) : VerbalizationResult.NotVerbalized; - if (result == VerbalizationResult.AlreadyVerbalized) - { - return; - } - bool parentVerbalizeOK = result == VerbalizationResult.Verbalized; - bool verbalizeChildren = parentVerbalizeOK ? (element != null) : (element is IVerbalizeChildren); - if (verbalizeChildren) - { - if (parentVerbalizeOK) - { - ++indentLevel; - } - filter = parentVerbalize as IVerbalizeFilterChildren; - ReadOnlyCollection<DomainRoleInfo> aggregatingList = element.GetDomainClass().AllDomainRolesPlayed; - int aggregatingCount = aggregatingList.Count; - for (int i = 0; i < aggregatingCount; ++i) - { - DomainRoleInfo roleInfo = aggregatingList[i]; - if (roleInfo.IsEmbedding) - { - LinkedElementCollection<ModelElement> children = roleInfo.GetLinkedElements(element); - int childCount = children.Count; - for (int j = 0; j < childCount; ++j) - { - VerbalizeElement(children[j], snippetsDictionary, filter, callback, isNegative, indentLevel); - } - } - } - // TODO: Need BeforeNaturalChildren/AfterNaturalChildren/SkipNaturalChildren settings for IVerbalizeCustomChildren - IVerbalizeCustomChildren customChildren = parentVerbalize as IVerbalizeCustomChildren; - if (customChildren != null) - { - foreach (CustomChildVerbalizer customChild in customChildren.GetCustomChildVerbalizations(filter, isNegative)) - { - IVerbalize childVerbalize = customChild.Instance; - if (childVerbalize != null) - { - try - { - callback(childVerbalize, indentLevel); - } - finally - { - if (customChild.Options) - { - IDisposable dispose = childVerbalize as IDisposable; - if (dispose != null) - { - dispose.Dispose(); - } - } - } - } - } - } - } - } - finally - { - if (disposeVerbalizer) - { - IDisposable dispose = parentVerbalize as IDisposable; - if (dispose != null) - { - dispose.Dispose(); - } - } - } - } #endregion // Verbalization Implementation #region ORMToolWindow Implementation /// <summary> Modified: trunk/Oial/ORMOialBridge/ModificationTracker.cs =================================================================== --- trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Diagnostics; Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/RelationalModel/DcilModel/DcilModel.csproj =================================================================== --- trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/DcilModel/DcilModel.csproj 2007-08-20 22:30:52 UTC (rev 1095) @@ -153,6 +153,7 @@ <DependentUpon>ResourceStringsGenerator.xml</DependentUpon> </Compile> <Compile Include="SurveyImplementations\SurveyQuestions.cs" /> + <Compile Include="Verbalization.cs" /> <EmbeddedResource Include="Catalog.resx"> <DependentUpon>Catalog.cs</DependentUpon> <SubType>Designer</SubType> Added: trunk/RelationalModel/DcilModel/Verbalization.cs =================================================================== --- trunk/RelationalModel/DcilModel/Verbalization.cs (rev 0) +++ trunk/RelationalModel/DcilModel/Verbalization.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -0,0 +1,62 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion +using Microsoft.VisualStudio.Modeling; +using Neumont.Tools.ORM.ObjectModel; +using System; +using System.Collections.ObjectModel; + +namespace Neumont.Tools.RelationalModels.ConceptualDatabase +{ + partial class Column : IRedirectVerbalization + { + #region IRedirectVerbalization implementation + /// <summary> + /// The guid for the role in the bridge model we want to defer verbalization to. Lifted + /// from the generated bridge code. + /// </summary> + private static readonly Guid ColumnBridgeRoleId = new Guid(0xbc7ea8a8, 0x8772, 0x4ca4, 0xb9, 0x14, 0xb7, 0x8b, 0x4b, 0x58, 0x33, 0x38); + + /// <summary> + /// Implements <see cref="IRedirectVerbalization.SurrogateVerbalizer"/>. Defers to the + /// first bridge link element, if the bridge is loaded. + /// </summary> + protected IVerbalize SurrogateVerbalizer + { + get + { + // Look up the associated bridge links by guid, this project does not reference + // the bridge elements directly, so the type is not available. + DomainRoleInfo roleInfo; + ReadOnlyCollection<ElementLink> links; + IVerbalize retVal = null; + if (null != (roleInfo = Store.DomainDataDirectory.FindDomainRole(ColumnBridgeRoleId)) && + 0 != (links = roleInfo.GetElementLinks(this)).Count) + { + retVal = links[0] as IVerbalize; + } + return retVal; + } + } + IVerbalize IRedirectVerbalization.SurrogateVerbalizer + { + get + { + return SurrogateVerbalizer; + } + } + #endregion // IRedirectVerbalization implementation + } +} Modified: trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -1,3 +1,18 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion using System; using System.Collections.Generic; using System.Text; Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.csproj 2007-08-20 22:30:52 UTC (rev 1095) @@ -156,6 +156,7 @@ <AutoGen>True</AutoGen> <DependentUpon>ResourceStringsGenerator.xml</DependentUpon> </Compile> + <Compile Include="Verbalization.cs" /> </ItemGroup> <ItemGroup> <Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" /> Modified: trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs 2007-08-20 22:24:39 UTC (rev 1094) +++ trunk/RelationalModel/OialDcilBridge/Resources/ResourceStrings.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -19,7 +19,6 @@ using System.Resources; using System.Windows.Forms; using Neumont.Tools.Modeling.Design; -using Neumont.Tools.ORM.ObjectModel; namespace Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge { Added: trunk/RelationalModel/OialDcilBridge/Verbalization.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/Verbalization.cs (rev 0) +++ trunk/RelationalModel/OialDcilBridge/Verbalization.cs 2007-08-20 22:30:52 UTC (rev 1095) @@ -0,0 +1,62 @@ +#region Common Public License Copyright Notice +/**************************************************************************\ +* Neumont Object-Role Modeling Architect for Visual Studio * +* * +* Copyright \xA9 Neumont University. All rights reserved. * +* * +* The use and distribution terms for this software are covered by the * +* Common Public License 1.0 (http://opensource.org/licenses/cpl) which * +* can be found in the file CPL.txt at the root of this distribution. * +* By using this software in any fashion, you are agreeing to be bound by * +* the terms of this license. * +* * +* You must not remove this notice, or any other, from this software. * +\**************************************************************************/ +#endregion +using Microsoft.VisualStudio.Modeling; +using Neumont.Tools.ORM.ObjectModel; +using Neumont.Tools.ORMAbstraction; +using Neumont.Tools.ORMToORMAbstractionBridge; +using Neumont.Tools.RelationalModels.ConceptualDatabase; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.IO; + +namespace Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge +{ + partial class ColumnHasConceptTypeChild : IVerbalize + { + #region IVerbalize Implementation + /// <summary> + /// Implements <see cref="IVerbalize.GetVerbalization"/> + /// </summary> + protected bool GetVerbalization(TextWriter writer, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizationContext verbalizationContext, bool isNegative) + { + // We are redirected to this point by the associated Column element + Column column = this.Column; + bool firstWrite = true; + foreach (ConceptTypeChild child in ColumnHasConceptTypeChild.GetConceptTypeChildPath(this.Column)) + { + foreach (FactType factType in ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(child)) + { + if (firstWrite) + { + firstWrite = false; + } + else + { + writer.WriteLine(); + } + verbalizationContext.DeferVerbalization(factType, null); + } + } + return false; + } + bool IVerbalize.GetVerbalization(TextWriter writer, IDictionary<Type, IVerbalizationSets> snippetsDictionary, IVerbalizationContext verbalizationContext, bool isNegative) + { + return GetVerbalization(writer, snippetsDictionary, verbalizationContext, isNegative); + } + #endregion // IVerbalize Implementation + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 22:24:43
|
Revision: 1094 http://orm.svn.sourceforge.net/orm/?rev=1094&view=rev Author: mcurland Date: 2007-08-20 15:24:39 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added ability to bold items in the model browser. refs #268 Added bolding for non-nullable columns, overlays for primary identifier columns, and sorted primary columns to the top of the column list. refs #328 Modified Paths: -------------- trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/SurveyInterfaces.cs trunk/ORMModel/ObjectModel/ORMCore.SurveyQuestionProvider.cs trunk/ORMModel/Transforms/SurveyQuestionProvider.xsd trunk/ORMModel/Transforms/SurveyQuestionProvider.xslt trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.cs trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.xml trunk/RelationalModel/DcilModel/Resources/SurveyTree.ImageStrip.png trunk/RelationalModel/DcilModel/SurveyImplementations/SurveyQuestions.cs Modified: trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs =================================================================== --- trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/MainList.cs 2007-08-20 22:24:39 UTC (rev 1094) @@ -317,35 +317,50 @@ for (int i = 0; i < questionCount; i++) { SurveyQuestion question = mySurvey[i]; - if (0 != (question.Question.UISupport & SurveyQuestionUISupport.Glyph)) + ISurveyQuestionTypeInfo questionInfo = question.Question; + SurveyQuestionUISupport support = questionInfo.UISupport; + if (0 != (support & (SurveyQuestionUISupport.Glyph | SurveyQuestionUISupport.Overlay | SurveyQuestionUISupport.DisplayData))) { - int answer; - if (image == -1 && - SurveyQuestion.NeutralAnswer != (answer = myCurrentDisplays[i].Question.ExtractAnswer(nodeData)) && - 0 <= (image = question.Question.MapAnswerToImageIndex(answer))) + int answer = myCurrentDisplays[i].Question.ExtractAnswer(nodeData); + if (answer != SurveyQuestion.NeutralAnswer) { - image += question.ProviderImageListOffset; - } - } - else if (0 != (question.Question.UISupport & SurveyQuestionUISupport.Overlay)) - { - int answer; - if (SurveyQuestion.NeutralAnswer != (answer = myCurrentDisplays[i].Question.ExtractAnswer(nodeData)) && - 0 <= (answer = question.Question.MapAnswerToImageIndex(answer))) - { - if (overlayImage == -1) + // Extract image and overlay support + if (0 != (support & SurveyQuestionUISupport.Glyph)) { - overlayImage = answer + question.ProviderImageListOffset; + if (image == -1 && + 0 <= (image = questionInfo.MapAnswerToImageIndex(answer))) + { + image += question.ProviderImageListOffset; + } } - else + else if (0 != (support & SurveyQuestionUISupport.Overlay)) { - if (overlayBitField == -1) + int answerImage = questionInfo.MapAnswerToImageIndex(answer); + if (0 <= answerImage) { - overlayBitField = 0; - AddToOverlayList(overlayImage, ref overlayBitField); + if (overlayImage == -1) + { + overlayImage = answerImage + question.ProviderImageListOffset; + } + else + { + if (overlayBitField == -1) + { + overlayBitField = 0; + AddToOverlayList(overlayImage, ref overlayBitField); + } + AddToOverlayList(answerImage + question.ProviderImageListOffset, ref overlayBitField); + } } - AddToOverlayList(answer + question.ProviderImageListOffset, ref overlayBitField); } + + // Extract other display settings + if (0 != (support & SurveyQuestionUISupport.DisplayData)) + { + SurveyQuestionDisplayData displayData = questionInfo.GetDisplayData(answer); + retVal.Bold = displayData.Bold; + retVal.GrayText = displayData.GrayText; + } } } } Modified: trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/SurveyInterfaces.cs =================================================================== --- trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/SurveyInterfaces.cs 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/ORMModel/Framework/Shell/DynamicSurveyTreeGrid/SurveyInterfaces.cs 2007-08-20 22:24:39 UTC (rev 1094) @@ -56,6 +56,11 @@ /// <see cref="ISurveyQuestionTypeInfo.MapAnswerToImageIndex"/> method. /// </summary> Overlay = 8, + /// <summary> + /// Question supports additional display settings with the + /// <see cref="ISurveyQuestionTypeInfo.GetDisplayData"/> method. + /// </summary> + DisplayData = 0x10, } #endregion // SurveyQuestionUISupport enum #region ISurveyQuestionProvider interface @@ -86,6 +91,61 @@ IEnumerable<Type> GetErrorDisplayTypes(); } #endregion // ISurveyQuestionProvider interface + #region SurveyQuestionDisplayData structure + /// <summary> + /// Associate additional display information with this question. + /// Used by the <see cref="ISurveyQuestionTypeInfo.GetDisplayData"/> method. + /// </summary> + public struct SurveyQuestionDisplayData + { + private bool myIsBold; + private bool myIsGrayText; + /// <summary> + /// Default display settings + /// </summary> + public static readonly SurveyQuestionDisplayData Default = new SurveyQuestionDisplayData(); + /// <summary> + /// Create a new <see cref="SurveyQuestionDisplayData"/> + /// </summary> + /// <param name="isBold">Display text as bold</param> + /// <param name="isGrayText">Display text as gray text</param> + public SurveyQuestionDisplayData(bool isBold, bool isGrayText) + { + myIsBold = isBold; + myIsGrayText = isGrayText; + } + /// <summary> + /// Return <see langword="true"/> if these are the default settings + /// </summary> + public bool IsDefault + { + get + { + return !(myIsBold || myIsGrayText); + } + } + /// <summary> + /// Should the text display bold? + /// </summary> + public bool Bold + { + get + { + return myIsBold; + } + } + /// <summary> + /// Should the text display gray? + /// </summary> + public bool GrayText + { + get + { + return myIsGrayText; + } + } + } + #endregion // SurveyQuestionDisplayData structure #region ISurveyQuestionTypeInfo interface /// <summary> /// Holds a reference to a specific type of question and method for asking question of objects @@ -114,6 +174,13 @@ /// <returns>0-based index into the image list.</returns> int MapAnswerToImageIndex(int answer); /// <summary> + /// Retrieves additional display information for a given answer. Used only if + /// <see cref="UISupport"/> indicates support for <see cref="SurveyQuestionUISupport.DisplayData"/> + /// </summary> + /// <param name="answer">A value from the enum type returned by the <see cref="QuestionType"/> property.</param> + /// <returns><see cref="SurveyQuestionDisplayData"/> settings</returns> + SurveyQuestionDisplayData GetDisplayData(int answer); + /// <summary> /// UISupport for Question /// </summary> SurveyQuestionUISupport UISupport { get;} Modified: trunk/ORMModel/ObjectModel/ORMCore.SurveyQuestionProvider.cs =================================================================== --- trunk/ORMModel/ObjectModel/ORMCore.SurveyQuestionProvider.cs 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/ORMModel/ObjectModel/ORMCore.SurveyQuestionProvider.cs 2007-08-20 22:24:39 UTC (rev 1094) @@ -82,6 +82,10 @@ { return -1; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -126,6 +130,10 @@ } return retVal; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -160,6 +168,10 @@ { return answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -194,6 +206,10 @@ { return -1; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get Modified: trunk/ORMModel/Transforms/SurveyQuestionProvider.xsd =================================================================== --- trunk/ORMModel/Transforms/SurveyQuestionProvider.xsd 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/ORMModel/Transforms/SurveyQuestionProvider.xsd 2007-08-20 22:24:39 UTC (rev 1094) @@ -91,10 +91,65 @@ <xs:sequence> <xs:element ref="displaySupport" maxOccurs="unbounded"/> <xs:element ref="imageMap" minOccurs="0"/> + <xs:element ref="displayDataMap" minOccurs="0"/> </xs:sequence> <xs:attribute name="questionType" type="xs:string" use="required"/> <xs:attribute name="isErrorDisplay" type="xs:boolean" default="false"/> </xs:complexType> + <xs:element name="displayDataMap" type="displayDataMapType"> + <xs:unique name="DisplayDataUnique"> + <xs:selector xpath="qp:displayData | qp:displayDataSameAs"/> + <xs:field xpath="@enumValue"/> + </xs:unique> + <xs:key name="DisplayDataKey"> + <xs:selector xpath="qp:displayData"/> + <xs:field xpath="@enumValue"/> + </xs:key> + <xs:keyref name="DisplayDataSameAsKeyRef" refer="DisplayDataKey"> + <xs:selector xpath="qp:displayDataSameAs"/> + <xs:field xpath="@targetEnumValue"/> + </xs:keyref> + </xs:element> + <xs:complexType name="displayDataMapType"> + <xs:annotation> + <xs:documentation>Associate an answer with different display data settings.</xs:documentation> + </xs:annotation> + <xs:choice maxOccurs="unbounded"> + <xs:element name="displayData"> + <xs:complexType> + <xs:attribute name="enumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>The value from the questionType enum to associate with these display settings.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="bold" type="xs:boolean" default="false"> + <xs:annotation> + <xs:documentation>Display answers from this category in bold text</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="gray" type="xs:boolean" default="false"> + <xs:annotation> + <xs:documentation>Display answers from this category in gray text</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="displayDataSameAs"> + <xs:complexType> + <xs:attribute name="enumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>The value from the questionType enum to associate with these display settings.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="targetEnumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>This value should have the same display settings as the targeted value.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:choice> + </xs:complexType> <xs:complexType name="imageMapType"/> <xs:element name="imageMap" abstract="true" type="imageMapType"/> <xs:element name="sequentialImageMap" type="sequentialImageMapType" substitutionGroup="imageMap"> @@ -121,24 +176,40 @@ </xs:extension> </xs:complexContent> </xs:complexType> - <xs:element name="explicitImageMap" type="explicitImageMapType" substitutionGroup="imageMap"/> + <xs:element name="explicitImageMap" type="explicitImageMapType" substitutionGroup="imageMap"> + <xs:unique name="ExplicitImageMapUnique"> + <xs:selector xpath="qp:map | qp:mapSameAs"/> + <xs:field xpath="@enumValue"/> + </xs:unique> + <xs:key name="ExplicitImageMapKey"> + <xs:selector xpath="qp:map"/> + <xs:field xpath="@enumValue"/> + </xs:key> + <xs:keyref name="ExplicitImageMapSameAsKeyRef" refer="ExplicitImageMapKey"> + <xs:selector xpath="qp:mapSameAs"/> + <xs:field xpath="@targetEnumValue"/> + </xs:keyref> + </xs:element> <xs:complexType name="explicitImageMapType"> <xs:annotation> <xs:documentation>Enum values in this question type require custom mapping to image indices.</xs:documentation> </xs:annotation> <xs:complexContent> <xs:extension base="imageMapType"> - <xs:sequence> - <xs:element name="map" maxOccurs="unbounded"> + <xs:choice maxOccurs="unbounded"> + <xs:element name="map"> <xs:complexType> <xs:sequence> <xs:any namespace="http://schemas.neumont.edu/CodeGeneration/PLiX" processContents="strict" minOccurs="0"> <xs:annotation> - <xs:documentation>A custom expression. Used if the imageIndex attribute is set to .custom.</xs:documentation> + <xs:documentation>A custom expression. If the imageIndex attribute is set .custom then this expression is used directly. Otherwise, it is added to the imageIndex.</xs:documentation> </xs:annotation> </xs:any> </xs:sequence> <xs:attribute name="imageIndex" use="required"> + <xs:annotation> + <xs:documentation>An non-negative value indicating the index in the image list, or the special .custom value indicating a custom code expression.</xs:documentation> + </xs:annotation> <xs:simpleType> <xs:union memberTypes="xs:nonNegativeInteger"> <xs:simpleType> @@ -153,10 +224,28 @@ </xs:union> </xs:simpleType> </xs:attribute> - <xs:attribute name="enumValue" type="xs:token" use="required"/> + <xs:attribute name="enumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>The value from the questionType enum to associate with this image.</xs:documentation> + </xs:annotation> + </xs:attribute> </xs:complexType> </xs:element> - </xs:sequence> + <xs:element name="mapSameAs"> + <xs:complexType> + <xs:attribute name="enumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>The value from the questionType enum to associate with this image.</xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="targetEnumValue" type="xs:token" use="required"> + <xs:annotation> + <xs:documentation>This value should have the same image as the other value.</xs:documentation> + </xs:annotation> + </xs:attribute> + </xs:complexType> + </xs:element> + </xs:choice> </xs:extension> </xs:complexContent> </xs:complexType> @@ -185,6 +274,11 @@ <xs:documentation>Answers to this question are used to overlay the list of contents</xs:documentation> </xs:annotation> </xs:enumeration> + <xs:enumeration value="DisplayData"> + <xs:annotation> + <xs:documentation>Answers to this question can be used to retrieve additional display information</xs:documentation> + </xs:annotation> + </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:attribute> Modified: trunk/ORMModel/Transforms/SurveyQuestionProvider.xslt =================================================================== --- trunk/ORMModel/Transforms/SurveyQuestionProvider.xslt 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/ORMModel/Transforms/SurveyQuestionProvider.xslt 2007-08-20 22:24:39 UTC (rev 1094) @@ -275,6 +275,11 @@ <plx:condition> <plx:callStatic dataTypeName="{$questionType}" name="{@enumValue}" type="field"/> </plx:condition> + <xsl:for-each select="$imageMap/qp:mapSameAs[@targetEnumValue=current()/@enumValue]"> + <plx:condition> + <plx:callStatic dataTypeName="{$questionType}" name="{@enumValue}" type="field"/> + </plx:condition> + </xsl:for-each> <plx:assign> <plx:left> <plx:nameRef name="retVal"/> @@ -285,7 +290,22 @@ <xsl:copy-of select="child::plx:*"/> </xsl:when> <xsl:otherwise> - <plx:value data="{@imageIndex}" type="i4"/> + <xsl:variable name="offset" select="child::plx:*"/> + <xsl:choose> + <xsl:when test="$offset"> + <plx:binaryOperator type="add"> + <plx:left> + <xsl:copy-of select="$offset"/> + </plx:left> + <plx:right> + <plx:value data="{@imageIndex}" type="i4"/> + </plx:right> + </plx:binaryOperator> + </xsl:when> + <xsl:otherwise> + <plx:value data="{@imageIndex}" type="i4"/> + </xsl:otherwise> + </xsl:choose> </xsl:otherwise> </xsl:choose> </plx:right> @@ -316,6 +336,65 @@ </xsl:otherwise> </xsl:choose> </plx:function> + <plx:function name="GetDisplayData" visibility="public"> + <plx:interfaceMember dataTypeName="ISurveyQuestionTypeInfo" memberName="GetDisplayData"/> + <plx:param name="answer" dataTypeName=".i4"/> + <plx:returns dataTypeName="SurveyQuestionDisplayData"/> + <xsl:if test="qp:displaySupport[@displayCategory='DisplayData']"> + <xsl:variable name="displayDataMaps" select="qp:displayDataMap/qp:displayData[(@bold='true' or @bold='1') or (@gray='true' or @gray='1')]"/> + <xsl:if test="$displayDataMaps"> + <xsl:variable name="questionType" select="string(@questionType)"/> + <plx:switch> + <plx:condition> + <plx:cast dataTypeName="{$questionType}"> + <plx:nameRef name="answer" type="parameter"/> + </plx:cast> + </plx:condition> + <xsl:for-each select="$displayDataMaps"> + <plx:case> + <plx:condition> + <plx:callStatic dataTypeName="{$questionType}" name="{@enumValue}" type="field"/> + </plx:condition> + <xsl:for-each select="../qp:displayDataSameAs[@targetEnumValue=current()/@enumValue]"> + <plx:condition> + <plx:callStatic dataTypeName="{$questionType}" name="{@enumValue}" type="field"/> + </plx:condition> + </xsl:for-each> + <plx:return> + <plx:callNew dataTypeName="SurveyQuestionDisplayData"> + <plx:passParam> + <!-- The isBold parameter --> + <xsl:choose> + <xsl:when test="@bold='true' or @bold='1'"> + <plx:trueKeyword/> + </xsl:when> + <xsl:otherwise> + <plx:falseKeyword/> + </xsl:otherwise> + </xsl:choose> + </plx:passParam> + <plx:passParam> + <!-- The isGrayText parameter --> + <xsl:choose> + <xsl:when test="@gray='true' or @gray='1'"> + <plx:trueKeyword/> + </xsl:when> + <xsl:otherwise> + <plx:falseKeyword/> + </xsl:otherwise> + </xsl:choose> + </plx:passParam> + </plx:callNew> + </plx:return> + </plx:case> + </xsl:for-each> + </plx:switch> + </xsl:if> + </xsl:if> + <plx:return> + <plx:callStatic name="Default" dataTypeName="SurveyQuestionDisplayData" type="property"/> + </plx:return> + </plx:function> <plx:property name="UISupport" visibility="public"> <plx:interfaceMember dataTypeName="ISurveyQuestionTypeInfo" memberName="UISupport"/> <plx:returns dataTypeName="SurveyQuestionUISupport"/> Modified: trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.cs =================================================================== --- trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.cs 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.cs 2007-08-20 22:24:39 UTC (rev 1094) @@ -12,7 +12,8 @@ ProvideSurveyQuestionForSurveySchemaChildType.Instance}; private static readonly ISurveyQuestionTypeInfo[] mySurveyQuestionTypeInfo3 = new ISurveyQuestionTypeInfo[]{ ProvideSurveyQuestionForSurveyTableChildType.Instance, - ProvideSurveyQuestionForSurveyTableChildGlyphType.Instance}; + ProvideSurveyQuestionForSurveyTableChildGlyphType.Instance, + ProvideSurveyQuestionForSurveyColumnClassificationType.Instance}; private static readonly ISurveyQuestionTypeInfo[] mySurveyQuestionTypeInfo4 = new ISurveyQuestionTypeInfo[]{ ProvideSurveyQuestionForSurveyReferenceConstraintChildType.Instance}; private static readonly ISurveyQuestionTypeInfo[] mySurveyQuestionTypeInfo5 = new ISurveyQuestionTypeInfo[]{ @@ -96,6 +97,10 @@ { return answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -130,6 +135,10 @@ { return ((int)SurveySchemaType.Last + 1) + answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -164,6 +173,10 @@ { return -1; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -198,6 +211,10 @@ { return (((int)SurveySchemaType.Last + 1) + ((int)SurveySchemaChildType.Last + 1)) + answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -206,6 +223,61 @@ } } } + private sealed class ProvideSurveyQuestionForSurveyColumnClassificationType : ISurveyQuestionTypeInfo + { + private ProvideSurveyQuestionForSurveyColumnClassificationType() + { + } + public static readonly ISurveyQuestionTypeInfo Instance = new ProvideSurveyQuestionForSurveyColumnClassificationType(); + public Type QuestionType + { + get + { + return typeof(SurveyColumnClassificationType); + } + } + public int AskQuestion(object data) + { + IAnswerSurveyQuestion<SurveyColumnClassificationType> typedData = data as IAnswerSurveyQuestion<SurveyColumnClassificationType>; + if (typedData != null) + { + return typedData.AskQuestion(); + } + return -1; + } + public int MapAnswerToImageIndex(int answer) + { + int retVal; + switch ((SurveyColumnClassificationType)answer) + { + case SurveyColumnClassificationType.PrimaryRequired: + case SurveyColumnClassificationType.PrimaryNullable: + retVal = ((((((int)SurveySchemaType.Last + 1) + ((int)SurveySchemaChildType.Last + 1)) + ((int)SurveyTableChildGlyphType.Last + 1)) + ((int)SurveyReferenceConstraintChildType.Last + 1)) + ((int)SurveyUniquenessConstraintChildType.Last + 1)) + 0; + break; + default: + retVal = -1; + break; + } + return retVal; + } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + switch ((SurveyColumnClassificationType)answer) + { + case SurveyColumnClassificationType.Required: + case SurveyColumnClassificationType.PrimaryRequired: + return new SurveyQuestionDisplayData(true, false); + } + return SurveyQuestionDisplayData.Default; + } + public SurveyQuestionUISupport UISupport + { + get + { + return SurveyQuestionUISupport.Overlay | SurveyQuestionUISupport.DisplayData; + } + } + } private sealed class ProvideSurveyQuestionForSurveyReferenceConstraintChildType : ISurveyQuestionTypeInfo { private ProvideSurveyQuestionForSurveyReferenceConstraintChildType() @@ -232,6 +304,10 @@ { return ((((int)SurveySchemaType.Last + 1) + ((int)SurveySchemaChildType.Last + 1)) + ((int)SurveyTableChildGlyphType.Last + 1)) + answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get @@ -266,6 +342,10 @@ { return (((((int)SurveySchemaType.Last + 1) + ((int)SurveySchemaChildType.Last + 1)) + ((int)SurveyTableChildGlyphType.Last + 1)) + ((int)SurveyReferenceConstraintChildType.Last + 1)) + answer; } + public SurveyQuestionDisplayData GetDisplayData(int answer) + { + return SurveyQuestionDisplayData.Default; + } public SurveyQuestionUISupport UISupport { get Modified: trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.xml =================================================================== --- trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.xml 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/RelationalModel/DcilModel/DcilModel.SurveyQuestionProvider.xml 2007-08-20 22:24:39 UTC (rev 1094) @@ -63,6 +63,93 @@ </qp:offset> </qp:sequentialImageMap> </qp:surveyQuestion> + <qp:surveyQuestion questionType="SurveyColumnClassificationType"> + <qp:displaySupport displayCategory="Overlay"/> + <qp:displaySupport displayCategory="DisplayData"/> + <qp:explicitImageMap> + <qp:map enumValue="PrimaryRequired" imageIndex="0"> + <plx:binaryOperator type="add"> + <plx:left> + <plx:binaryOperator type="add"> + <plx:left> + <plx:binaryOperator type="add"> + <plx:left> + <plx:binaryOperator type="add"> + <plx:left> + <plx:binaryOperator type="add"> + <plx:left> + <plx:cast dataTypeName=".i4"> + <plx:callStatic dataTypeName="SurveySchemaType" name="Last" type="field"/> + </plx:cast> + </plx:left> + <plx:right> + <plx:value data="1" type="i4"/> + </plx:right> + </plx:binaryOperator> + </plx:left> + <plx:right> + <plx:binaryOperator type="add"> + <plx:left> + <plx:cast dataTypeName=".i4"> + <plx:callStatic dataTypeName="SurveySchemaChildType" name="Last" type="field"/> + </plx:cast> + </plx:left> + <plx:right> + <plx:value data="1" type="i4"/> + </plx:right> + </plx:binaryOperator> + </plx:right> + </plx:binaryOperator> + </plx:left> + <plx:right> + <plx:binaryOperator type="add"> + <plx:left> + <plx:cast dataTypeName=".i4"> + <plx:callStatic dataTypeName="SurveyTableChildGlyphType" name="Last" type="field"/> + </plx:cast> + </plx:left> + <plx:right> + <plx:value data="1" type="i4"/> + </plx:right> + </plx:binaryOperator> + </plx:right> + </plx:binaryOperator> + </plx:left> + <plx:right> + <plx:binaryOperator type="add"> + <plx:left> + <plx:cast dataTypeName=".i4"> + <plx:callStatic dataTypeName="SurveyReferenceConstraintChildType" name="Last" type="field"/> + </plx:cast> + </plx:left> + <plx:right> + <plx:value data="1" type="i4"/> + </plx:right> + </plx:binaryOperator> + </plx:right> + </plx:binaryOperator> + </plx:left> + <plx:right> + <plx:binaryOperator type="add"> + <plx:left> + <plx:cast dataTypeName=".i4"> + <plx:callStatic dataTypeName="SurveyUniquenessConstraintChildType" name="Last" type="field"/> + </plx:cast> + </plx:left> + <plx:right> + <plx:value data="1" type="i4"/> + </plx:right> + </plx:binaryOperator> + </plx:right> + </plx:binaryOperator> + </qp:map> + <qp:mapSameAs enumValue="PrimaryNullable" targetEnumValue="PrimaryRequired"/> + </qp:explicitImageMap> + <qp:displayDataMap> + <qp:displayData enumValue="Required" bold="true"/> + <qp:displayDataSameAs enumValue="PrimaryRequired" targetEnumValue="Required"/> + </qp:displayDataMap> + </qp:surveyQuestion> <qp:surveyQuestion questionType="SurveyReferenceConstraintChildType"> <qp:displaySupport displayCategory="Sorting"/> <qp:displaySupport displayCategory="Glyph"/> @@ -196,6 +283,7 @@ </qp:expansionKey> <qp:surveyQuestion ref="SurveyTableChildType"/> <qp:surveyQuestion ref="SurveyTableChildGlyphType"/> + <qp:surveyQuestion ref="SurveyColumnClassificationType"/> </qp:grouping> <qp:grouping> <qp:expansionKey> Modified: trunk/RelationalModel/DcilModel/Resources/SurveyTree.ImageStrip.png =================================================================== (Binary files differ) Modified: trunk/RelationalModel/DcilModel/SurveyImplementations/SurveyQuestions.cs =================================================================== --- trunk/RelationalModel/DcilModel/SurveyImplementations/SurveyQuestions.cs 2007-08-20 22:18:31 UTC (rev 1093) +++ trunk/RelationalModel/DcilModel/SurveyImplementations/SurveyQuestions.cs 2007-08-20 22:24:39 UTC (rev 1094) @@ -109,6 +109,32 @@ Last = PrimaryUniquenessConstraint, } /// <summary> + /// The list of possible answers to the ColumnNullableType category in the model browser + /// </summary> + public enum SurveyColumnClassificationType + { + /// <summary> + /// The column is required + /// </summary> + Required, + /// <summary> + /// The column is primary and required + /// </summary> + PrimaryRequired, + /// <summary> + /// The column is nullable + /// </summary> + Nullable, + /// <summary> + /// The column is primary and nullable + /// </summary> + PrimaryNullable, + /// <summary> + /// The current highest-valued value in the enumeration + /// </summary> + Last = PrimaryNullable, + } + /// <summary> /// The list of possible answers for the ReferenceConstraintChildType grouping in the model browser /// </summary> [TypeConverter(typeof(EnumConverter<SurveyReferenceConstraintChildType, Catalog>))] @@ -382,7 +408,7 @@ } #endregion // Table answers #region Column answers - partial class Column : IAnswerSurveyQuestion<SurveyTableChildType>, IAnswerSurveyQuestion<SurveyTableChildGlyphType>, ISurveyNode + partial class Column : IAnswerSurveyQuestion<SurveyTableChildType>, IAnswerSurveyQuestion<SurveyTableChildGlyphType>, IAnswerSurveyQuestion<SurveyColumnClassificationType>, ISurveyNode, ICustomComparableSurveyNode { #region IAnswerSurveyQuestion<SurveyTableChildType> Implementation int IAnswerSurveyQuestion<SurveyTableChildType>.AskQuestion() @@ -410,6 +436,21 @@ return (int)SurveyTableChildGlyphType.Column; } #endregion // IAnswerSurveyQuestion<SurveyTableChildGlyphType> Implementation + #region IAnswerSurveyQuestion<SurveyColumnClassificationType> Implementation + int IAnswerSurveyQuestion<SurveyColumnClassificationType>.AskQuestion() + { + return AskElementQuestionForClassification(); + } + /// <summary> + /// implementation of AskQuestion method from IAnswerSurveyQuestion + /// </summary> + protected int AskElementQuestionForClassification() + { + return (int)(IsPartOfPrimaryIdentifier ? + IsNullable ? SurveyColumnClassificationType.PrimaryNullable : SurveyColumnClassificationType.PrimaryRequired : + IsNullable ? SurveyColumnClassificationType.Nullable : SurveyColumnClassificationType.Required); + } + #endregion // IAnswerSurveyQuestion<SurveyTableChildGlyphType> Implementation #region ISurveyNode Implementation bool ISurveyNode.IsSurveyNameEditable { @@ -507,6 +548,48 @@ } } #endregion // ISurveyNode Implementation + #region ICustomComparableSurveyNode Implementation + int ICustomComparableSurveyNode.CompareToSurveyNode(object other) + { + return CompareToSurveyNode(other); + } + /// <summary> + /// Implements <see cref="ICustomComparableSurveyNode.CompareToSurveyNode"/>. Columns + /// sort with columns in the preferred identifier first. + /// </summary> + protected int CompareToSurveyNode(object other) + { + Column otherColumn = other as Column; + if (otherColumn != null) + { + bool leftIsPrimary = this.IsPartOfPrimaryIdentifier; + bool rightIsPrimary = otherColumn.IsPartOfPrimaryIdentifier; + if (leftIsPrimary ^ rightIsPrimary) + { + return leftIsPrimary ? -1 : 1; + } + } + // For this comparison, 0 implies no information is available + return 0; + } + /// <summary> + /// Is this column part of the primary identification scheme? + /// </summary> + private bool IsPartOfPrimaryIdentifier + { + get + { + foreach (UniquenessConstraint constraint in UniquenessConstraintIncludesColumn.GetUniquenessConstraints(this)) + { + if (constraint.IsPrimary) + { + return true; + } + } + return false; + } + } + #endregion // ICustomComparableSurveyNode Implementation } #endregion // Column answers #region ReferenceConstraint answers @@ -1248,6 +1331,8 @@ eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementPropertyChangedEventArgs>(TableChanged), action); // Column, uniqueness, and foreign key elements (inside table) + // UNDONE: This does not handle updates to the primary identifier keys and sort order. + // There are currently no incremental updates involving primary keys. eventManager.AddOrRemoveHandler(dataDir.FindDomainRelationship(TableContainsColumn.DomainClassId), new EventHandler<ElementAddedEventArgs>(ColumnAdded), action); classInfo = dataDir.FindDomainClass(Column.DomainClassId); eventManager.AddOrRemoveHandler(classInfo, new EventHandler<ElementDeletedEventArgs>(ElementRemoved), action); @@ -1280,6 +1365,7 @@ #endregion // IModelingEventSubscriber Implementation #region SurveyQuestion event handlers private static readonly Type[] SurveyTableChildGlyphTypeQuestionTypes = new Type[] { typeof(SurveyTableChildGlyphType) }; + private static readonly Type[] SurveyColumnClassificationTypeQuestionTypes = new Type[] { typeof(SurveyColumnClassificationType) }; /// <summary> /// This will work for almost all delete scenarios /// </summary> @@ -1351,11 +1437,12 @@ } private static void ColumnChanged(object sender, ElementPropertyChangedEventArgs e) { - if (e.DomainProperty.Id == Column.NameDomainPropertyId) + INotifySurveyElementChanged eventNotify; + ModelElement element = e.ModelElement; + if (null != (eventNotify = (element.Store as IORMToolServices).NotifySurveyElementChanged)) { - INotifySurveyElementChanged eventNotify; - ModelElement element = e.ModelElement; - if (null != (eventNotify = (element.Store as IORMToolServices).NotifySurveyElementChanged)) + Guid attributeId = e.DomainProperty.Id; + if (attributeId == Column.NameDomainPropertyId) { eventNotify.ElementRenamed(element); Column column = (Column)element; @@ -1372,6 +1459,10 @@ eventNotify.ElementRenamed(columnRef); } } + else if (attributeId == Column.IsNullableDomainPropertyId) + { + eventNotify.ElementChanged(e.ModelElement, SurveyColumnClassificationTypeQuestionTypes); + } } } private static void ReferenceConstraintAdded(object sender, ElementAddedEventArgs e) @@ -1440,7 +1531,7 @@ } else if (attributeId == UniquenessConstraint.IsPrimaryDomainPropertyId) { - eventNotify.ElementChanged(element, ConceptualDatabaseDomainModel.SurveyTableChildGlyphTypeQuestionTypes); + eventNotify.ElementChanged(element, SurveyTableChildGlyphTypeQuestionTypes); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 22:18:28
|
Revision: 1093 http://orm.svn.sourceforge.net/orm/?rev=1093&view=rev Author: mcurland Date: 2007-08-20 15:18:31 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added incremental rules for updating Column.IsNullable. refs #328 Modified Paths: -------------- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs Modified: trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:13:30 UTC (rev 1092) +++ trunk/RelationalModel/OialDcilBridge/ModificationTracker.cs 2007-08-20 22:18:31 UTC (rev 1093) @@ -26,6 +26,16 @@ // for cases where we start from an empty ORM model /// <summary> + /// ChangeRule: typeof(Neumont.Tools.ORMAbstraction.ConceptTypeChild) + /// </summary> + private static void ConceptTypeChildChangedRule(ElementPropertyChangedEventArgs e) + { + if (e.DomainProperty.Id == ConceptTypeChild.IsMandatoryDomainPropertyId) + { + ValidateAssociatedColumnsIsNullable((ConceptTypeChild)e.ModelElement); + } + } + /// <summary> /// AddRule: typeof(Neumont.Tools.ORMAbstraction.AbstractionModelHasConceptType) /// </summary> private static void ConceptTypeAddedRule(ElementAddedEventArgs e) @@ -73,6 +83,43 @@ constraint.Delete(); } } + [DelayValidatePriority(DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] + private static void RebuildForAbstractionModelDelayed(ModelElement element) + { + if (!element.IsDeleted) + { + AbstractionModel model = (AbstractionModel)element; + Schema schema = SchemaIsForAbstractionModel.GetSchema(model); + if (schema != null) + { + schema.TableCollection.Clear(); + schema.DomainCollection.Clear(); + FullyGenerateConceptualDatabaseModel(schema, model); + } + } + } + private static void ValidateAssociatedColumnsIsNullable(ConceptTypeChild child) + { + bool canBeNullable = !child.IsMandatory; + foreach (Column column in ColumnHasConceptTypeChild.GetColumn(child)) + { + if (canBeNullable ? !column.IsNullable : column.IsNullable) + { + FrameworkDomainModel.DelayValidateElement(column, ValidateColumnIsNullableDelayed); + } + } + } + [DelayValidatePriority(10, DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] + private static void ValidateColumnIsNullableDelayed(ModelElement element) + { + // Check if the element survived regeneration. Note priority is after RebuildForAbstractionModelDelayed + if (!element.IsDeleted) + { + CheckColumnConstraint((Column)element); + } + } + #endregion // Abstraction model modification rules + #region Bridge element modification rules /// <summary> /// ChangeRule: typeof(Neumont.Tools.ORMAbstraction.AbstractionModel) /// Update the schema name when the abstraction model name changes @@ -89,22 +136,7 @@ } } } - [DelayValidatePriority(DomainModelType = typeof(AbstractionDomainModel), Order = DelayValidatePriorityOrder.AfterDomainModel)] - private static void RebuildForAbstractionModelDelayed(ModelElement element) - { - if (!element.IsDeleted) - { - AbstractionModel model = (AbstractionModel)element; - Schema schema = SchemaIsForAbstractionModel.GetSchema(model); - if (schema != null) - { - schema.TableCollection.Clear(); - schema.DomainCollection.Clear(); - FullyGenerateConceptualDatabaseModel(schema, model); - } - } - } - #endregion // Abstraction model modification rules + #endregion // Bridge element modification rules } #endregion // Regeneration rule delay validation methods } Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs 2007-08-20 22:13:30 UTC (rev 1092) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.cs 2007-08-20 22:18:31 UTC (rev 1093) @@ -36,6 +36,7 @@ retVal = new Type[]{ typeof(ModificationTracker).GetNestedType("AbstractionModelChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("ConceptTypeAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(ModificationTracker).GetNestedType("ConceptTypeChildChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("ConceptTypeDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("InformationTypeFormatAddedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(ModificationTracker).GetNestedType("InformationTypeFormatDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), @@ -73,7 +74,7 @@ { Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager; Type[] disabledRuleTypes = ORMAbstractionToConceptualDatabaseBridgeDomainModel.CustomDomainModelTypes; - for (int i = 0; i < 6; ++i) + for (int i = 0; i < 7; ++i) { ruleManager.EnableRule(disabledRuleTypes[i]); } @@ -142,6 +143,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeAddedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORMAbstraction.ConceptTypeChild))] + private sealed class ConceptTypeChildChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public ConceptTypeChildChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker + /// /// <summary> + /// /// ChangeRule: typeof(Neumont.Tools.ORMAbstraction.ConceptTypeChild) + /// /// </summary> + /// private static void ConceptTypeChildChangedRule(ElementPropertyChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementPropertyChanged(Microsoft.VisualStudio.Modeling.ElementPropertyChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeChildChangedRule"); + ModificationTracker.ConceptTypeChildChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMAbstractionToConceptualDatabaseBridge.ORMAbstractionToConceptualDatabaseBridgeDomainModel.ModificationTracker.ConceptTypeChildChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORMAbstraction.AbstractionModelHasConceptType))] private sealed class ConceptTypeDeletedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule { Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml 2007-08-20 22:13:30 UTC (rev 1092) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.AttachRules.xml 2007-08-20 22:18:31 UTC (rev 1093) @@ -23,6 +23,9 @@ <arg:AddRule methodName="ConceptTypeAddedRule"> <arg:RuleOn targetType="AbstractionModelHasConceptType" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:AddRule> + <arg:ChangeRule methodName="ConceptTypeChildChangedRule"> + <arg:RuleOn targetType="ConceptTypeChild" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> + </arg:ChangeRule> <arg:DeleteRule methodName="ConceptTypeDeletedRule"> <arg:RuleOn targetType="AbstractionModelHasConceptType" targetTypeQualifier="Neumont.Tools.ORMAbstraction"/> </arg:DeleteRule> Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 22:13:30 UTC (rev 1092) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 22:18:31 UTC (rev 1093) @@ -180,10 +180,9 @@ foreach (Table table in schema.TableCollection) { - CreateForeignKeys(table, store); + CreateForeignKeys(table); + GenerateMandatoryConstraints(table); } - - GenerateAllMandatoryConstraints(schema); } /// <summary> @@ -714,8 +713,7 @@ /// CreateForeignKeys looks at a table and creates the foreign keys between it. /// </summary> /// <param name="table">The table to check for foreign keys on.</param> - /// <param name="store">The <see cref="Store" />.</param> - private static void CreateForeignKeys(Table table, Store store) + private static void CreateForeignKeys(Table table) { Dictionary<ConceptTypeRelatesToConceptType, List<Column>> foreignKeyList = new Dictionary<ConceptTypeRelatesToConceptType, List<Column>>(); @@ -737,9 +735,11 @@ } } } + Store store = table.Store; foreach (KeyValuePair<ConceptTypeRelatesToConceptType, List<Column>> keyValuePair in foreignKeyList) { - ReferenceConstraint referenceConstraint = new ReferenceConstraint(store, new PropertyAssignment[] { new PropertyAssignment(ReferenceConstraint.NameDomainPropertyId, keyValuePair.Key.Name) }); + ReferenceConstraint referenceConstraint = null; + LinkedElementCollection<ColumnReference> referenceColumns = null; foreach (Column column in keyValuePair.Value) { Column targetColumn = FindTarget(column, keyValuePair.Key.ReferencedConceptType); @@ -747,13 +747,15 @@ { break; } - ColumnReference columnReference = new ColumnReference(column, targetColumn); - referenceConstraint.ColumnReferenceCollection.Add(columnReference); - if (table != null && !table.ReferenceConstraintCollection.Contains(referenceConstraint)) + if (referenceConstraint == null) { - TableContainsReferenceConstraint tableContainsReferenceConstraint = new TableContainsReferenceConstraint(table, referenceConstraint); - ReferenceConstraintTargetsTable referenceConstraintTargetsTable = new ReferenceConstraintTargetsTable(referenceConstraint, targetColumn.Table); + referenceConstraint = new ReferenceConstraint(store, new PropertyAssignment[] { new PropertyAssignment(ReferenceConstraint.NameDomainPropertyId, keyValuePair.Key.Name) }); + // Add it to the table + new TableContainsReferenceConstraint(table, referenceConstraint); + referenceColumns = referenceConstraint.ColumnReferenceCollection; + new ReferenceConstraintTargetsTable(referenceConstraint, targetColumn.Table); } + referenceColumns.Add(new ColumnReference(column, targetColumn)); } } } @@ -1181,29 +1183,29 @@ } /// <summary> - /// + /// Set the IsNullable property for all columns on the table /// </summary> - /// <param name="schema"></param> - private static void GenerateAllMandatoryConstraints(Schema schema) + /// <param name="table">The <see cref="Table"/> to set initial constraints for</param> + private static void GenerateMandatoryConstraints(Table table) { - foreach (Table table in schema.TableCollection) + foreach (Column column in table.ColumnCollection) { - foreach (Column column in table.ColumnCollection) - { - CheckColumnConstraint(column); - } + CheckColumnConstraint(column); } } private static void CheckColumnConstraint(Column column) { + bool allStepsMandatory = true; foreach (ConceptTypeChild concept in ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)) { if (!concept.IsMandatory) { - column.IsNullable = true; + allStepsMandatory = false; + break; } } + column.IsNullable = !allStepsMandatory; } #endregion // Fully populate from OIAL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 22:13:27
|
Revision: 1092 http://orm.svn.sourceforge.net/orm/?rev=1092&view=rev Author: mcurland Date: 2007-08-20 15:13:30 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Cleaned up the ForeignKey generation to check that it's mapping to the correct targetColumn. Implemented initial mandatory constraint mapping to columns refs #328. Modified Paths: -------------- trunk/ORMModel/ORMModel.csproj trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs Modified: trunk/ORMModel/ORMModel.csproj =================================================================== --- trunk/ORMModel/ORMModel.csproj 2007-08-20 22:09:33 UTC (rev 1091) +++ trunk/ORMModel/ORMModel.csproj 2007-08-20 22:13:30 UTC (rev 1092) @@ -716,10 +716,6 @@ <SubType>Designer</SubType> <DesignTime>True</DesignTime> </EmbeddedResource> - <EmbeddedResource Include="Shell\ExtensionManager.resx"> - <SubType>Designer</SubType> - <DependentUpon>ExtensionManager.cs</DependentUpon> - </EmbeddedResource> <EmbeddedResource Include="Shell\PackageResources\VSPackage.resx"> <LogicalName>VSPackage.resources</LogicalName> <SubType>Designer</SubType> Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 22:09:33 UTC (rev 1091) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 22:13:30 UTC (rev 1092) @@ -182,6 +182,8 @@ { CreateForeignKeys(table, store); } + + GenerateAllMandatoryConstraints(schema); } /// <summary> @@ -810,12 +812,42 @@ } } } + // Walk the assimililating path looking for possible relationships that may hold the key. if (columns.Count == 0) { InformationType matchingBaseType = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)[ColumnHasConceptTypeChild.GetConceptTypeChildPath(column).Count - 1] as InformationType; + LinkedElementCollection<ConceptType> assimilations; + while (columns.Count == 0 && (assimilations = conceptType.AssimilatorConceptTypeCollection).Count != 0) + { + conceptType = assimilations[0]; + + Table targetTable = TableIsPrimarilyForConceptType.GetTable(conceptType); + + //LinkedElementCollection<ConceptType> relating = ConceptTypeRelatesToConceptType.GetRelatingConceptTypeCollection(conceptType); + //int relatingCount = relating.Count; + //ConceptType[] real = new ConceptType[] { relatingCount }; + //relating.CopyTo(real, 0); + + if (targetTable != null) + { + foreach (Column possibleColumn in targetTable.ColumnCollection) + { + if (ColumnHasConceptTypeChild.GetConceptTypeChildPath(possibleColumn)[ColumnHasConceptTypeChild.GetConceptTypeChildPath(possibleColumn).Count - 1] == matchingBaseType) + { + columns.Add(possibleColumn); + } + } + } + } + } + + if(columns.Count == 0) + { + InformationType matchingBaseType = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)[ColumnHasConceptTypeChild.GetConceptTypeChildPath(column).Count - 1] as InformationType; LinkedElementCollection<ConceptType> assimilations; + while (columns.Count == 0 && (assimilations = conceptType.AssimilatorConceptTypeCollection).Count != 0) { conceptType = assimilations[0]; @@ -913,61 +945,63 @@ } } - //LinkedElementCollection<ConceptType> relating = ConceptTypeRelatesToConceptType.GetRelatingConceptTypeCollection(conceptType); //int relatingCount = relating.Count; //ConceptType[] real = new ConceptType[] { relatingCount }; //relating.CopyTo(real, 0); + List<Column> possibleColumns = ConceptTypeHasPrimaryIdentifierColumns(column, conceptType); - foreach (Column targetColumn in ConceptTypeHasPrimaryIdentifierColumns(column, conceptType)) + foreach (Column targetColumn in possibleColumns) { targetFound = true; - int offset = 0; - - for (int i = 0; i < ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn).Count; ++i) + if (targetColumn.Equals(column)) { - LinkedElementCollection<ConceptTypeChild> leftPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column); - LinkedElementCollection<ConceptTypeChild> rightPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn); - - // Look through the target path and find the first information type and set its index as the offset. - for (int j = 0; j < rightPath.Count; ++j) + targetFound = false; + } + else + { + for (int i = 0; i < ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn).Count; ++i) { - if (rightPath[j].GetType() == typeof(InformationType)) - { - offset = j; - } - } + LinkedElementCollection<ConceptTypeChild> leftPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(column); + LinkedElementCollection<ConceptTypeChild> rightPath = ColumnHasConceptTypeChild.GetConceptTypeChildPath(targetColumn); - // UNDONE Decimal comparision operator ID is breaking here, possibly because it is attempting to map downward, it's an odd FK. good tester - // UNDONE This may also be a part of the reason why we have some FK's that arn't mapping and are apearing outside of the column. - // TEST - if (leftPath.Count >= rightPath.Count) - { - for (int reverseIndex = rightPath.Count - 1; reverseIndex < 0; reverseIndex++) + // Look through the target path and find the first information type and set its index as the offset. + //for (int j = 0; j < rightPath.Count; ++j) + //{ + // if (rightPath[j].GetType() == typeof(InformationType)) + // { + // offset = j; + // } + //} + + // UNDONE Decimal comparision operator ID is breaking here, possibly because it is attempting to map downward, it's an odd FK. good tester + // UNDONE This may also be a part of the reason why we have some FK's that arn't mapping and are apearing outside of the column. + // TEST + if (leftPath.Count >= rightPath.Count) { - if (rightPath[reverseIndex] != leftPath[reverseIndex]) + for (int reverseIndex = 0; reverseIndex < rightPath.Count; reverseIndex++) { - targetFound = false; - break; + if (rightPath[rightPath.Count - 1 - reverseIndex] != leftPath[leftPath.Count - 1 - reverseIndex]) + { + targetFound = false; + break; + } + } - } - } - else - { - for (int reverseIndex = leftPath.Count - 1; reverseIndex < 0; reverseIndex++) + else { - if (leftPath[reverseIndex] != rightPath[reverseIndex]) + for (int reverseIndex = 0; reverseIndex < leftPath.Count; reverseIndex++) { - targetFound = false; - break; + if (leftPath[leftPath.Count - 1 - reverseIndex] != rightPath[rightPath.Count - 1 - reverseIndex]) + { + targetFound = false; + break; + } } } - - } - // END TEST //if ((i + 1 < leftPath.Count && i + offset < rightPath.Count && @@ -1146,6 +1180,32 @@ return null; } + /// <summary> + /// + /// </summary> + /// <param name="schema"></param> + private static void GenerateAllMandatoryConstraints(Schema schema) + { + foreach (Table table in schema.TableCollection) + { + foreach (Column column in table.ColumnCollection) + { + CheckColumnConstraint(column); + } + } + } + + private static void CheckColumnConstraint(Column column) + { + foreach (ConceptTypeChild concept in ColumnHasConceptTypeChild.GetConceptTypeChildPath(column)) + { + if (!concept.IsMandatory) + { + column.IsNullable = true; + } + } + } + #endregion // Fully populate from OIAL #region IDeserializationFixupListenerProvider Implementation /// <summary> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 21:47:17
|
Revision: 1090 http://orm.svn.sourceforge.net/orm/?rev=1090&view=rev Author: mcurland Date: 2007-08-20 14:47:19 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Added additional rules for propagating ORM model changes to the abstraction model. Mandatory changes and uniqueness constraint deletion cases that do not modify absorption are handled incrementally. Preferred identifier changes fully regenerate. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ModificationTracker.cs trunk/Oial/ORMOialBridge/ORMElementGateway.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/Oial/ORMOialBridge/ModificationTracker.cs =================================================================== --- trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ModificationTracker.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -114,6 +114,59 @@ } } } + /// <summary> + /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// Changing the preferred identifier for an <see cref="ObjectType"/> is considered to + /// be a significant change until we support full incremental tracking. + /// </summary> + private static void PreferredIdentifierRolePlayerChangedRule(RolePlayerChangedEventArgs e) + { + // UNDONE: Incremental changes, propagate changes to Uniqueness.IsPreferred property + EntityTypeHasPreferredIdentifier link = (EntityTypeHasPreferredIdentifier)e.ElementLink; + if (e.DomainRole.Id == EntityTypeHasPreferredIdentifier.PreferredIdentifierForDomainRoleId) + { + SignificantObjectTypeChange((ObjectType)e.OldRolePlayer); + } + SignificantObjectTypeChange(link.PreferredIdentifierFor); + } + /// <summary> + /// DeleteRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// If an <see cref="ObjectType"/> is alive after gateway processing when its preferred identifier + /// is deleted then it needs to be reprocessed. + /// </summary> + private static void PreferredIdentifierDeletedRule(ElementDeletedEventArgs e) + { + // UNDONE: Incremental If this gets passed the gateway and is not excluded, + // then it changed from an EntityType to a ValueType + ObjectType objectType = ((EntityTypeHasPreferredIdentifier)e.ModelElement).PreferredIdentifierFor; + if (!objectType.IsDeleted) + { + SignificantObjectTypeChange(objectType); + } + } + /// <summary> + /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole) + /// Revalidate the model when the <see cref="ObjectType">role player</see> of a <see cref="Role"/> + /// is changed. + /// </summary> + private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e) + { + // UNDONE: Incremental changes will not be as severe here. Note that adding + // and deleting role players already triggers the correct actions in the + // gateway rules. However, a change where none of the parties are excluded + // simply needs to regenerate for now. + ObjectTypePlaysRole link = (ObjectTypePlaysRole)e.ElementLink; + if (e.DomainRole.Id == ObjectTypePlaysRole.PlayedRoleDomainRoleId) + { + SignificantFactTypeChange(((Role)e.OldRolePlayer).FactType); + } + else + { + SignificantObjectTypeChange((ObjectType)e.OldRolePlayer); + } + SignificantObjectTypeChange(link.RolePlayer); + SignificantFactTypeChange(link.PlayedRole.FactType); + } #endregion // ORM modification rule methods #region Bridge deletion rule methods /// <summary> @@ -154,6 +207,20 @@ AddTransactedModelElement(conceptType, ModelElementModification.AbstractionElementDetached); } } + /// <summary> + /// DeleteRule: typeof(UniquenessIsForUniquenessConstraint) + /// </summary> + private static void UniquenessBridgeDetachedRule(ElementDeletedEventArgs e) + { + Uniqueness uniqueness = ((UniquenessIsForUniquenessConstraint)e.ModelElement).Uniqueness; + if (!uniqueness.IsDeleted) + { + // We don't want to rebuild the model for this case. Any significant + // change that affects the absorption pattern will remove it, and + // there are no cases where we need to keep it. Just propagate. + uniqueness.Delete(); + } + } #endregion // Bridge deletion rule methods #region General validation helper methods private static bool IsRelevantConstraint(IConstraint constraint) @@ -198,7 +265,10 @@ MappingMandatoryPattern endMandatoryPattern = mapToRole.MandatoryPattern; if (endMandatoryPattern != startMandatoryPattern) { - // UNDONE: Propagate IsMandatory changes directly to the model + foreach (ConceptTypeChild child in ConceptTypeChildHasPathFactType.GetConceptTypeChild(factType)) + { + ValidateMandatory(child, startMandatoryPattern, endMandatoryPattern); + } } } else @@ -209,6 +279,88 @@ } } } + /// <summary> + /// The <see cref="ConceptTypeChild.IsMandatory">IsMandatory</see> setting may + /// have change, revalidate if necessary. + /// </summary> + /// <param name="child">The <see cref="ConceptTypeChild"/> element to validate</param> + /// <param name="oldMandatory">The old mandatory pattern for any <see cref="FactType"/> in the path.</param> + /// <param name="newMandatory">The new mandatory pattern for any <see cref="FactType"/> in the path.</param> + private static void ValidateMandatory(ConceptTypeChild child, MappingMandatoryPattern oldMandatory, MappingMandatoryPattern newMandatory) + { + // We pre filter this and don't both to notify unless a change is possible + bool mightHaveChanged = false; + if (child.IsMandatory) + { + switch (oldMandatory) + { + case MappingMandatoryPattern.BothRolesMandatory: + case MappingMandatoryPattern.TowardsRoleMandatory: + switch (newMandatory) + { + case MappingMandatoryPattern.OppositeRoleMandatory: + case MappingMandatoryPattern.NotMandatory: + mightHaveChanged = true; + break; + } + break; + } + } + else + { + switch (oldMandatory) + { + case MappingMandatoryPattern.NotMandatory: + case MappingMandatoryPattern.OppositeRoleMandatory: + switch (newMandatory) + { + case MappingMandatoryPattern.BothRolesMandatory: + case MappingMandatoryPattern.TowardsRoleMandatory: + mightHaveChanged = true; + break; + } + break; + } + } + if (mightHaveChanged) + { + FrameworkDomainModel.DelayValidateElement(child, ValidateMandatoryDelayed); + } + } + [DelayValidatePriority(ValidationPriority.ValidateMandatory)] + private static void ValidateMandatoryDelayed(ModelElement element) + { + if (!element.IsDeleted) + { + ConceptTypeChild child = (ConceptTypeChild)element; + bool newMandatory = true; + foreach (FactType factType in ConceptTypeChildHasPathFactType.GetPathFactTypeCollection(child)) + { + FactTypeMapsTowardsRole towardsRoleLink = FactTypeMapsTowardsRole.GetLinkToTowardsRole(factType); + if (null == towardsRoleLink) + { + newMandatory = false; + break; + } + else + { + switch (towardsRoleLink.MandatoryPattern) + { + case MappingMandatoryPattern.None: + case MappingMandatoryPattern.NotMandatory: + case MappingMandatoryPattern.OppositeRoleMandatory: + newMandatory = false; + break; + } + if (!newMandatory) + { + break; + } + } + } + child.IsMandatory = newMandatory; + } + } private static void SignificantFactTypeChange(FactType factType) { if (factType != null && Modified: trunk/Oial/ORMOialBridge/ORMElementGateway.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMElementGateway.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -31,20 +31,6 @@ /// </summary> private static partial class ORMElementGateway { - #region ValidationPriority enum - /// <summary> - /// DelayValidate ordering constants - /// </summary> - private static class ValidationPriority - { - public const int NewObjectType = -100; - public const int ReconsiderObjectType = -90; - public const int NewFactType = -80; - public const int ReconsiderFactType = -70; - public const int RemoveExcludedBridgeRelationships = -60; - public const int AddElement = -50; - } - #endregion // ValidationPriority enum #region Public methods /// <summary> /// Returns <see langword="true"/> if an element is currently excluded from @@ -168,7 +154,7 @@ } #endregion // ShouldConsider* methods, determine if an element should be filtered #region FilterNew* methods, determine filtering for newly created elements - [DelayValidatePriority(ValidationPriority.NewFactType)] + [DelayValidatePriority(ValidationPriority.GatewayNewFactType)] private static void FilterNewFactType(ModelElement element) { ModelHasFactType link = element as ModelHasFactType; @@ -182,7 +168,7 @@ ExcludeFactType(factType); } } - [DelayValidatePriority(ValidationPriority.NewObjectType)] + [DelayValidatePriority(ValidationPriority.GatewayNewObjectType)] private static void FilterNewObjectType(ModelElement element) { ModelHasObjectType link = element as ModelHasObjectType; @@ -219,7 +205,7 @@ } } } - [DelayValidatePriority(ValidationPriority.ReconsiderFactType)] + [DelayValidatePriority(ValidationPriority.GatewayReconsiderFactType)] private static void FilterModifiedFactTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -260,7 +246,7 @@ FrameworkDomainModel.DelayValidateElement(objectType, FilterModifiedObjectTypeDelayed); } } - [DelayValidatePriority(ValidationPriority.ReconsiderObjectType)] + [DelayValidatePriority(ValidationPriority.GatewayReconsiderObjectType)] private static void FilterModifiedObjectTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -374,7 +360,7 @@ /// Delay validation callback used when the state of a <see cref="FactType"/> /// has changed such that it may or may not be included in the abstraction model. /// </summary> - [DelayValidatePriority(ValidationPriority.AddElement)] + [DelayValidatePriority(ValidationPriority.GatewayAddElement)] private static void AddFactTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -404,7 +390,7 @@ /// Delay validation callback used when the state of a <see cref="ObjectType"/> /// has changed such that it may or may not be included in the abstraction model. /// </summary> - [DelayValidatePriority(ValidationPriority.AddElement)] + [DelayValidatePriority(ValidationPriority.GatewayAddElement)] private static void AddObjectTypeDelayed(ModelElement element) { if (!element.IsDeleted) @@ -429,7 +415,7 @@ { FrameworkDomainModel.DelayValidateElement(e.ModelElement, ExclusionAdded); } - [DelayValidatePriority(ValidationPriority.RemoveExcludedBridgeRelationships)] + [DelayValidatePriority(ValidationPriority.GatewayRemoveExcludedBridgeRelationships)] private static void ExclusionAdded(ModelElement element) { ExcludedORMModelElement link = (ExcludedORMModelElement)element; Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -51,7 +51,11 @@ typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ConstraintRoleDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ObjectTypeChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("ORMModelChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), - typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("SetConstraintChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic)}; + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("PreferredIdentifierDeletedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("PreferredIdentifierRolePlayerChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("RolePlayerRolePlayerChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("SetConstraintChangedRuleClass", BindingFlags.Public | BindingFlags.NonPublic), + typeof(AbstractionModelIsForORMModel).GetNestedType("ModificationTracker", BindingFlags.Public | BindingFlags.NonPublic).GetNestedType("UniquenessBridgeDetachedRuleClass", BindingFlags.Public | BindingFlags.NonPublic)}; ORMToORMAbstractionBridgeDomainModel.myCustomDomainModelTypes = retVal; System.Diagnostics.Debug.Assert(Array.IndexOf<Type>(retVal, null) < 0, "One or more rule types failed to resolve. The file and/or package will fail to load."); } @@ -85,7 +89,7 @@ { Microsoft.VisualStudio.Modeling.RuleManager ruleManager = store.RuleManager; Type[] disabledRuleTypes = ORMToORMAbstractionBridgeDomainModel.CustomDomainModelTypes; - for (int i = 0; i < 18; ++i) + for (int i = 0; i < 22; ++i) { ruleManager.EnableRule(disabledRuleTypes[i]); } @@ -572,6 +576,84 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.ORMModelChangedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier))] + private sealed class PreferredIdentifierDeletedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule + { + [System.Diagnostics.DebuggerStepThrough()] + public PreferredIdentifierDeletedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// DeleteRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// /// </summary> + /// private static void PreferredIdentifierDeletedRule(ElementDeletedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementDeleted(Microsoft.VisualStudio.Modeling.ElementDeletedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierDeletedRule"); + ModificationTracker.PreferredIdentifierDeletedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierDeletedRule"); + } + } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier))] + private sealed class PreferredIdentifierRolePlayerChangedRuleClass : Microsoft.VisualStudio.Modeling.RolePlayerChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public PreferredIdentifierRolePlayerChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.EntityTypeHasPreferredIdentifier) + /// /// </summary> + /// private static void PreferredIdentifierRolePlayerChangedRule(RolePlayerChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void RolePlayerChanged(Microsoft.VisualStudio.Modeling.RolePlayerChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierRolePlayerChangedRule"); + ModificationTracker.PreferredIdentifierRolePlayerChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.PreferredIdentifierRolePlayerChangedRule"); + } + } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole))] + private sealed class RolePlayerRolePlayerChangedRuleClass : Microsoft.VisualStudio.Modeling.RolePlayerChangeRule + { + [System.Diagnostics.DebuggerStepThrough()] + public RolePlayerRolePlayerChangedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// RolePlayerChangeRule: typeof(Neumont.Tools.ORM.ObjectModel.ObjectTypePlaysRole) + /// /// </summary> + /// private static void RolePlayerRolePlayerChangedRule(RolePlayerChangedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void RolePlayerChanged(Microsoft.VisualStudio.Modeling.RolePlayerChangedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.RolePlayerRolePlayerChangedRule"); + ModificationTracker.RolePlayerRolePlayerChangedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ElementLink.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.RolePlayerRolePlayerChangedRule"); + } + } [Microsoft.VisualStudio.Modeling.RuleOn(typeof(Neumont.Tools.ORM.ObjectModel.SetConstraint))] private sealed class SetConstraintChangedRuleClass : Microsoft.VisualStudio.Modeling.ChangeRule { @@ -598,6 +680,32 @@ Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.SetConstraintChangedRule"); } } + [Microsoft.VisualStudio.Modeling.RuleOn(typeof(UniquenessIsForUniquenessConstraint))] + private sealed class UniquenessBridgeDetachedRuleClass : Microsoft.VisualStudio.Modeling.DeleteRule + { + [System.Diagnostics.DebuggerStepThrough()] + public UniquenessBridgeDetachedRuleClass() + { + base.IsEnabled = false; + } + /// <summary> + /// Provide the following method in class: + /// Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker + /// /// <summary> + /// /// DeleteRule: typeof(UniquenessIsForUniquenessConstraint) + /// /// </summary> + /// private static void UniquenessBridgeDetachedRule(ElementDeletedEventArgs e) + /// { + /// } + /// </summary> + [System.Diagnostics.DebuggerStepThrough()] + public override void ElementDeleted(Microsoft.VisualStudio.Modeling.ElementDeletedEventArgs e) + { + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleStart(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.UniquenessBridgeDetachedRule"); + ModificationTracker.UniquenessBridgeDetachedRule(e); + Neumont.Tools.Modeling.Diagnostics.TraceUtility.TraceRuleEnd(e.ModelElement.Store, "Neumont.Tools.ORMToORMAbstractionBridge.AbstractionModelIsForORMModel.ModificationTracker.UniquenessBridgeDetachedRule"); + } + } } } #endregion // Rule classes for AbstractionModelIsForORMModel.ModificationTracker Modified: trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/ORMOialBridge.AttachRules.xml 2007-08-20 21:47:19 UTC (rev 1090) @@ -80,9 +80,21 @@ <arg:ChangeRule methodName="ORMModelChangedRule"> <arg:RuleOn targetType="ORMModel" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:ChangeRule> + <arg:DeleteRule methodName="PreferredIdentifierDeletedRule"> + <arg:RuleOn targetType="EntityTypeHasPreferredIdentifier" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:DeleteRule> + <arg:RolePlayerChangeRule methodName="PreferredIdentifierRolePlayerChangedRule"> + <arg:RuleOn targetType="EntityTypeHasPreferredIdentifier" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:RolePlayerChangeRule> + <arg:RolePlayerChangeRule methodName="RolePlayerRolePlayerChangedRule"> + <arg:RuleOn targetType="ObjectTypePlaysRole" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> + </arg:RolePlayerChangeRule> <arg:ChangeRule methodName="SetConstraintChangedRule"> <arg:RuleOn targetType="SetConstraint" targetTypeQualifier="Neumont.Tools.ORM.ObjectModel"/> </arg:ChangeRule> + <arg:DeleteRule methodName="UniquenessBridgeDetachedRule"> + <arg:RuleOn targetType="UniquenessIsForUniquenessConstraint"/> + </arg:DeleteRule> </arg:RuleContainer> </arg:Model> </arg:Rules> \ No newline at end of file Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 21:45:28 UTC (rev 1089) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-20 21:47:19 UTC (rev 1090) @@ -15,6 +15,53 @@ { public partial class AbstractionModelIsForORMModel { + #region ValidationPriority enum + /// <summary> + /// DelayValidate ordering constants. Handles non-zero values for + /// validation methods in this class and nested classes. + /// </summary> + private static class ValidationPriority + { + /// <summary> + /// A new <see cref="ObjectType"/> has been added to the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayNewObjectType = -100; + /// <summary> + /// An <see cref="ObjectType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayReconsiderObjectType = -90; + /// <summary> + /// A <see cref="FactType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayNewFactType = -80; + /// <summary> + /// A <see cref="FactType"/> has been modified in the ORM model, establish + /// gateway exclusion relationships. + /// </summary> + public const int GatewayReconsiderFactType = -70; + /// <summary> + /// Gateway exclusion relationships have been added, remove other existing + /// bridge relationships + /// </summary> + public const int GatewayRemoveExcludedBridgeRelationships = -60; + /// <summary> + /// A new element has been added and passed gateway filtering + /// </summary> + public const int GatewayAddElement = -50; + /// <summary> + /// Validate the model. Current rebuilds the entire model. + /// </summary> + public const int ValidateModel = 100; + /// <summary> + /// Reset mandatory properties. This is done after ValidateModel + /// so that we don't waste time + /// </summary> + public const int ValidateMandatory = 110; + } + #endregion // ValidationPriority enum #region Element tracking transaction support #region ModelElementModification enum /// <summary> @@ -77,7 +124,7 @@ /// Delays the validate model. /// </summary> /// <param name="element">The element.</param> - [DelayValidatePriority(100)] + [DelayValidatePriority(ValidationPriority.ValidateModel)] private static void DelayValidateModel(ModelElement element) { Dictionary<object, object> contextDictionary = element.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-20 21:45:25
|
Revision: 1089 http://orm.svn.sourceforge.net/orm/?rev=1089&view=rev Author: mcurland Date: 2007-08-20 14:45:28 -0700 (Mon, 20 Aug 2007) Log Message: ----------- Fixed problem with FindTarget in commit 1088, refs #328. Modified Paths: -------------- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs Modified: trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs =================================================================== --- trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 21:43:59 UTC (rev 1088) +++ trunk/RelationalModel/OialDcilBridge/OialDcilBridge.DeserializationFixupListeners.cs 2007-08-20 21:45:28 UTC (rev 1089) @@ -918,8 +918,8 @@ //int relatingCount = relating.Count; //ConceptType[] real = new ConceptType[] { relatingCount }; //relating.CopyTo(real, 0); - - foreach (Column targetColumn in possibles) + + foreach (Column targetColumn in ConceptTypeHasPrimaryIdentifierColumns(column, conceptType)) { targetFound = true; int offset = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-15 01:50:02
|
Revision: 1086 http://orm.svn.sourceforge.net/orm/?rev=1086&view=rev Author: mcurland Date: 2007-08-14 18:50:00 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Fixed issue with uniqueness constraints never being found if all of the roles they constrained had proxies. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-15 01:48:13 UTC (rev 1085) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-15 01:50:00 UTC (rev 1086) @@ -798,18 +798,13 @@ // For each role played by its object type... foreach (Role role in objectType.PlayedRoleCollection) { - if (ShouldIgnoreFactType(role.FactType)) + if (ShouldIgnoreFactType(role.BinarizedFactType)) { continue; } - Role oppositeRole = role.OppositeRoleAlwaysResolveProxy as Role; + Role oppositeRole = role.OppositeRoleAlwaysResolveProxy.Role; - if (oppositeRole == null) - { - continue; - } - // For each constraint on the opposite role... foreach (ConstraintRoleSequence constraintRoleSequence in oppositeRole.ConstraintRoleSequenceCollection) { @@ -1017,7 +1012,7 @@ foreach (Role role in ObjectTypePlaysRole.GetPlayedRoleCollection(objectType)) { - FactType factType = role.FactType; + FactType factType = role.BinarizedFactType; if (ShouldIgnoreFactType(factType)) { continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-15 01:48:11
|
Revision: 1085 http://orm.svn.sourceforge.net/orm/?rev=1085&view=rev Author: mcurland Date: 2007-08-14 18:48:13 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Fixed issue with FactTypeMappingPermuter incorrectly traversing many-to-one fact types. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-15 01:44:14 UTC (rev 1084) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-15 01:48:13 UTC (rev 1085) @@ -120,18 +120,27 @@ continue; } + // Indicates whether we should follow the fact type and include + // the object type at the other end of it in the current chain. + bool traverseFactType; FactTypeMapping mapping; FactTypeMappingList mappingList; + // Check for undecided one-to-one mappings... if (myUndecidedOneToOneFactTypeMappings.TryGetValue(factType, out mappingList)) { + traverseFactType = true; chain.UndecidedOneToOneFactTypeMappings.Add(mappingList); } + // ...or predecided one-to-one mappings... else if (myPredecidedOneToOneFactTypeMappings.TryGetValue(factType, out mapping)) { + traverseFactType = true; chain.PredecidedOneToOneFactTypeMappings.Add(mapping); } - else if (myPredecidedManyToOneFactTypeMappings.TryGetValue(factType, out mapping)) + // ...or predecided many-to-one mappings towards this object type. + else if (myPredecidedManyToOneFactTypeMappings.TryGetValue(factType, out mapping) && mapping.TowardsObjectType == objectType) { + traverseFactType = false; chain.PredecidedManyToOneFactTypeMappings.Add(mapping); } else @@ -142,12 +151,31 @@ // Record that this fact type has been visited. visitedFactTypes[factType] = null; + // We don't want to include the object type at the other end of this + // fact type in the chain, so continue on with the next played role. + if (!traverseFactType) + { + continue; + } + + // At most one of the two roles will be played by a different object type. LinkedElementCollection<RoleBase> roles = factType.RoleCollection; Debug.Assert(roles.Count == 2); ObjectType objectType1 = roles[0].Role.RolePlayer; - ObjectType objectType2 = roles[1].Role.RolePlayer; - ProcessObjectType(objectType1, chain, visitedFactTypes, visitedObjectTypes); - ProcessObjectType(objectType2, chain, visitedFactTypes, visitedObjectTypes); + if (objectType1 != objectType) + { + // We found the role played by a different object type, so there is no need to check the other role. + ProcessObjectType(objectType1, chain, visitedFactTypes, visitedObjectTypes); + } + else + { + // The first role was played by this object tpye, so we need to check the second role. + ObjectType objectType2 = roles[1].Role.RolePlayer; + if (objectType2 != objectType) + { + ProcessObjectType(objectType2, chain, visitedFactTypes, visitedObjectTypes); + } + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-15 01:44:13
|
Revision: 1084 http://orm.svn.sourceforge.net/orm/?rev=1084&view=rev Author: mcurland Date: 2007-08-14 18:44:14 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Initial batch file changes to enable building NORMA for Visual Studio 2008 (formerly Code Name "Orcas"). Minor tweaks to NUBuild to use VSCT v3.5 if running in MSBuild v3.5, and to account for item name changes in Microsoft.Common.targets. refs #337 refs #193 refs #320 refs #278 Modified Paths: -------------- trunk/FirstTimeBuildAll.bat trunk/SetupEnvironment.bat trunk/Tools/DisableRuleDirectiveProcessor/Install.bat trunk/Tools/NUBuild/Install.bat trunk/Tools/NUBuild/Neumont.Build.targets trunk/Tools/ORMCustomTool/Install.bat trunk/install.bat Modified: trunk/FirstTimeBuildAll.bat =================================================================== --- trunk/FirstTimeBuildAll.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/FirstTimeBuildAll.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -3,15 +3,21 @@ SET RootDir=%~dp0. CALL "%RootDir%\SetupEnvironment.bat" %* +:: Normally, the next two lines would have parentheses around the command portions. However, it is possible +:: for there to be parentheses in the %VSIPDir% path (and there are by default on x64), which +:: causes a syntax error. Therefore, we leave the parentheses off here. +IF "%TargetVisualStudioNumericVersion%"=="8.0" SET VsSDKVsctDir=%VSIPDir%\Prerelease\VSCT +IF NOT DEFINED VsSDKVsctDir SET VsSDKVsctDir=%VSIPDir%\VisualStudioIntegration\Tools\Bin + :: GAC the VSCT compiler so that we can use it. -SET VsSDKVsctDir=%VSIPDir%\Prerelease\VSCT gacutil.exe /nologo /f /i "%VsSDKVsctDir%\VSCTCompress.dll" gacutil.exe /nologo /f /i "%VsSDKVsctDir%\VSCTLibrary.dll" gacutil.exe /nologo /f /i "%VsSDKVsctDir%\VSCT.exe" +:: As of the August 2007 release of the VsSDK, the VSCTCompress assembly is still versioned as 8.0.0.0. ngen.exe install "VSCTCompress, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /NoDependencies /nologo -ngen.exe install "VSCTLibrary, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /NoDependencies /nologo -ngen.exe install "VSCT, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /NoDependencies /nologo +ngen.exe install "VSCTLibrary, Version=%TargetVisualStudioNumericVersion%.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /NoDependencies /nologo +ngen.exe install "VSCT, Version=%TargetFrameworkNumericVersion%.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /NoDependencies /nologo MSBuild.exe /nologo "%RootDir%\Tools\NUBuild\NUBuild.sln" %* MSBuild.exe /nologo "%RootDir%\Tools\DisableRuleDirectiveProcessor\DisableRuleDirectiveProcessor.sln" %* Modified: trunk/SetupEnvironment.bat =================================================================== --- trunk/SetupEnvironment.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/SetupEnvironment.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -2,8 +2,15 @@ IF "%~1"=="" (SET BuildOutDir=bin\Debug) ELSE (SET BuildOutDir=%~1.) -IF NOT DEFINED FrameworkSDKDir (CALL:_SetupVsVars) +:: TargetVisualStudioNumericVersion settings: +:: 8.0 = Visual Studio 2005 (Code Name "Whidbey") +:: 9.0 = Visual Studio 2008 (Code Name "Orcas") +SET TargetVisualStudioNumericVersion=8.0 +IF "%TargetVisualStudioNumericVersion%"=="9.0" (SET TargetFrameworkNumericVersion=3.5) ELSE (SET TargetFrameworkNumericVersion=2.0) + +IF NOT DEFINED FrameworkDir (CALL:_SetupVsVars) + :: Normally, the next line would have parentheses around the command portion. However, it is possible :: for there to be parentheses in the %ProgramFiles% path (and there are by default on x64), which :: causes a syntax error. Therefore, we leave the parentheses off here. @@ -19,23 +26,22 @@ SET DILTransformsDir=%DILDir%\Transforms SET VSRegistryRootBase=SOFTWARE\Microsoft\VisualStudio -:: VSRegistryRootVersion settings: -:: 8.0 = Visual Studio 2005 (Code Name "Whidbey") -:: 9.0 = Visual Studio Code Name "Orcas" -SET VSRegistryRootVersion=8.0 +SET VSRegistryRootVersion=%TargetVisualStudioNumericVersion% +:: Remove the value "Exp" on the next line if you want installations to be performed against the +:: regular (non-Experimental) Visual Studio registry hive SET VSRegistryRootSuffix=Exp SET VSRegistryRoot=%VSRegistryRootBase%\%VSRegistryRootVersion%%VSRegistryRootSuffix% FOR /F "usebackq skip=2 tokens=2*" %%A IN (`REG QUERY "HKLM\%VSRegistryRoot%\Setup\VS" /v "EnvironmentPath"`) DO SET VSEnvironmentPath=%%~fB FOR /F "usebackq skip=2 tokens=2*" %%A IN (`REG QUERY "HKLM\%VSRegistryRoot%\Setup\VS" /v "ProductDir"`) DO SET VSDir=%%~fB FOR /F "usebackq skip=2 tokens=2*" %%A IN (`REG QUERY "HKLM\%VSRegistryRoot%\VSTemplate\Item" /v "UserFolder"`) DO SET VSItemTemplatesDir=%%~fB -FOR /F "usebackq skip=2 tokens=2*" %%A IN (`REG QUERY "HKLM\%VSRegistryRootBase%\VSIP\8.0" /v "InstallDir"`) DO SET VSIPDir=%%~fB -SET RegPkg="%VSIPDir%\VisualStudioIntegration\Tools\Bin\regpkg.exe" /root:"%VSRegistryRoot%" +FOR /F "usebackq skip=2 tokens=2*" %%A IN (`REG QUERY "HKLM\%VSRegistryRootBase%\VSIP\%VSRegistryRootVersion%" /v "InstallDir"`) DO SET VSIPDir=%%~fB +IF "%TargetVisualStudioNumericVersion%"=="9.0" (SET RegPkg="%VSIPDir%\VisualStudioIntegration\Tools\Bin\VS2005\regpkg.exe" /root:"%VSRegistryRoot%") ELSE (SET RegPkg="%VSIPDir%\VisualStudioIntegration\Tools\Bin\regpkg.exe" /root:"%VSRegistryRoot%") GOTO:EOF :_SetupVsVars -:: Set up the build environment to use Orcas if available, falling back to 2005 otherwise. -IF DEFINED VS90COMNTOOLS (CALL "%VS90COMNTOOLS%\vsvars32.bat") ELSE (CALL "%VS80COMNTOOLS%\vsvars32.bat") +:: Set up the build environment. +CALL "%%VS%TargetVisualStudioNumericVersion:.=%COMNTOOLS%%\vsvars32.bat" GOTO:EOF Modified: trunk/Tools/DisableRuleDirectiveProcessor/Install.bat =================================================================== --- trunk/Tools/DisableRuleDirectiveProcessor/Install.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/Tools/DisableRuleDirectiveProcessor/Install.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -5,8 +5,8 @@ SET BinDir=%RootDir%\bin -CALL:_AddTextTemplateReg "8.0" "DisableRuleDirectiveProcessor" -IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_AddTextTemplateReg "8.0%VSRegistryRootSuffix%" "DisableRuleDirectiveProcessor") +CALL:_AddTextTemplateReg "%VSRegistryRootVersion%" "DisableRuleDirectiveProcessor" +IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_AddTextTemplateReg "%VSRegistryRootVersion%%VSRegistryRootSuffix%" "DisableRuleDirectiveProcessor") GOTO:EOF @@ -15,4 +15,3 @@ REG ADD "HKLM\%VSRegistryRootBase%\%~1\TextTemplating\DirectiveProcessors\%~2" /f /v "Class" /d "Neumont.Tools.Modeling.%~2" REG ADD "HKLM\%VSRegistryRootBase%\%~1\TextTemplating\DirectiveProcessors\%~2" /f /v "CodeBase" /d "%BinDir%\Neumont.Tools.Modeling.DisableRuleDirectiveProcessor.dll" GOTO:EOF - Modified: trunk/Tools/NUBuild/Install.bat =================================================================== --- trunk/Tools/NUBuild/Install.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/Tools/NUBuild/Install.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -11,8 +11,8 @@ XCOPY /Y /D /V /Q "%RootDir%\Tasks\RegexCompilationInfo.xsd" "%VSDir%\Xml\Schemas\" XCOPY /Y /D /V /Q "%RootDir%\Neumont.Build.targets" "%MSBuildExtensionsPath%\Neumont\" -REG ADD "HKLM\%VSRegistryRootBase%\8.0\MSBuild\SafeImports" /v "NUBuild1" /d "%MSBuildExtensionsPath%\Neumont\Neumont.Build.targets" /f -IF NOT "%VSRegistryRootSuffix%"=="" (REG ADD "HKLM\%VSRegistryRootBase%\8.0%VSRegistryRootSuffix%\MSBuild\SafeImports" /v "NUBuild1" /d "%MSBuildExtensionsPath%\Neumont\Neumont.Build.targets" /f) +REG ADD "HKLM\%VSRegistryRootBase%\%VSRegistryRootVersion%\MSBuild\SafeImports" /v "NUBuild1" /d "%MSBuildExtensionsPath%\Neumont\Neumont.Build.targets" /f +IF NOT "%VSRegistryRootSuffix%"=="" (REG ADD "HKLM\%VSRegistryRootBase%\%VSRegistryRootVersion%%VSRegistryRootSuffix%\MSBuild\SafeImports" /v "NUBuild1" /d "%MSBuildExtensionsPath%\Neumont\Neumont.Build.targets" /f) gacutil.exe /nologo /f /i "%RootDir%\bin\Neumont.Build.dll" ngen.exe install "Neumont.Build, Version=1.0.0.0, Culture=neutral, PublicKeyToken=957d5b7d5e79e25f" /NoDependencies /nologo /verbose Modified: trunk/Tools/NUBuild/Neumont.Build.targets =================================================================== --- trunk/Tools/NUBuild/Neumont.Build.targets 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/Tools/NUBuild/Neumont.Build.targets 2007-08-15 01:44:14 UTC (rev 1084) @@ -188,9 +188,10 @@ DependsOnTargets="$(_ResolveResourceMergeTargetsDependsOn)" Condition="'@(MergeResource)'!=''"> + <!-- In MSBuild v3.5, _CoreCompileResourceInputs and _SatelliteAssemblyResourceInputs replace ManifestResourceWithNoCulture and ManifestResourceWithCulture, respectively.--> <ResourceMergeTargetResolver MergeResources="@(MergeResource)" - ManifestResources="@(ManifestResourceWithCulture);@(ManifestResourceWithNoCulture)"> + ManifestResources="@(ManifestResourceWithCulture);@(ManifestResourceWithNoCulture);@(_CoreCompileResourceInputs);@(_SatelliteAssemblyResourceInputs)"> <Output TaskParameter="MergeResourcesWithResolvedTargets" ItemName="_MergeResourceWithResolvedTarget"/> </ResourceMergeTargetResolver> @@ -252,9 +253,14 @@ </Target> + <PropertyGroup> + <!-- HACK: BuildInParallel is a new property in MSBuild 3.5. If it is present, we can (for now) assume that we want to use the 3.5 version of VSCT. --> + <VsctAssemblyVersion Condition="'$(VsctAssemblyVersion)'=='' and '$(BuildInParallel)'!=''">3.5.0.0</VsctAssemblyVersion> + <VsctAssemblyVersion Condition="'$(VsctAssemblyVersion)'==''">2.0.0.0</VsctAssemblyVersion> + </PropertyGroup> <!-- Compiles .vsct files into .cto files. --> - <UsingTask TaskName="VSCTCompiler" AssemblyName="VSCT, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> + <UsingTask TaskName="VSCTCompiler" AssemblyName="VSCT, Version=$(VsctAssemblyVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> <ItemGroup> <!-- Add the CompileVsct Item name to the AvailableItemName item, so that it shows up in the Build Action drop-down menu in the properties windows in Visual Studio (and the equivalent in other IDEs). --> <AvailableItemName Include="CompileVsct"/> Modified: trunk/Tools/ORMCustomTool/Install.bat =================================================================== --- trunk/Tools/ORMCustomTool/Install.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/Tools/ORMCustomTool/Install.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -16,10 +16,10 @@ XCOPY /Y /D /V /Q "%~dp0\bin\Neumont.Tools.ORM.ORMCustomTool.pdb" "%NORMADir%\bin\" :: For some reason, the next copy is randomly giving errors about half the time. They can be safely ignored, so they've been redirected to NUL. XCOPY /Y /D /V /Q "%~dp0\bin\Neumont.Tools.ORM.ORMCustomTool.xml" "%NORMADir%\bin\" 2>NUL -CALL:_InstallCustomToolReg "8.0" -CALL:_InstallExtenderReg "8.0" -IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_InstallCustomToolReg "8.0%VSRegistryRootSuffix%") -IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_InstallExtenderReg "8.0%VSRegistryRootSuffix%") +CALL:_InstallCustomToolReg "%VSRegistryRootVersion%" +CALL:_InstallExtenderReg "%VSRegistryRootVersion%" +IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_InstallCustomToolReg "%VSRegistryRootVersion%%VSRegistryRootSuffix%") +IF NOT "%VSRegistryRootSuffix%"=="" (CALL:_InstallExtenderReg "%VSRegistryRootVersion%%VSRegistryRootSuffix%") :: Get rid of old transform registrations REG DELETE "HKLM\SOFTWARE\Neumont\ORM Architect for Visual Studio\Generators" /f 1>NUL 2>&1 Modified: trunk/install.bat =================================================================== --- trunk/install.bat 2007-08-15 01:37:14 UTC (rev 1083) +++ trunk/install.bat 2007-08-15 01:44:14 UTC (rev 1084) @@ -106,7 +106,7 @@ REG ADD "HKCR\ormfile\shell\open" /ve /d "&Open" /f 1>NUL REG ADD "HKCR\ormfile\shell\open\command" /ve /d "\"%VSEnvironmentPath%\" /RootSuffix \"%VSRegistryRootSuffix%\" /dde \"%%1\"" /f 1>NUL REG ADD "HKCR\ormfile\shell\open\ddeexec" /ve /d "Open(\"%%1\")" /f 1>NUL -REG ADD "HKCR\ormfile\shell\open\ddeexec\application" /ve /d "VisualStudio.8.0" /f 1>NUL +REG ADD "HKCR\ormfile\shell\open\ddeexec\application" /ve /d "VisualStudio.%TargetVisualStudioNumericVersion%" /f 1>NUL REG ADD "HKCR\ormfile\shell\open\ddeexec\topic" /ve /d "system" /f 1>NUL This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-15 01:37:12
|
Revision: 1083 http://orm.svn.sourceforge.net/orm/?rev=1083&view=rev Author: mcurland Date: 2007-08-14 18:37:14 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Various further tweaks to ORM/OIAL Bridge. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-15 01:06:22 UTC (rev 1082) +++ trunk/Oial/ORMOialBridge/ORMOialBridgePermuter.cs 2007-08-15 01:37:14 UTC (rev 1083) @@ -10,35 +10,37 @@ namespace Neumont.Tools.ORMToORMAbstractionBridge { #region Chain calculator - sealed class UndecidedMappingChains + sealed class FactTypeChainer { - private readonly FactTypeMappingListDictionary myUndecided; + private readonly FactTypeMappingDictionary myPredecidedManyToOneFactTypeMappings; private readonly FactTypeMappingDictionary myPredecidedOneToOneFactTypeMappings; + private readonly FactTypeMappingListDictionary myUndecidedOneToOneFactTypeMappings; private readonly ChainList myChains; - public UndecidedMappingChains(FactTypeMappingListDictionary undecided, FactTypeMappingDictionary predecidedOneToOneFactTypeMappings) + public FactTypeChainer(FactTypeMappingDictionary predecidedManyToOneFactTypeMappings, FactTypeMappingDictionary predecidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { myChains = new ChainList(); - myUndecided = undecided; + + myPredecidedManyToOneFactTypeMappings = predecidedManyToOneFactTypeMappings; myPredecidedOneToOneFactTypeMappings = predecidedOneToOneFactTypeMappings; + myUndecidedOneToOneFactTypeMappings = undecidedOneToOneFactTypeMappings; } public int Run() { BuildChains(); - //DeleteEmptyChains(); // Delete empty chains and find the largest chain. int largestChainCount = 0; for (int i = myChains.Count - 1; i >= 0; i--) { Chain chain = myChains[i]; - if (chain.UndecidedFactTypeMappings.Count <= 0) + if (chain.UndecidedOneToOneFactTypeMappings.Count <= 0) { myChains.RemoveAt(i); continue; } - int chainCount = chain.FactTypeCount; + int chainCount = chain.OneToOneFactTypeCount; if (chainCount > largestChainCount) { largestChainCount = chainCount; @@ -55,13 +57,13 @@ private void BuildChains() { - int factTypesCount = myUndecided.Count + myPredecidedOneToOneFactTypeMappings.Count; + int factTypesCount = myUndecidedOneToOneFactTypeMappings.Count + myPredecidedOneToOneFactTypeMappings.Count; Dictionary<FactType, object> visitedFactTypes = new Dictionary<FactType, object>(factTypesCount); Dictionary<ObjectType, object> visitedObjectTypes = new Dictionary<ObjectType, object>(factTypesCount * 2); FactTypeMappingDictionary.Enumerator predecidedEnumerator = myPredecidedOneToOneFactTypeMappings.GetEnumerator(); - FactTypeMappingListDictionary.Enumerator undecidedEnumerator = myUndecided.GetEnumerator(); + FactTypeMappingListDictionary.Enumerator undecidedEnumerator = myUndecidedOneToOneFactTypeMappings.GetEnumerator(); while (true) { KeyValuePair<FactType, FactTypeMapping> predecidedPair; @@ -92,7 +94,7 @@ } } - // We're following a new path, so clear the current dictionary. + // We've found a new path, so create a chain for it. Chain chain = new Chain(); myChains.Add(chain); @@ -120,14 +122,18 @@ FactTypeMapping mapping; FactTypeMappingList mappingList; - if (myUndecided.TryGetValue(factType, out mappingList)) + if (myUndecidedOneToOneFactTypeMappings.TryGetValue(factType, out mappingList)) { - chain.UndecidedFactTypeMappings.Add(mappingList); + chain.UndecidedOneToOneFactTypeMappings.Add(mappingList); } else if (myPredecidedOneToOneFactTypeMappings.TryGetValue(factType, out mapping)) { chain.PredecidedOneToOneFactTypeMappings.Add(mapping); } + else if (myPredecidedManyToOneFactTypeMappings.TryGetValue(factType, out mapping)) + { + chain.PredecidedManyToOneFactTypeMappings.Add(mapping); + } else { continue; @@ -146,12 +152,15 @@ } } #endregion + #region FactTypeMappingPermuter sealed class FactTypeMappingPermuter { + private readonly FactTypeMappingDictionary myPredecidedManyToOneFactTypeMappings; + private readonly FactTypeMappingDictionary myPredecidedOneToOneFactTypeMappings; + private readonly FactTypeMappingListDictionary myUndecidedOneToOneFactTypeMappings; + private readonly FactTypeMappingDictionary myDecidedFactTypeMappings; - private readonly FactTypeMappingDictionary myDecidedOneToOneFactTypeMappings; - private readonly FactTypeMappingListDictionary myUndecidedFactTypeMappings; // Stores a list of object types that had been considered valid top-level, but was later found to be deeply mapped away private readonly ObjectTypeDictionary myInvalidObjectTypes; @@ -161,61 +170,45 @@ private readonly ObjectTypeDictionary myPossibleConceptTypes; - public FactTypeMappingPermuter(FactTypeMappingDictionary decidedFactTypeMappings, FactTypeMappingListDictionary undecidedFactTypeMappings) + public FactTypeMappingPermuter(FactTypeMappingDictionary predecidedManyToOneFactTypeMappings, FactTypeMappingDictionary predecidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - myDecidedFactTypeMappings = decidedFactTypeMappings; - myUndecidedFactTypeMappings = undecidedFactTypeMappings; + myPredecidedManyToOneFactTypeMappings = predecidedManyToOneFactTypeMappings; + myPredecidedOneToOneFactTypeMappings = predecidedOneToOneFactTypeMappings; + myUndecidedOneToOneFactTypeMappings = undecidedOneToOneFactTypeMappings; - myDecidedOneToOneFactTypeMappings = new FactTypeMappingDictionary(myDecidedFactTypeMappings.Count); + int oneToOneFactTypeCount = predecidedOneToOneFactTypeMappings.Count + undecidedOneToOneFactTypeMappings.Count; + myDecidedFactTypeMappings = new FactTypeMappingDictionary(predecidedManyToOneFactTypeMappings.Count + oneToOneFactTypeCount); + foreach (KeyValuePair<FactType, FactTypeMapping> pair in predecidedManyToOneFactTypeMappings) + { + myDecidedFactTypeMappings.Add(pair.Key, pair.Value); + } + foreach (KeyValuePair<FactType, FactTypeMapping> pair in predecidedOneToOneFactTypeMappings) + { + myDecidedFactTypeMappings.Add(pair.Key, pair.Value); + } + // Stores a list of object types that had been considered valid top-level, but was later found to be deeply mapped away - myInvalidObjectTypes = new ObjectTypeDictionary(myDecidedFactTypeMappings.Count); - myPossibleTopLevelConceptTypes = new ObjectTypeDictionary(myDecidedFactTypeMappings.Count); - myPossibleConceptTypes = new ObjectTypeDictionary(myDecidedFactTypeMappings.Count); + myInvalidObjectTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); + myPossibleTopLevelConceptTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); + myPossibleConceptTypes = new ObjectTypeDictionary(oneToOneFactTypeCount); } /// <summary> /// Runs the permuter, and adds the final decided mapping to the decidedFactTypeMappings dictionary specified when this instance was constructed. /// </summary> - public void Run() + public FactTypeMappingDictionary Run() { - FindDecidedOneToOneMappings(); - PermuteFactTypeMappings(); + return myDecidedFactTypeMappings; } - private void FindDecidedOneToOneMappings() - { - FactTypeMapping mapping; - Role firstRole; - Role secondRole; - UniquenessConstraint firstRoleUniquenessConstraint; - UniquenessConstraint secondRoleUniquenessConstraint; - bool firstRoleIsUnique; - bool secondRoleIsUnique; - foreach (KeyValuePair<FactType, FactTypeMapping> pair in myDecidedFactTypeMappings) - { - mapping = pair.Value; - firstRole = mapping.FromRole; - secondRole = mapping.TowardsRole; - firstRoleUniquenessConstraint = (UniquenessConstraint)firstRole.SingleRoleAlethicUniquenessConstraint; - secondRoleUniquenessConstraint = (UniquenessConstraint)secondRole.SingleRoleAlethicUniquenessConstraint; - firstRoleIsUnique = (firstRoleUniquenessConstraint != null); - secondRoleIsUnique = (secondRoleUniquenessConstraint != null); - - if (firstRoleIsUnique && secondRoleIsUnique) - { - myDecidedOneToOneFactTypeMappings.Add(pair.Key, pair.Value); - } - } - } - private void PermuteFactTypeMappings() { int largestChainCount; - // Break up the chains of contiguous undecided fact types - UndecidedMappingChains chains = new UndecidedMappingChains(myUndecidedFactTypeMappings, myDecidedOneToOneFactTypeMappings); - largestChainCount = chains.Run(); + // Break up the chains of contiguous one-to-one fact types + FactTypeChainer chainer = new FactTypeChainer(myPredecidedManyToOneFactTypeMappings, myPredecidedOneToOneFactTypeMappings, myUndecidedOneToOneFactTypeMappings); + largestChainCount = chainer.Run(); // Perform one-time pass of top-level types for the decided mappings PrecalculateDecidedConceptTypes(); @@ -227,7 +220,7 @@ Dictionary<ObjectType, object> deeplyMappedObjectTypes = new Dictionary<ObjectType, object>(largestChainCount); // Loop through each chain, calculating the permutations. - foreach (Chain chain in chains.Chains) + foreach (Chain chain in chainer.Chains) { // Find the object types that we already know have deep mappings away from them. foreach (FactTypeMapping decidedMapping in chain.PredecidedOneToOneFactTypeMappings) @@ -240,9 +233,9 @@ // UNDONE: Eventually we should actually check this and warn the user if it would take too long on their machine. // This would need to be calculated, though. A hard-coded limit wouldn't be appropriate here. - //int maxPermutations = CalculateMaxNumberOfPermutations(chain.UndecidedFactTypeMappings); + //int maxPermutations = CalculateMaxNumberOfPermutations(chain.UndecidedOneToOneFactTypeMappings); - PermuteFactTypeMappings(chain.PossiblePermutations, chain.UndecidedFactTypeMappings, newlyDecidedFactTypeMappings, deeplyMappedObjectTypes, 0); + PermuteFactTypeMappings(chain.PossiblePermutations, chain.UndecidedOneToOneFactTypeMappings, newlyDecidedFactTypeMappings, deeplyMappedObjectTypes, 0); EliminateInvalidPermutations(chain); CalculateTopLevelConceptTypes(chain); @@ -259,6 +252,7 @@ private static FactTypeMapping FindDeepMappingAwayFromObjectType(ObjectType objectType, FactTypeMappingList predecidedOneToOneFactTypeMappings, FactTypeMappingList permutationFactTypeMappings) { + // UNDONE: Figure out a way we can do this off of PlayedRoles instead, which should be faster. foreach (FactTypeMapping mapping in predecidedOneToOneFactTypeMappings) { if (mapping.MappingDepth == MappingDepth.Deep && mapping.FromObjectType == objectType) @@ -300,7 +294,7 @@ /// 2. It is a subtype, or /// 3. Another object type (B) is mapped to it, and /// a. There exists a role being mapped to object type A on which there are no constraints, or - /// b. There exists a role being mapped to object type A on which there is a uniqueness that is not preferred. + /// b. There exists a role being mapped to object type A on which there is not a preferred uniqueness. /// /// A concept type is a top-level concept type when: /// 1. It is not deeply mapped towards any other concept type. @@ -374,9 +368,6 @@ /// <param name="chain"></param> private void CalculateTopLevelConceptTypes(Chain chain) { -#if PERMUTATION_DEBUG_OUTPUT - DateTime start = DateTime.Now; -#endif // The smallest overall mapping that we've found int smallest = int.MaxValue; // These dictionaries track the OTs that are temporarily removed or added for each permutation in the list @@ -437,32 +428,6 @@ myPossibleConceptTypes.Remove(ot); } } -#if PERMUTATION_DEBUG_OUTPUT - DateTime endat = DateTime.Now; - // Output values to a file - StreamWriter s = new StreamWriter("output_combinations.txt"); - s.WriteLine("Smallest mapping: " + smallest.ToString()); - s.WriteLine("# calculated as smallest (efficiency): " + mySmallestPermutationsList.Count); - s.WriteLine("Time: " + endat.Subtract(start).ToString()); - /* - int p = 0; - foreach (FinalMappingState state in smallestList) - { - p++; - sw.WriteLine("\t" + p.ToString() + " (" + state.TopLevelConceptTypes.ToString() + " TLCTs)"); - foreach (KeyValuePair<FactType, FactTypeMapping> pair in myDecidedFactTypeMappings) - { - FactTypeMapping mapping = pair.Value; - s.WriteLine("\t\t" + mapping.FromObjectType.ToString() + " to " + mapping.TowardsObjectType.ToString() + " (" + mapping.MappingType.ToString() + ")"); - } - foreach (DecidedMappingStateEntry mapping in state.Mappings) - { - s.WriteLine("\t\t" + mapping.Mapping.FromObjectType.ToString() + " to " + mapping.Mapping.TowardsObjectType.ToString() + " (" + mapping.Mapping.MappingType.ToString() + ")"); - } - } - */ - s.Close(); -#endif } /// <summary> @@ -537,9 +502,9 @@ /// </param> private static void EliminateInvalidPermutations(Chain chain) { - Debug.Assert(chain.UndecidedFactTypeMappings.Count > 0); + Debug.Assert(chain.UndecidedOneToOneFactTypeMappings.Count > 0); - int factTypeCount = chain.FactTypeCount; + int factTypeCount = chain.OneToOneFactTypeCount; FactTypeMappingList predecidedOneToOneFactTypeMappings = chain.PredecidedOneToOneFactTypeMappings; PermutationList possiblePermutations = chain.PossiblePermutations; @@ -624,4 +589,4 @@ } } #endregion -} \ No newline at end of file +} Modified: trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs =================================================================== --- trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-15 01:06:22 UTC (rev 1082) +++ trunk/Oial/ORMOialBridge/ORMOialBridgeStructures.cs 2007-08-15 01:37:14 UTC (rev 1083) @@ -287,31 +287,44 @@ [Serializable] sealed class Chain { + private readonly FactTypeMappingList myPredecidedManyToOneFactTypeMappings; private readonly FactTypeMappingList myPredecidedOneToOneFactTypeMappings; - private readonly FactTypeMappingListList myUndecidedFactTypeMappings; + private readonly FactTypeMappingListList myUndecidedOneToOneFactTypeMappings; private readonly PermutationList myPossiblePermutations; private readonly PermutationList mySmallestPermutations; public Chain() { + myPredecidedManyToOneFactTypeMappings = new FactTypeMappingList(); myPredecidedOneToOneFactTypeMappings = new FactTypeMappingList(); - myUndecidedFactTypeMappings = new FactTypeMappingListList(); + myUndecidedOneToOneFactTypeMappings = new FactTypeMappingListList(); myPossiblePermutations = new PermutationList(); mySmallestPermutations = new PermutationList(); } /// <summary> - /// Returns the number of FactTypes in this Chain. + /// Returns the number of one-to-one FactTypes in this Chain. /// </summary> - public int FactTypeCount + public int OneToOneFactTypeCount { get { - return myPredecidedOneToOneFactTypeMappings.Count + myUndecidedFactTypeMappings.Count; + return myPredecidedOneToOneFactTypeMappings.Count + myUndecidedOneToOneFactTypeMappings.Count; } } /// <summary> + /// Many-to-one FactTypeMappings that are part of this chain but were decided before the permutation phase. + /// </summary> + public FactTypeMappingList PredecidedManyToOneFactTypeMappings + { + get + { + return myPredecidedManyToOneFactTypeMappings; + } + } + + /// <summary> /// One-to-one FactTypeMappings that are part of this chain but were decided before the permutation phase. /// </summary> public FactTypeMappingList PredecidedOneToOneFactTypeMappings @@ -323,11 +336,11 @@ } /// <summary> - /// The potential mappings of the undecided FactTypes that are in this Chain. + /// The potential mappings of the undecided one-to-one FactTypes that are in this Chain. /// </summary> - public FactTypeMappingListList UndecidedFactTypeMappings + public FactTypeMappingListList UndecidedOneToOneFactTypeMappings { - get { return myUndecidedFactTypeMappings; } + get { return myUndecidedOneToOneFactTypeMappings; } } /// <summary> Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-15 01:06:22 UTC (rev 1082) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-08-15 01:37:14 UTC (rev 1083) @@ -183,16 +183,18 @@ private void TransformORMtoOial() { ORMModel model = this.ORMModel; - FactTypeMappingDictionary decidedFactTypeMappings = null; - FactTypeMappingListDictionary undecidedFactTypeMappings = null; LinkedElementCollection<FactType> modelFactTypes = model.FactTypeCollection; - InitialFactTypeMappings(modelFactTypes, out decidedFactTypeMappings, out undecidedFactTypeMappings); - FilterFactTypeMappings(decidedFactTypeMappings, undecidedFactTypeMappings); + FactTypeMappingDictionary decidedManyToOneFactTypeMappings = new FactTypeMappingDictionary(); + FactTypeMappingDictionary decidedOneToOneFactTypeMappings = new FactTypeMappingDictionary(); + FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings = new FactTypeMappingListDictionary(); - FactTypeMappingPermuter permuter = new FactTypeMappingPermuter(decidedFactTypeMappings, undecidedFactTypeMappings); - permuter.Run(); + PerformInitialFactTypeMappings(modelFactTypes, decidedManyToOneFactTypeMappings, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); + FilterFactTypeMappings(decidedManyToOneFactTypeMappings, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); + FactTypeMappingPermuter permuter = new FactTypeMappingPermuter(decidedManyToOneFactTypeMappings, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); + FactTypeMappingDictionary decidedFactTypeMappings = permuter.Run(); + GenerateOialModel(decidedFactTypeMappings); } @@ -200,13 +202,11 @@ /// Determines the obvious fact type mappings, and all other potential mappings. /// </summary> /// <param name="modelFactTypes">The <see cref="FactType"/> objects of the model</param> - /// <param name="decidedFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> - /// <param name="undecidedFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> - private void InitialFactTypeMappings(IList<FactType> modelFactTypes, out FactTypeMappingDictionary decidedFactTypeMappings, out FactTypeMappingListDictionary undecidedFactTypeMappings) + /// <param name="decidedManyToOneFactTypeMappings">The decided many-to-one <see cref="FactTypeMapping"/> objects.</param> + /// <param name="decidedOneToOneFactTypeMappings">The decided one-to-one <see cref="FactTypeMapping"/> objects.</param> + /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> + private void PerformInitialFactTypeMappings(LinkedElementCollection<FactType> modelFactTypes, FactTypeMappingDictionary decidedManyToOneFactTypeMappings, FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - decidedFactTypeMappings = new FactTypeMappingDictionary(); - undecidedFactTypeMappings = new FactTypeMappingListDictionary(); - // For each fact type in the model... foreach (FactType factType in modelFactTypes) { @@ -225,7 +225,7 @@ // Map deeply toward the supertype. FactTypeMapping factTypeMapping = new FactTypeMapping(subtypeFact, subtypeRole, supertypeRole, MappingDepth.Deep); - decidedFactTypeMappings.Add(subtypeFact, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(subtypeFact, factTypeMapping); } else { @@ -242,28 +242,31 @@ bool firstRoleIsUnique = (firstRoleUniquenessConstraint != null); bool secondRoleIsUnique = (secondRoleUniquenessConstraint != null); + // We don't need to worry about shallow mappings towards preferred identifiers on many-to-ones, since the preferred + // identifier pattern ensures that these cases will always map towards the object type being identified anyway. + // If only firstRole is unique... if (firstRoleIsUnique && !secondRoleIsUnique) { // Shallow map toward firstRolePlayer. FactTypeMapping factTypeMapping = new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedManyToOneFactTypeMappings.Add(factType, factTypeMapping); } else if (!firstRoleIsUnique && secondRoleIsUnique) // ...only secondRole is unique... { // Shallow map toward secondRolePlayer. FactTypeMapping factTypeMapping = new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedManyToOneFactTypeMappings.Add(factType, factTypeMapping); } else if (firstRoleIsUnique && secondRoleIsUnique) // ...both roles are unique... { - bool firstRoleIsMandatory = null != firstRole.SingleRoleAlethicMandatoryConstraint; - bool secondRoleIsMandatory = null != secondRole.SingleRoleAlethicMandatoryConstraint; + bool firstRoleIsMandatory = (firstRole.SingleRoleAlethicMandatoryConstraint != null); + bool secondRoleIsMandatory = (secondRole.SingleRoleAlethicMandatoryConstraint != null); // If this is a ring fact type... - if (firstRolePlayer.Id == secondRolePlayer.Id) + if (firstRolePlayer == secondRolePlayer) { // If only firstRole is mandatory... if (firstRoleIsMandatory && !secondRoleIsMandatory) @@ -271,60 +274,88 @@ // Shallow map toward firstRolePlayer (mandatory role player). FactTypeMapping factTypeMapping = new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); } else if (!firstRoleIsMandatory && secondRoleIsMandatory) // ...only secondRole is mandatory... { // Shallow map toward secondRolePlayer (mandatory role player). FactTypeMapping factTypeMapping = new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); } else // ...otherwise... { // Shallow map toward firstRolePlayer. FactTypeMapping factTypeMapping = new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); } } else // ...not a ring fact type... { + // These are used to make sure that we never shallowly map towards a preferred identifier. + bool firstRoleIsUniqueAndPreferred = firstRoleIsUnique && firstRoleUniquenessConstraint.IsPreferred; + bool secondRoleIsUniqueAndPreferred = secondRoleIsUnique && secondRoleUniquenessConstraint.IsPreferred; + FactTypeMappingList potentialFactTypeMappings = new FactTypeMappingList(); // If neither role is mandatory... - if (!(firstRoleIsMandatory || secondRoleIsMandatory)) + if (!firstRoleIsMandatory && !secondRoleIsMandatory) { - // Shallow map toward firstRolePlayer. - potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow)); - // Shallow map toward secondRolePlayer. - potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow)); + // If firstRole is not preferred... + if (!firstRoleIsUniqueAndPreferred) + { + // Shallow map toward firstRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow)); + } + + // If seccondRole is not preferred... + if (!secondRoleIsUniqueAndPreferred) + { + // Shallow map toward secondRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow)); + } } - // If exactly one role is mandatory, we only allow shallow towards that role or deep away from it. - // This is an optimization, but at this point I don't remember with 100% confidence that it is correct. - // -Kevin else if (firstRoleIsMandatory && !secondRoleIsMandatory) // ...only firstRole is mandatory... { - // Shallow map toward firstRolePlayer. - potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow)); + // If firstRole is not preferred... + if (!firstRoleIsUniqueAndPreferred) + { + // Shallow map toward firstRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow)); + } + + // If seccondRole is not preferred... + if (!secondRoleIsUniqueAndPreferred) + { + // Shallow map toward secondRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow)); + } + // Deep map toward secondRolePlayer. potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Deep)); } else if (!firstRoleIsMandatory && secondRoleIsMandatory) // ...only secondRole is mandatory... { + // If firstRole is not preferred... + if (!firstRoleIsUniqueAndPreferred) + { + // Shallow map toward firstRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Shallow)); + } + // Deep map toward firstRolePlayer. potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Deep)); - // Shallow map toward secondRolePlayer. - potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow)); + + // If seccondRole is not preferred... + if (!secondRoleIsUniqueAndPreferred) + { + // Shallow map toward secondRolePlayer. + potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Shallow)); + } } else // ...both roles are mandatory... { - bool firstRoleIsUniqueAndPreferred = firstRoleIsUnique && firstRoleUniquenessConstraint.IsPreferred; - bool secondRoleIsUniqueAndPreferred = secondRoleIsUnique && secondRoleUniquenessConstraint.IsPreferred; - - // We do this to make sure that we never shallowly map towards a preferred identifier. - // UNDONE: Should we be doing this for the less-than-two mandatories cases as well? -Kevin - // If firstRole is not preferred... if (!firstRoleIsUniqueAndPreferred) { @@ -341,11 +372,20 @@ // Deep map toward firstRolePlayer. potentialFactTypeMappings.Add(new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Deep)); + // Deep map toward secondRolePlayer. potentialFactTypeMappings.Add(new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Deep)); } - undecidedFactTypeMappings.Add(factType, potentialFactTypeMappings); + Debug.Assert(potentialFactTypeMappings.Count > 0); + if (potentialFactTypeMappings.Count == 1) + { + decidedOneToOneFactTypeMappings.Add(factType, potentialFactTypeMappings[0]); + } + else + { + undecidedOneToOneFactTypeMappings.Add(factType, potentialFactTypeMappings); + } } } } @@ -355,16 +395,17 @@ /// <summary> /// Runs various algorithms on the undecided fact type mappings in an attempt to decide as many as possible. /// </summary> - /// <param name="decidedFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> - /// <param name="undecidedFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> - private void FilterFactTypeMappings(FactTypeMappingDictionary decidedFactTypeMappings, FactTypeMappingListDictionary undecidedFactTypeMappings) + /// <param name="decidedManyToOneFactTypeMappings">The decided many-to-one <see cref="FactTypeMapping"/> objects.</param> + /// <param name="decidedOneToOneFactTypeMappings">The decided one-to-one <see cref="FactTypeMapping"/> objects.</param> + /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> + private void FilterFactTypeMappings(FactTypeMappingDictionary decidedManyToOneFactTypeMappings, FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { - RemoveImpossiblePotentialFactTypeMappings(decidedFactTypeMappings, undecidedFactTypeMappings); + RemoveImpossiblePotentialFactTypeMappings(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); int changeCount = 0; do { - changeCount = MapTrivialOneToOneFactTypesWithTwoMandatories(decidedFactTypeMappings, undecidedFactTypeMappings); + changeCount = MapTrivialOneToOneFactTypesWithTwoMandatories(decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); } while (changeCount > 0); } @@ -373,14 +414,14 @@ /// Filters out deep potential mappings that are from an <see cref="ObjectType"/> that already has a decided deep /// mapping from it. /// </summary> - /// <param name="decidedFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> - /// <param name="undecidedFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> - private void RemoveImpossiblePotentialFactTypeMappings(FactTypeMappingDictionary decidedFactTypeMappings, FactTypeMappingListDictionary undecidedFactTypeMappings) + /// <param name="decidedOneToOneFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> + /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> possibilities.</param> + private void RemoveImpossiblePotentialFactTypeMappings(FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { ObjectTypeList deeplyMappedObjectTypes = new ObjectTypeList(); // For each decided fact type mapping... - foreach (KeyValuePair<FactType, FactTypeMapping> decidedFactTypeMapping in decidedFactTypeMappings) + foreach (KeyValuePair<FactType, FactTypeMapping> decidedFactTypeMapping in decidedOneToOneFactTypeMappings) { FactTypeMapping factTypeMapping = decidedFactTypeMapping.Value; @@ -393,7 +434,7 @@ FactTypeList factsPendingDeletion = new FactTypeList(); - foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedFactTypeMapping in undecidedFactTypeMappings) + foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedFactTypeMapping in undecidedOneToOneFactTypeMappings) { FactType factType = undecidedFactTypeMapping.Key; FactTypeMappingList potentialFactTypeMappings = undecidedFactTypeMapping.Value; @@ -415,7 +456,7 @@ if (potentialFactTypeMappings.Count == 1) { // Mark it decided. - decidedFactTypeMappings.Add(factType, potentialFactTypeMappings[0]); + decidedOneToOneFactTypeMappings.Add(factType, potentialFactTypeMappings[0]); factsPendingDeletion.Add(factType); } } @@ -423,7 +464,7 @@ // Delete each undecided (now decided) fact type mapping marked for deletion. foreach (FactType key in factsPendingDeletion) { - undecidedFactTypeMappings.Remove(key); + undecidedOneToOneFactTypeMappings.Remove(key); } } @@ -432,15 +473,15 @@ /// (potential or decided) deep mappings away from it. If both role players meet this criteria then no action is /// taken. /// </summary> - /// <param name="decidedFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> - /// <param name="undecidedFactTypeMappings">The undecided <see cref="FactTypeMapping"/> posibilities.</param> - /// <returns>The number of previously undecided fact type mappings that are now decided.</returns> - private int MapTrivialOneToOneFactTypesWithTwoMandatories(FactTypeMappingDictionary decidedFactTypeMappings, FactTypeMappingListDictionary undecidedFactTypeMappings) + /// <param name="decidedOneToOneFactTypeMappings">The decided <see cref="FactTypeMapping"/> objects.</param> + /// <param name="undecidedOneToOneFactTypeMappings">The undecided <see cref="FactTypeMapping"/> posibilities.</param> + /// <returns>The number of previously potential one-to-one fact type mappings that are now decided.</returns> + private int MapTrivialOneToOneFactTypesWithTwoMandatories(FactTypeMappingDictionary decidedOneToOneFactTypeMappings, FactTypeMappingListDictionary undecidedOneToOneFactTypeMappings) { int changeCount = 0; FactTypeList factsPendingDeletion = new FactTypeList(); - foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedFactTypeMapping in undecidedFactTypeMappings) + foreach (KeyValuePair<FactType, FactTypeMappingList> undecidedFactTypeMapping in undecidedOneToOneFactTypeMappings) { FactType factType = undecidedFactTypeMapping.Key; FactTypeMappingList potentialFactTypeMappings = undecidedFactTypeMapping.Value; @@ -452,16 +493,14 @@ Role secondRole = roles[1].Role; ObjectType firstRolePlayer = firstRole.RolePlayer; ObjectType secondRolePlayer = secondRole.RolePlayer; - bool firstRoleIsUnique = (firstRole.SingleRoleAlethicUniquenessConstraint != null); - bool secondRoleIsUnique = (secondRole.SingleRoleAlethicUniquenessConstraint != null); bool firstRoleIsMandatory = null != firstRole.SingleRoleAlethicMandatoryConstraint; bool secondRoleIsMandatory = null != secondRole.SingleRoleAlethicMandatoryConstraint; // If this is a one-to-one fact type with two simple alethic mandatories... - if (firstRoleIsUnique && secondRoleIsUnique && firstRoleIsMandatory && secondRoleIsMandatory) + if (firstRoleIsMandatory && secondRoleIsMandatory) { - bool firstRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(firstRolePlayer, factType, decidedFactTypeMappings, undecidedFactTypeMappings); - bool secondRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(secondRolePlayer, factType, decidedFactTypeMappings, undecidedFactTypeMappings); + bool firstRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(firstRolePlayer, factType, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); + bool secondRolePlayerHasPossibleDeepMappingsAway = ObjectTypeHasPossibleDeepMappingsAway(secondRolePlayer, factType, decidedOneToOneFactTypeMappings, undecidedOneToOneFactTypeMappings); // UNDONE: I think we need to be checking that the deep mappings we decide on here are actually in the list of potentials... // UNDONE: Also, this can create new decided deep mappings, so we need to be applying the related filters after this runs. @@ -473,7 +512,7 @@ // Deep map toward firstRolePlayer FactTypeMapping factTypeMapping = new FactTypeMapping(factType, secondRole, firstRole, MappingDepth.Deep); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); factsPendingDeletion.Add(factType); ++changeCount; } @@ -482,7 +521,7 @@ // Deep map toward secondRolePlayer FactTypeMapping factTypeMapping = new FactTypeMapping(factType, firstRole, secondRole, MappingDepth.Deep); - decidedFactTypeMappings.Add(factType, factTypeMapping); + decidedOneToOneFactTypeMappings.Add(factType, factTypeMapping); factsPendingDeletion.Add(factType); ++changeCount; } @@ -492,7 +531,7 @@ // Delete each undecided (now decided) fact type mapping marked for deletion. foreach (FactType key in factsPendingDeletion) { - undecidedFactTypeMappings.Remove(key); + undecidedOneToOneFactTypeMappings.Remove(key); } return changeCount; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-15 00:58:57
|
Revision: 1081 http://orm.svn.sourceforge.net/orm/?rev=1081&view=rev Author: mcurland Date: 2007-08-14 17:59:00 -0700 (Tue, 14 Aug 2007) Log Message: ----------- Temporarily locked the VirtualTreeGrid into the 8.0 version to enable building/running NORMA on Whidbey when Orcas beta is installed. refs #336 Modified Paths: -------------- trunk/ORMModel/ORMModel.csproj Modified: trunk/ORMModel/ORMModel.csproj =================================================================== --- trunk/ORMModel/ORMModel.csproj 2007-08-15 00:57:33 UTC (rev 1080) +++ trunk/ORMModel/ORMModel.csproj 2007-08-15 00:59:00 UTC (rev 1081) @@ -85,9 +85,7 @@ <Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> </Reference> - <Reference Include="Microsoft.VisualStudio.VirtualTreeGrid, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - </Reference> + <Reference Include="Microsoft.VisualStudio.VirtualTreeGrid, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="System" /> <Reference Include="System.Data" /> <Reference Include="System.Design" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-08 00:38:30
|
Revision: 1079 http://orm.svn.sourceforge.net/orm/?rev=1079&view=rev Author: mcurland Date: 2007-08-07 17:38:27 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Display unary FactType with a unary glyph in the model browser and correctly initialize FactTypeShape for unary dropped off the model browser. Required moving creation of single-role role display order for unaries to OnChildConfiguring. Doing this early eliminates the need for subsequent calls to AutoResize and for the fixup listener. Also made some of the fixup rules more robust for cases where the element is deleted before the shape can be created. refs #296 Modified Paths: -------------- trunk/ORMModel/ObjectModel/ORMModel.cs trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs trunk/ORMModel/ShapeModel/FactTypeShape.cs trunk/ORMModel/ShapeModel/ORMDiagram.cs trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs trunk/ORMModel/ShapeModel/ViewFixupRules.cs trunk/ORMModel/Transforms/SerializationExtensions.xsd Modified: trunk/ORMModel/ObjectModel/ORMModel.cs =================================================================== --- trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -64,7 +64,7 @@ /// <summary> /// Fixup stored presentation elements /// </summary> - ModifyStoredPresentationElements = 700, + ModifyStoredPresentationElements = 600, /// <summary> /// Add any presentation elements that are implicit and not /// serialized with the model. Modified: trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs =================================================================== --- trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ObjectModel/SurveyImplementations/FactTypeAnswers.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -194,12 +194,14 @@ } else { - switch (RoleCollection.Count) + LinkedElementCollection<RoleBase> roles = RoleCollection; + switch (roles.Count) { case 1: + // This case should not get hit with unary binarization, but it isn't hurting anything return (int)SurveyQuestionGlyph.UnaryFactType; case 2: - return (int)SurveyQuestionGlyph.BinaryFactType; + return GetUnaryRoleIndex(roles).HasValue ? (int)SurveyQuestionGlyph.UnaryFactType : (int)SurveyQuestionGlyph.BinaryFactType; case 3: return (int)SurveyQuestionGlyph.TernaryFactType; default: Modified: trunk/ORMModel/ShapeModel/FactTypeShape.cs =================================================================== --- trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -578,6 +578,41 @@ return displayRoles; } /// <summary> + /// Standard override + /// </summary> + public override void ConfiguringAsChildOf(NodeShape parent, bool createdDuringViewFixup) + { + /// Make sure the factType shape is prepared to display as a unary + FactType factType; + Role unaryRole; + if (null != (factType = AssociatedFactType) && + null != (unaryRole = factType.UnaryRole)) + { + // Create a RoleDisplayOrder for Unary FactTypes. + LinkedElementCollection<RoleBase> displayRoles = RoleDisplayOrderCollection; + switch (displayRoles.Count) + { + case 0: + // The RoleDisplayOrder is empty, so we don't need to do anything. + break; + case 1: + // We already have only one role in the RoleDisplayOrder, so all + // we have to do is make sure it is the right one. + if (displayRoles[0] != unaryRole) + { + displayRoles[0] = unaryRole; + } + return; + default: + // We have more than one role in the RoleDisplayOrder, so we + // have to clear it. + displayRoles.Clear(); + break; + } + displayRoles.Add(unaryRole); + } + } + /// <summary> /// Retrieve an editable version of the <see cref="DisplayedRoleOrder"/> property. Editing /// DisplayedRoleOrder directly can change the role order in the associated FactType. Using /// this method to retrieve the collection ensures it will only be modified on the shape. @@ -5093,7 +5128,7 @@ FactTypeShape shape = pel as FactTypeShape; if (shape != null) { - // When a binarized Unary Fact is not longer a unary, clear the displayed role orders + // When a binarized Unary Fact is no longer a unary, clear the displayed role orders shape.RoleDisplayOrderCollection.Clear(); shape.AutoResize(); } Modified: trunk/ORMModel/ShapeModel/ORMDiagram.cs =================================================================== --- trunk/ORMModel/ShapeModel/ORMDiagram.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ShapeModel/ORMDiagram.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -255,7 +255,6 @@ int roleCount = roleCollection.Count; for (int i = 0; i < roleCount; ++i) { - //Role role = roleBase.Role; Role role = roleCollection[i].Role; if (!duplicateShape) Modified: trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs =================================================================== --- trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -37,7 +37,6 @@ yield return new DisplayRoleValueConstraintFixupListener(); yield return new DisplayValueTypeValueConstraintFixupListener(); yield return new DisplayRoleNameFixupListener(); - yield return new DisplayUnaryFactTypeFixupListener(); yield return new DisplayModelNoteLinksFixupListener(); yield return FactTypeShape.FixupListener; } Modified: trunk/ORMModel/ShapeModel/ViewFixupRules.cs =================================================================== --- trunk/ORMModel/ShapeModel/ViewFixupRules.cs 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/ShapeModel/ViewFixupRules.cs 2007-08-08 00:38:27 UTC (rev 1079) @@ -439,9 +439,9 @@ FactTypeShape shape = pel as FactTypeShape; if (shape != null) { - if (factType.UnaryRole != null) + Role unaryRole = factType.UnaryRole; + if (unaryRole != null) { - Role unaryRole = factType.UnaryRole; LinkedElementCollection<RoleBase> displayOrder = shape.RoleDisplayOrderCollection; if (!displayOrder.Contains(unaryRole)) { @@ -515,49 +515,48 @@ // Make sure the object type, fact type, and link // are displayed on the diagram FactType associatedFact; - if ((associatedFact = link.PlayedRole.FactType) != null) + ObjectType rolePlayer; + ORMModel model; + if (!link.IsDeleted && + null != (associatedFact = link.PlayedRole.FactType) && + null != (model = (rolePlayer = link.RolePlayer).Model)) { - ObjectType rolePlayer = link.RolePlayer; - ORMModel model; - if ((model = rolePlayer.Model) != null) + FactType nestedFact; + if (FactTypeShape.ShouldDrawObjectification(nestedFact = rolePlayer.NestedFactType)) { - FactType nestedFact; - if (FactTypeShape.ShouldDrawObjectification(nestedFact = rolePlayer.NestedFactType)) - { - Diagram.FixUpDiagram(model, nestedFact); - Diagram.FixUpDiagram(nestedFact, rolePlayer); - } - else - { - Diagram.FixUpDiagram(model, rolePlayer); - } - Diagram.FixUpDiagram(model, associatedFact); + Diagram.FixUpDiagram(model, nestedFact); + Diagram.FixUpDiagram(nestedFact, rolePlayer); + } + else + { + Diagram.FixUpDiagram(model, rolePlayer); + } + Diagram.FixUpDiagram(model, associatedFact); - object AllowMultipleShapes; - Dictionary<object, object> topLevelContextInfo; - bool containedAllowMultipleShapes; - if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes))) - { - topLevelContextInfo.Add(AllowMultipleShapes, null); - } + object AllowMultipleShapes; + Dictionary<object, object> topLevelContextInfo; + bool containedAllowMultipleShapes; + if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes))) + { + topLevelContextInfo.Add(AllowMultipleShapes, null); + } - foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId)) + foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId)) + { + ORMDiagram diagram; + if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null) { - ORMDiagram diagram; - if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null) + //add a link shape for each fact type shape on the diagram for the played role + foreach (FactTypeShape shapeElement in MultiShapeUtility.FindAllShapesForElement<FactTypeShape>(diagram, associatedFact)) { - //add a link shape for each fact type shape on the diagram for the played role - foreach (FactTypeShape shapeElement in MultiShapeUtility.FindAllShapesForElement<FactTypeShape>(diagram, associatedFact)) - { - diagram.FixUpLocalDiagram(link); - } + diagram.FixUpLocalDiagram(link); } } + } - if (!containedAllowMultipleShapes) - { - topLevelContextInfo.Remove(AllowMultipleShapes); - } + if (!containedAllowMultipleShapes) + { + topLevelContextInfo.Remove(AllowMultipleShapes); } } } @@ -844,45 +843,46 @@ // are displayed on the diagram IFactConstraint ifc = link as IFactConstraint; IConstraint constraint = ifc.Constraint; - FactType factType = ifc.FactType; - if (factType != null) + FactType factType; + ORMModel model; + ModelElement constraintElement = (ModelElement)constraint; + if (!constraintElement.IsDeleted && + null != (factType = ifc.FactType) && + !factType.IsDeleted && + null != (model = factType.Model)) { - ORMModel model = factType.Model; - if (model != null) - { - Debug.Assert(model == constraint.Model); + Debug.Assert(model == constraint.Model); - Diagram.FixUpDiagram(model, constraint as ModelElement); - Diagram.FixUpDiagram(model, factType); + Diagram.FixUpDiagram(model, constraint as ModelElement); + Diagram.FixUpDiagram(model, factType); - object AllowMultipleShapes; - Dictionary<object, object> topLevelContextInfo; - bool containedAllowMultipleShapes; - if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes))) - { - topLevelContextInfo.Add(AllowMultipleShapes, null); - } + object AllowMultipleShapes; + Dictionary<object, object> topLevelContextInfo; + bool containedAllowMultipleShapes; + if (!(containedAllowMultipleShapes = (topLevelContextInfo = link.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo).ContainsKey(AllowMultipleShapes = MultiShapeUtility.AllowMultipleShapes))) + { + topLevelContextInfo.Add(AllowMultipleShapes, null); + } - foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId)) + foreach (PresentationViewsSubject presentationViewsSubject in DomainRoleInfo.GetElementLinks<PresentationViewsSubject>(model, PresentationViewsSubject.SubjectDomainRoleId)) + { + ORMDiagram diagram; + if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null) { - ORMDiagram diagram; - if ((diagram = presentationViewsSubject.Presentation as ORMDiagram) != null) + //add a link shape for each constraint shape + foreach (ExternalConstraintShape shapeElement in MultiShapeUtility.FindAllShapesForElement<ExternalConstraintShape>(diagram, constraint as ModelElement)) { - //add a link shape for each constraint shape - foreach (ExternalConstraintShape shapeElement in MultiShapeUtility.FindAllShapesForElement<ExternalConstraintShape>(diagram, constraint as ModelElement)) + if (null == diagram.FixUpLocalDiagram(link)) { - if (null == diagram.FixUpLocalDiagram(link)) - { - shapeElement.Delete(); - } + shapeElement.Delete(); } } } + } - if (!containedAllowMultipleShapes) - { - topLevelContextInfo.Remove(AllowMultipleShapes); - } + if (!containedAllowMultipleShapes) + { + topLevelContextInfo.Remove(AllowMultipleShapes); } } } @@ -1016,59 +1016,6 @@ } } #endregion // DisplayRolePlayersFixupListener class - #region DisplayUnaryFactTypeFixupListener class - /// <summary> - /// Processes Unary FactTypes so that they display the correct number of roles - /// </summary> - private sealed class DisplayUnaryFactTypeFixupListener : DeserializationFixupListener<FactType> - { - /// <summary> - /// Create a new DisplayUnaryFactTypeFixupListener - /// </summary> - public DisplayUnaryFactTypeFixupListener() - : base((int)ORMDeserializationFixupPhase.AddImplicitPresentationElements) - { - } - - protected override void ProcessElement(FactType element, Store store, INotifyElementAdded notifyAdded) - { - Role unaryRole = element.UnaryRole; - if (unaryRole != null) - { - foreach (PresentationElement pel in PresentationViewsSubject.GetPresentation(element)) - { - FactTypeShape shape = pel as FactTypeShape; - if (shape != null) - { - // Create a RoleDisplayOrder for Unary FactTypes. - LinkedElementCollection<RoleBase> roles = shape.RoleDisplayOrderCollection; - switch (roles.Count) - { - case 0: - // The RoleDisplayOrder is empty, so we don't need to do anything. - break; - case 1: - // We already have only one role in the RoleDisplayOrder, so all - // we have to do is make sure it is the right one. - if (roles[0] != unaryRole) - { - roles[0] = unaryRole; - } - continue; - default: - // We have more than one role in the RoleDisplayOrder, so we - // have to clear it. - roles.Clear(); - break; - } - roles.Add(unaryRole); - shape.AutoResize(); - } - } - } - } - } - #endregion // DisplayUnaryFactTypeFixupListener class #region ModelNote fixup #region ModelNoteAddedRule /// <summary> Modified: trunk/ORMModel/Transforms/SerializationExtensions.xsd =================================================================== --- trunk/ORMModel/Transforms/SerializationExtensions.xsd 2007-08-08 00:31:35 UTC (rev 1078) +++ trunk/ORMModel/Transforms/SerializationExtensions.xsd 2007-08-08 00:38:27 UTC (rev 1079) @@ -25,6 +25,7 @@ </xs:appinfo> </xs:annotation> + <xs:import namespace="http://schemas.neumont.edu/CodeGeneration/PLiX"/> <xs:simpleType name="ElementWriteStyle"> <xs:annotation> <xs:documentation>How to write and element.</xs:documentation> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-08-08 00:31:32
|
Revision: 1078 http://orm.svn.sourceforge.net/orm/?rev=1078&view=rev Author: mcurland Date: 2007-08-07 17:31:35 -0700 (Tue, 07 Aug 2007) Log Message: ----------- Adding internal uniqueness constraints (and a number of other shape actions) after a file reload caused the FactTypeShape to lose its center-of-rolesbox anchor point. Added fixup listener to reset the RolesPosition property. refs #218 Modified Paths: -------------- trunk/ORMModel/ObjectModel/ORMModel.cs trunk/ORMModel/ShapeModel/FactTypeShape.cs trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs trunk/ORMModel/ShapeModel/ORMShape.dsl Modified: trunk/ORMModel/ObjectModel/ORMModel.cs =================================================================== --- trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:27:57 UTC (rev 1077) +++ trunk/ORMModel/ObjectModel/ORMModel.cs 2007-08-08 00:31:35 UTC (rev 1078) @@ -62,10 +62,14 @@ /// </summary> ValidateErrors = 500, /// <summary> + /// Fixup stored presentation elements + /// </summary> + ModifyStoredPresentationElements = 700, + /// <summary> /// Add any presentation elements that are implicit and not /// serialized with the model. /// </summary> - AddImplicitPresentationElements = 600, + AddImplicitPresentationElements = 700, } #endregion // ORMDeserializationFixupPhase enum public partial class ORMModel Modified: trunk/ORMModel/ShapeModel/FactTypeShape.cs =================================================================== --- trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:27:57 UTC (rev 1077) +++ trunk/ORMModel/ShapeModel/FactTypeShape.cs 2007-08-08 00:31:35 UTC (rev 1078) @@ -5284,6 +5284,41 @@ } } #endregion // Derivation Rules + #region Deserialization Fixup + /// <summary> + /// Return a deserialization fixup listener. The listener + /// ensures that non-serialized information on a FactTypeShape is properly restored + /// </summary> + public static IDeserializationFixupListener FixupListener + { + get + { + return new FactTypeShapeFixupListener(); + } + } + /// <summary> + /// A listener to reset non-serialized FactTypeShape properties. + /// </summary> + private sealed class FactTypeShapeFixupListener : DeserializationFixupListener<FactTypeShape> + { + /// <summary> + /// Create a new FactTypeShapeFixupListener + /// </summary> + public FactTypeShapeFixupListener() + : base((int)ORMDeserializationFixupPhase.ModifyStoredPresentationElements) + { + } + /// <summary> + /// Update the non-serialized RolesPosition property, used to keep a FactTypeShape + /// anchored on the center of the roles box + /// </summary> + protected sealed override void ProcessElement(FactTypeShape element, Store store, INotifyElementAdded notifyAdded) + { + PointD centerPoint = RolesShape.GetBounds(element).Center; + element.RolesPosition = (element.DisplayOrientation != DisplayOrientation.Horizontal) ? centerPoint.X : centerPoint.Y; + } + } + #endregion Deserialization Fixup } #endregion // FactTypeShape class #region ObjectifiedFactTypeNameShape class Modified: trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs =================================================================== --- trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs 2007-08-08 00:27:57 UTC (rev 1077) +++ trunk/ORMModel/ShapeModel/GeneratedCode/Shapes.cs 2007-08-08 00:31:35 UTC (rev 1078) @@ -818,8 +818,9 @@ [DslDesign::DisplayNameResource("Neumont.Tools.ORM.ShapeModel.FactTypeShape/RolesPosition.DisplayName", typeof(global::Neumont.Tools.ORM.ShapeModel.ORMShapeDomainModel), "Neumont.Tools.ORM.GeneratedCode.ShapeDomainModelResx")] [DslDesign::DescriptionResource("Neumont.Tools.ORM.ShapeModel.FactTypeShape/RolesPosition.Description", typeof(global::Neumont.Tools.ORM.ShapeModel.ORMShapeDomainModel), "Neumont.Tools.ORM.GeneratedCode.ShapeDomainModelResx")] [global::System.ComponentModel.Browsable(false)] + [global::System.ComponentModel.ReadOnly(true)] [DslModeling::DomainObjectId("89244439-fbb1-4deb-bff3-69d47cb90a6b")] - public global::System.Double RolesPosition + private global::System.Double RolesPosition { [global::System.Diagnostics.DebuggerStepThrough] get Modified: trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs =================================================================== --- trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:27:57 UTC (rev 1077) +++ trunk/ORMModel/ShapeModel/ORMShape.DeserializationFixupListeners.cs 2007-08-08 00:31:35 UTC (rev 1078) @@ -39,6 +39,7 @@ yield return new DisplayRoleNameFixupListener(); yield return new DisplayUnaryFactTypeFixupListener(); yield return new DisplayModelNoteLinksFixupListener(); + yield return FactTypeShape.FixupListener; } } IEnumerable<IDeserializationFixupListener> IDeserializationFixupListenerProvider.DeserializationFixupListenerCollection Modified: trunk/ORMModel/ShapeModel/ORMShape.dsl =================================================================== --- trunk/ORMModel/ShapeModel/ORMShape.dsl 2007-08-08 00:27:57 UTC (rev 1077) +++ trunk/ORMModel/ShapeModel/ORMShape.dsl 2007-08-08 00:31:35 UTC (rev 1078) @@ -152,7 +152,7 @@ <DomainEnumerationMoniker Name="DisplayOrientation"/> </Type> </DomainProperty> - <DomainProperty Name="RolesPosition" Id="89244439-FBB1-4DEB-BFF3-69D47CB90A6B" DefaultValue="0" IsBrowsable="false"> + <DomainProperty Name="RolesPosition" Id="89244439-FBB1-4DEB-BFF3-69D47CB90A6B" DefaultValue="0" IsBrowsable="false" GetterAccessModifier="Private" SetterAccessModifier="Private"> <Type> <ExternalTypeMoniker Name="/System/Double"/> </Type> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-07-31 23:50:31
|
Revision: 1076 http://orm.svn.sourceforge.net/orm/?rev=1076&view=rev Author: mcurland Date: 2007-07-31 16:50:34 -0700 (Tue, 31 Jul 2007) Log Message: ----------- Fixed typo in install.bat introduced in [1070]. refs #193 Modified Paths: -------------- trunk/install.bat Modified: trunk/install.bat =================================================================== --- trunk/install.bat 2007-07-31 23:47:02 UTC (rev 1075) +++ trunk/install.bat 2007-07-31 23:50:34 UTC (rev 1076) @@ -122,7 +122,7 @@ :_MakeDirCopy IF NOT EXIST "%~1" ( MKDIR "%~1" - IF EXIST "%2" ( + IF EXIST "%~2" ( XCOPY /S /Q "%~2" "%~1" ) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mcu...@us...> - 2007-07-31 23:47:05
|
Revision: 1075 http://orm.svn.sourceforge.net/orm/?rev=1075&view=rev Author: mcurland Date: 2007-07-31 16:47:02 -0700 (Tue, 31 Jul 2007) Log Message: ----------- Added mechanism for ObjectType filtering. refs #327 Modified Paths: -------------- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs Modified: trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs =================================================================== --- trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-07-24 18:16:18 UTC (rev 1074) +++ trunk/Oial/ORMOialBridge/OialModelIsForORMModel.cs 2007-07-31 23:47:02 UTC (rev 1075) @@ -138,8 +138,12 @@ #endregion #region ORM Error Filtering Methods - private static bool ShouldIgnoreFactType(FactType factType) + private bool ShouldIgnoreObjectType(ObjectType objectType) { + return false; + } + private bool ShouldIgnoreFactType(FactType factType) + { // Subtype facts are always binarized, and never missing role players if (factType is SubtypeFact) { @@ -155,8 +159,8 @@ // Ignore fact types that contain roles that are missing role players foreach (RoleBase roleBase in roles) { - // UNDONE: Should we just be checking RolePlayer == null instead? - if (roleBase.Role.RolePlayerRequiredError != null) + ObjectType rolePlayer = roleBase.Role.RolePlayer; + if (rolePlayer != null || ShouldIgnoreObjectType(rolePlayer)) { return true; } @@ -579,6 +583,10 @@ // For each ValueType in the model... foreach (ObjectType valueType in modelValueTypes) { + if (ShouldIgnoreObjectType(valueType)) + { + continue; + } // Create InformationTypeFormat. PropertyAssignment namePropertyAssignment = new PropertyAssignment(InformationTypeFormat.NameDomainPropertyId, valueType.Name); InformationTypeFormat informationTypeFormat = new InformationTypeFormat(Store, namePropertyAssignment); @@ -604,6 +612,10 @@ // For each object type in the model... foreach (ObjectType objectType in modelObjectTypes) { + if (ShouldIgnoreObjectType(objectType)) + { + continue; + } // If it should have a conctpt type... if (ObjectTypeIsConceptType(objectType, factTypeMappings)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kev...@us...> - 2006-03-06 20:00:59
|
Test message |