Ejemplo n.º 1
0
        public static string getComparisonTable(string URIs)
        {
            URIs = URIs.Trim();
            string result;
            List<string> uri_s = (URIs.Split(',')).ToList<string>();

            Comparison comparison_object = new Comparison(uri_s);

            result = "<table width=\"1100px\" class=\"resultTable\" Cellpadding='0px' Cellmargin='0px'>";

            for (int i = 0; i < (comparison_object.CommonPredicate_SubjectLabel.Count); i++)
            {

                result += "<tr><td>" + comparison_object.CommonPredicate_SubjectLabel[i] + "</td>";
                foreach (ComparisonElement y in comparison_object.ComparisonElement)
                {
                    foreach (string x in y.CommonPredicateObject_String[i])
                    {
                        result += ("<td>" + x + "</td>");
                    }
                    result += "</tr>";
                }
            }

            result += "<Table/>";

            return result;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            List<String> urisStringsToCompare = new List<String>();
            urisStringsToCompare.Add("http://dbpedia.org/resource/Led_Zeppelin_III");
            urisStringsToCompare.Add("http://dbpedia.org/resource/Like_a_Virgin");

            Comparison c = new Comparison(urisStringsToCompare, "http://dbpedia.org/sparql");

            /////////////////////////////////////////////////////////////////For Testing

            int i = 0;

            foreach (string x in c.CommonPredicate_SubjectLabel)
            {
                Console.WriteLine(x);

                foreach (ComparisonElement element in c.ComparisonElement)
                {
                    Console.WriteLine('\t' + element.ElementLabel);

                    for (int j = 0; j < element.CommonPredicateObject_String[i].Count; j++)
                    {
                        Console.WriteLine("\t\t" + element.CommonPredicateObject_String[i][j]);
                    }
                }
                i++;
            }

            Console.WriteLine("\n\n\n");

            i = 0;

            foreach (string x in c.CommonPredicate_ObjectLabel)
            {
                Console.WriteLine(x);

                foreach (ComparisonElement element in c.ComparisonElement)
                {
                    Console.WriteLine('\t' + element.ElementLabel);

                    for (int j = 0; j < element.CommonPredicateSubject_String[i].Count; j++)
                    {
                        Console.WriteLine("\t\t" + element.CommonPredicateSubject_String[i][j]);
                    }
                }
                i++;
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            List<String> urisStringsToCompare = new List<String>();
            urisStringsToCompare.Add("http://dbpedia.org/page/Resource_Description_Framework");
            urisStringsToCompare.Add("http://dbpedia.org/page/Resource_Description_Framework");

            Comparison c = new Comparison(urisStringsToCompare, "http://dbpedia.org/sparql");

            /////////////////////////////////////////////////////////////////For Testing

            int i = 0;

            foreach (INode x in c.CommonPredicate_Subject)
            {
                Console.WriteLine(x);

                foreach (ComparisonElement element in c.ComparisonElement)
                {
                    Console.WriteLine('\t' + element.ElementURI);

                    for (int j = 0; j < element.CommonPredicateObject_String[i].Count; j++)
                    {
                        Console.WriteLine("\t\t" + element.CommonPredicateObject_String[i][j]);
                    }
                }
                i++;
            }

            Console.WriteLine("\n\n\n");

            i = 0;

            foreach (INode x in c.CommonPredicate_Object)
            {
                Console.WriteLine(x);

                foreach (ComparisonElement element in c.ComparisonElement)
                {
                    Console.WriteLine('\t' + element.ElementURI);

                    for (int j = 0; j < element.CommonPredicateSubject_String[i].Count; j++)
                    {
                        Console.WriteLine("\t\t" + element.CommonPredicateSubject_String[i][j]);
                    }
                }
                i++;
            }
        }
Ejemplo n.º 4
0
        public static string getComparisonElements(string URIs)
        {
            string result;
            List<string> uri_s = (URIs.Split(',')).ToList<string>();

            Comparison comparison_object = new Comparison(uri_s);

            result = "[";

            foreach (string i in comparison_object.CommonPredicate_SubjectLabel)
            {
                result += "'" + i + "',";
            }
            result = result.Remove(result.Length);
            result += "]";

            return result;
        }
Ejemplo n.º 5
0
        public static string getJSONComparisonTable(string URIs)
        {
            string result;
            List<string> uri_s = (URIs.Split(',')).ToList<string>();

            Comparison comparison_object = new Comparison(uri_s);

            result = "{";

            result += "'__comparisonElements' : [";
            foreach (string i in comparison_object.CommonPredicate_SubjectLabel)
            {
                string ireplaced = i.Replace("'", @"\'");
                result += (i == comparison_object.CommonPredicate_SubjectLabel[comparison_object.CommonPredicate_SubjectLabel.Count - 1]) ? "'" + ireplaced + "'" : "'" + ireplaced + "',";
            }

            //foreach (string i in comparison_object.CommonPredicate_ObjectLabel)
            //{
            //    result += "'" + i + "',";

            //}

            result += "],";

            for (int i = 0; i < (comparison_object.CommonPredicate_SubjectLabel.Count); i++)
            {
                string labelReplaced = comparison_object.CommonPredicate_SubjectLabel[i].Replace("'", @"\'");
                result += "'" + labelReplaced + "':{";

                foreach (ComparisonElement y in comparison_object.ComparisonElement)
                {

                    result += "'" + y.ElementLabel + "':[";

                    foreach (string x in y.CommonPredicateObject_String[i])
                    {
                        string xreplaced = x ;
                        if (x.Contains("'"))
                         xreplaced = x.Replace("'",@"\'");
                        result += (x == y.CommonPredicateObject_String[i][y.CommonPredicateObject_String[i].Count - 1]) ? "'" + xreplaced + "'" : "'" + xreplaced + "',";
                    }

                    result += ( y == comparison_object.ComparisonElement[comparison_object.ComparisonElement.Count-1] )? "]" :  "]," ;
                }
                result += (i == comparison_object.CommonPredicate_SubjectLabel.Count -1 ) ? "}":"},";
            }

            //for (int i = 0; i < (comparison_object.CommonPredicate_Object.Count); i++)
            //{
            //    result += "'" + comparison_object.CommonPredicate_ObjectLabel[i] + "':{";

            //    foreach (ComparisonElement y in comparison_object.ComparisonElement)
            //    {

            //        result += "'" + y.ElementLabel + "':[";

            //        foreach (string x in y.CommonPredicateSubject_String[i])
            //        {
            //            result += ("'" + x + "',");
            //        }

            //        result = result.Remove(result.Length - 1);
            //        result += "],";
            //    }

            //    result += "},";
            //}
            //result = result.Remove(result.Length - 1);

            result += "}";

            return result;
        }