/// <summary> /// Constructs <see cref="sampleGroupSet"/> preset for my particular research /// </summary> public sampleGroupSetInPhd() { name = "Groups inside the Main Sample"; primarySample = new sampleGroupItem("Primary sample", sampleGroupSetInPhdEnum.primary, 1, 50); primarySample.groupDescription = "Human post-processed, domain expert analysed and used as machine-learning training set"; evaluationSetA = new sampleGroupItem("Evaluation set A", sampleGroupSetInPhdEnum.evaluation_a, 1, -1); evaluationSetA.groupDescription = "Dataset A - utilized during algorithm evaluation, meant for machine-only processing"; evaluationSetB = new sampleGroupItem("Evaluation set B", sampleGroupSetInPhdEnum.evaluation_b, 2, -1); evaluationSetB.groupDescription = "Dataset B - utilized during algorithm evaluation, meant for machine-only processing"; problem = new sampleGroupItem("Problem", sampleGroupSetInPhdEnum.problem, 1, 10); problem.groupDescription = "Cases where the crawler runs into blockade or crashes."; big = new sampleGroupItem("Big web sites", sampleGroupSetInPhdEnum.big, 1, 20); big.groupDescription = "Dataset with the biggest web sites in volume."; Add(primarySample); Add(evaluationSetA); Add(evaluationSetB); Add(problem); Add(big); }
///// <summary> ///// Vrsi selektovanje profila na osnovu podesavanja i SampleTaker algoritma ///// </summary> ///// <param name="runStamp"></param> ///// <param name="groups"></param> ///// <param name="sampler"></param> ///// <param name="customWhere"></param> ///// <returns></returns> //public List<webSiteProfile> selectProfiles(this IGrou String runStamp = null, List<String> groups = null, // sampleSettings sampler = null, String customWhere = "", Boolean onlyCurrentTest = false) ////where T : IEnumerable<webSiteProfile>, new() //{ // List<webSiteProfile> output = new List<webSiteProfile>(); // String wSql = makeSqlWhere(runStamp, groups, customWhere, onlyCurrentTest); // // source // //IRelationEnabledCollection rl = this as IRelationEnabledCollection; // output = this.selectItems<webSiteProfile>(wSql, -1, selectItemsMode.sqlWhere, selectItemsResultType.managed); // return output; //} ///// <summary> ///// 2017c: Selects the group. ///// </summary> ///// <param name="groupSet">The group set.</param> ///// <param name="group">The group.</param> ///// <param name="loger">The loger.</param> ///// <param name="source">The source.</param> ///// <param name="runStamp">The run stamp.</param> ///// <param name="customWhere">The custom where.</param> ///// <param name="onlyCurrentTest">if set to <c>true</c> [only current test].</param> ///// <returns></returns> //public static IEnumerable<webSiteProfile> selectGroup(this sampleGroupSet groupSet, sampleGroupItem group, ILogBuilder loger,webSiteProfileCollection source, String runStamp = null, String customWhere = "", Boolean onlyCurrentTest = false) //{ // //List<IReal> wbp = new List<IProfile>(); // //String whereQ = groupSet.makeSqlWhere(group, loger, runStamp, customWhere, onlyCurrentTest); // ////.selectItems(whereQ); // webSiteProfiles.selectItems<webSiteProfile>(sql, -1, selectItemsMode.sqlWhere, selectItemsResultType.managed); // // return wbp; //} /// <summary> /// Pravi WHERE dodatak SQL upita - /// </summary> /// <param name="runStamp">Ako nije definisan napravice trenuitni</param> /// <param name="groups">Grupe - ako nije definisan ucitace sve</param> /// <param name="customWhere">Proizvoljan WHERE upit</param> /// <param name="onlyCurrentTest">Da li proverava RunStamp</param> /// <returns></returns> public static string makeSqlWhere(this sampleGroupSet groupSet, sampleGroupItem group, ILogBuilder loger, string runStamp = null, string customWhere = "", bool onlyCurrentTest = false) { loger.log("Creating sample filter query for: " + group.groupTitle + " (" + group.groupTag + ")"); string output = ""; string whereRunStamp = ""; string whereGroups = ""; if (onlyCurrentTest) { if (string.IsNullOrEmpty(runStamp)) { } whereRunStamp = "((lastRunStamp <> \"" + runStamp + "\") OR (lastRunStamp IS NULL))"; } whereGroups = groupSet.db_groupTagFieldName + " LIKE '%" + group.groupTag + "%'"; if (!string.IsNullOrEmpty(whereRunStamp)) { output += whereRunStamp + ""; } if (!string.IsNullOrEmpty(whereGroups)) { if (!string.IsNullOrEmpty(output)) { output += " OR " + whereGroups; } else { output = whereGroups; } } if (!string.IsNullOrEmpty(customWhere)) { if (!string.IsNullOrEmpty(output)) { output += " OR " + customWhere; } else { output = customWhere; } } loger.log("Query to filter from " + group.count + " entries: " + output); return(output); }
/// <summary> /// Automatic group creation - using default settings /// </summary> /// <param name="numberOfGroups">Number of groups to autocreate</param> /// <returns></returns> public static sampleGroupSet createGroupSet(int numberOfGroups) { sampleGroupSet output = new sampleGroupSet(); //Int32 i = 1; for (var a = 0; a < numberOfGroups; a++) { sampleGroupItem group = new sampleGroupItem(); group.groupTitle = "Group " + a.ToString(); group.groupTag = "G" + a.ToString(); group.weight = 1; output.Add(group); } return(output); }