Example #1
0
        /// <summary>
        /// Converts and returns the citations from the database string that stores the citations
        /// in the CITATIONS table.
        /// </summary>
        /// <param name="dbStr">The databse value string from the CITATIONS table</param>
        /// <returns>The list of citations against the time they were sited.</returns>
        ///
        public static KeyValuePair <DateTimeOffset, List <string> > GetCitationsFromDbString(
            RankingType_T rankingType,
            string dbStr)
        {
            char[] delimiters = { Separator };

            string[] parts = dbStr.Split(delimiters);

            DateTimeOffset dt = DateTimeOffset.Parse(parts[0]);

            List <string> urls = new List <string>();

            if (rankingType == RankingType_T.Popularity)
            {
                for (int i = 1; i < parts.Length; ++i)
                {
                    urls.Add(parts[i]);
                }
            }
            else if (rankingType == RankingType_T.PopularitySimilarity)
            {
                urls.Add(parts[1]); // this is the title Article's URL

                // get citations from raw text
                List <string> citations = RankingDataProcessor.GetCitations(parts[2], true);
                for (int i = 0; i < citations.Count; ++i)
                {
                    urls.Add(citations[i]);
                }
            }

            KeyValuePair <DateTimeOffset, List <string> > ct =
                new KeyValuePair <DateTimeOffset, List <string> >(dt, urls);

            return(ct);
        }