public static string GetSimpleQuery(string doctorName = "Leffell") { var queryBase = new QueryBuilder(); var operand1 = new PubMedQeuryBlock { QueryType = QueryBlockTypes.Operand, Term = PubMedTerms.Author, SearchTerm = doctorName, }; var operand2 = new PubMedQueryRangeBlock { QueryType = QueryBlockTypes.Operand, Term = PubMedTerms.DatePublication, StartDate = new DateTime(2000, 1, 1), EndDate = new DateTime(2015, 1, 1) }; var operatorAnd = new PubMedQueryOperatorBlock { QueryType = QueryBlockTypes.Operator, Operator = PubMedQueryOperator.AND }; queryBase.AddToQuery(operand1); queryBase.AddToQuery(operatorAnd); queryBase.AddToQuery(operand2); return queryBase.ToString(); }
private string buildQeuryRangeBlock(PubMedQueryRangeBlock queryBlock) { var rangeBuilder = new StringBuilder(); var queryTerm = TermToQeuryTermMap.GetQueryTerm(queryBlock.Term); rangeBuilder.AppendFormat("\"{0}\"[{1}]", PubMedDateOperations.DatetimeToPubMedDate(queryBlock.StartDate), queryTerm); rangeBuilder.Append(" : "); if (queryBlock.EndDate != DateTime.MinValue) { rangeBuilder.AppendFormat("\"{0}\"[{1}]", PubMedDateOperations.DatetimeToPubMedDate(queryBlock.StartDate), queryTerm); } else { rangeBuilder.AppendFormat("\"{0}\"[{1}]", PubMedDateOperations.DatetimeToPubMedDate(queryBlock.StartDate), queryTerm); } return Wrap(rangeBuilder.ToString()); }
public static string GetSimpleQueryRandomDoctrNames() { var count = GetDoactorNames().Count() - 1; var random = new Random(); var randomNumber = random.Next(0, count); var queryBase = new QueryBuilder(); var operand1 = new PubMedQeuryBlock { QueryType = QueryBlockTypes.Operand, Term = PubMedTerms.Author, SearchTerm = GetDoactorNames().ElementAt(randomNumber), }; var operand2 = new PubMedQueryRangeBlock { QueryType = QueryBlockTypes.Operand, Term = PubMedTerms.DatePublication, StartDate = new DateTime(2000, 1, 1), EndDate = new DateTime(2015, 1, 1) }; var operatorAnd = new PubMedQueryOperatorBlock { QueryType = QueryBlockTypes.Operator, Operator = PubMedQueryOperator.AND }; queryBase.AddToQuery(operand1); queryBase.AddToQuery(operatorAnd); queryBase.AddToQuery(operand2); return queryBase.ToString(); }