private void CreateAttributeTables(List <object> attributes, string tableName, List <string> columnNames, List <string> tNames) { bool colNameSpecified = columnNames != null && columnNames.Count > 0; String[] attributeNames1 = { "var", "v", "att0", "p" }; String[] attributeTypes1 = { "INT", "INT", "NVARCHAR(MAX)", "float" }; underlineDatabase.CreateNewTable(tableName + "_0", attributeNames1, attributeTypes1); int colIndex = 0; for (int i = 0; i < attributes.Count; i++) { var attributeObject = attributes[i]; if (attributeObject is DeterministicAttribute) { var attIndex = colNameSpecified? ConvertAttributeNameToIndex(columnNames[colIndex]) : colIndex + 1; String[] attributeNames = { "var", "v", "att" + attIndex, "p" }; String[] attributeTypes = { "INT", "INT", "NVARCHAR(MAX)", "float" }; underlineDatabase.CreateNewTable(tNames[i], attributeNames, attributeTypes); colIndex++; } else if (attributeObject is ProbabilisticSingleAttribute) { var attIndex = colNameSpecified ? ConvertAttributeNameToIndex(columnNames[colIndex]) : colIndex + 1; String[] attributeNames = { "var", "v", "att" + attIndex, "p" }; String[] attributeTypes = { "INT", "INT", "NVARCHAR(MAX)", "float" }; underlineDatabase.CreateNewTable(tNames[i], attributeNames, attributeTypes); colIndex++; } else if (attributeObject is ProbabilisticMultiAttribute) { var multiAttribute = (ProbabilisticMultiAttribute)attributeObject; var noOfAtt = multiAttribute.MultiAttrbutes.Count; var attributeNames = new List <string>() { "var", "v" }; var attributeTypes = new List <string>() { "INT", "INT" }; for (int j = 0; j < noOfAtt; j++) { var cName = colNameSpecified? columnNames[colIndex + j] : "att" + (colIndex + j + 1); attributeNames.Add(cName); attributeTypes.Add("NVARCHAR(MAX)"); } attributeNames.Add("p"); attributeTypes.Add("float"); underlineDatabase.CreateNewTable(tNames[i], attributeNames.ToArray(), attributeTypes.ToArray()); colIndex += noOfAtt; } else { throw new Exception("attribute object invalid"); } } }
private void createAttributeTables(string tableName, List<string> attNames, List<string> attTypes, IStandardDatabase underlineDatabase) { String[] attributeNames1 = { "var", "v", "TupleExistence", "p" }; String[] attributeTypes1 = { "INT", "INT", "NVARCHAR(MAX)", "float" }; underlineDatabase.CreateNewTable(tableName + "_0", attributeNames1, attributeTypes1); for (int i = 1; i <= attNames.Count; i++) { string attributeTableName = tableName + "_" + i; String[] attributeNames = { "var", "v", attNames[i-1], "p" }; String[] attributeTypes = { "INT", "INT", attTypes[i-1], "float" }; underlineDatabase.CreateNewTable(attributeTableName, attributeNames, attributeTypes); } }
private void createAttributeTables(string tableName, List <string> attNames, List <string> attTypes, IStandardDatabase underlineDatabase) { String[] attributeNames1 = { "var", "v", "TupleExistence", "p" }; String[] attributeTypes1 = { "INT", "INT", "NVARCHAR(MAX)", "float" }; underlineDatabase.CreateNewTable(tableName + "_0", attributeNames1, attributeTypes1); for (int i = 1; i <= attNames.Count; i++) { string attributeTableName = tableName + "_" + i; String[] attributeNames = { "var", "v", attNames[i - 1], "p" }; String[] attributeTypes = { "INT", "INT", attTypes[i - 1], "float" }; underlineDatabase.CreateNewTable(attributeTableName, attributeNames, attributeTypes); } }
private void createPossibleStatesTable(SqlInsertQuery query, List <object> attributes) { String[] attributeNames = { "var", "v" }; String[] attributeTypes = { "INT", "INT" }; string attributeTableName = query.TableName + "_PossibleStates"; List <String> attributeNamesList = attributeNames.ToList(); List <String> attributeTypesList = attributeTypes.ToList(); for (int i = 1; i <= attributes.Count; i++) { string ai = "att" + i; attributeNamesList.Add(ai); attributeTypesList.Add("NVARCHAR(MAX)"); } // p is the last attribute attributeNamesList.Add("p"); attributeTypesList.Add("float"); underlineDatabase.CreateNewTable(attributeTableName, attributeNamesList.ToArray(), attributeTypesList.ToArray()); }
private void CreatePossibleWorldsTable(string tableName, int attributeSize) { String[] attributeNames = { "worldNo" }; String[] attributeTypes = { "INT" }; string attributeTableName = tableName + "_PossibleWorlds"; List <String> attributeNamesList = attributeNames.ToList(); List <String> attributeTypesList = attributeTypes.ToList(); for (int i = 1; i <= attributeSize; i++) { string ai = "att" + i; attributeNamesList.Add(ai); attributeTypesList.Add("NVARCHAR(MAX)"); } // p is the last attribute attributeNamesList.Add("p"); attributeTypesList.Add("float"); underlineDatabase.CreateNewTable(attributeTableName, attributeNamesList.ToArray(), attributeTypesList.ToArray()); }
private void createPossibleStatesTable(string tableName, List<string> attNames, List<string> attTypes, IStandardDatabase underlineDatabase) { String[] attributeNames = { "var", "v" }; String[] attributeTypes = { "INT", "INT" }; string attributeTableName = tableName + "_PossibleStates"; List<String> attributeNamesList = attributeNames.ToList(); List<String> attributeTypesList = attributeTypes.ToList(); attributeNamesList.AddRange(attNames); attributeTypesList.AddRange(attTypes); // p is the last attribute attributeNamesList.Add("p"); attributeTypesList.Add("float"); underlineDatabase.CreateNewTable(attributeTableName, attributeNamesList.ToArray(), attributeTypesList.ToArray()); }
private void createPossibleWorldsTable(string tableName, List <string> attNames, List <string> attTypes, IStandardDatabase underlineDatabase) { String[] attributeNames = { "worldNo" }; String[] attributeTypes = { "INT" }; string attributeTableName = tableName + "_PossibleWorlds"; List <String> attributeNamesList = attributeNames.ToList(); List <String> attributeTypesList = attributeTypes.ToList(); attributeNamesList.AddRange(attNames); attributeTypesList.AddRange(attTypes); // p is the last attribute attributeNamesList.Add("p"); attributeTypesList.Add("float"); underlineDatabase.CreateNewTable(attributeTableName, attributeNamesList.ToArray(), attributeTypesList.ToArray()); }