コード例 #1
0
        public void StorageReadWriteSparqlUpdate()
        {
            try
            {
                Options.HttpDebugging = true;

                ReadWriteSparqlConnector readWrite = ReadWriteSparqlTests.GetConnection();

                //Try doing a SPARQL Update LOAD command
                String command = "LOAD <http://dbpedia.org/resource/Ilkeston> INTO GRAPH <http://example.org/Ilson>";
                readWrite.Update(command);

                //Then see if we can retrieve the newly loaded graph
                IGraph g = new Graph();
                readWrite.LoadGraph(g, "http://example.org/Ilson");
                Assert.IsFalse(g.IsEmpty, "Graph should be non-empty");
                foreach (Triple t in g.Triples)
                {
                    Console.WriteLine(t.ToString(this._formatter));
                }
                Console.WriteLine();

                //Try a DROP Graph to see if that works
                command = "DROP GRAPH <http://example.org/Ilson>";
                readWrite.Update(command);

                g = new Graph();
                readWrite.LoadGraph(g, "http://example.org/Ilson");
                Assert.IsTrue(g.IsEmpty, "Graph should be empty as it should have been DROPped by ReadWriteSparql");
            }
            finally
            {
                Options.HttpDebugging = false;
            }
        }
コード例 #2
0
        public void StorageReadWriteSparqlUpdate()
        {
            if (!TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseRemoteParsing))
            {
                throw new SkipTestException("Test Config marks Remote Parsing as unavailable, test cannot be run");
            }

            try
            {
                Options.HttpDebugging = true;

                ReadWriteSparqlConnector readWrite = ReadWriteSparqlTests.GetConnection();

                //Try doing a SPARQL Update LOAD command
                String command = "LOAD <http://dbpedia.org/resource/Ilkeston> INTO GRAPH <http://example.org/Ilson>";
                readWrite.Update(command);

                //Then see if we can retrieve the newly loaded graph
                IGraph g = new Graph();
                readWrite.LoadGraph(g, "http://example.org/Ilson");
                Assert.False(g.IsEmpty, "Graph should be non-empty");
                foreach (Triple t in g.Triples)
                {
                    Console.WriteLine(t.ToString(this._formatter));
                }
                Console.WriteLine();

                //Try a DROP Graph to see if that works
                command = "DROP GRAPH <http://example.org/Ilson>";
                readWrite.Update(command);

                g = new Graph();
                readWrite.LoadGraph(g, "http://example.org/Ilson");
                Assert.True(g.IsEmpty, "Graph should be empty as it should have been DROPped by ReadWriteSparql");
            }
            finally
            {
                Options.HttpDebugging = false;
            }
        }