Пример #1
0
        public void PelletQuery()
        {
            PelletServer server  = new PelletServer(PelletTestServer);
            Type         svcType = typeof(QueryService);

            foreach (KnowledgeBase kb in server.KnowledgeBases)
            {
                if (kb.SupportsService(svcType))
                {
                    Console.WriteLine(kb.Name + " supports SPARQL Query");
                    QueryService q       = (QueryService)kb.GetService(svcType);
                    Object       results = q.Query("SELECT * WHERE {?s a ?type} LIMIT 10");
                    if (results is SparqlResultSet)
                    {
                        TestTools.ShowResults(results);
                    }
                    else
                    {
                        Console.WriteLine("Unexpected Result type from Query Service");
                    }
                }
                else
                {
                    Console.WriteLine(kb.Name + " does not support the Query Service");
                }
                Console.WriteLine();
            }
        }