public void SetUp() { AllegroGraphServer server = new AllegroGraphServer(HOST, 10035, USERNAME, PASSWORD); Catalog cata = server.OpenCatalog(CATALOG); repo = cata.GetRepository(REPOSITORY); repoConn = repo.GetConnection(); statement = new Statement("<http://example/test?abc=1&def=2>", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#value>", "<http://example/test?abc=1&def=2>", "<http://example/test?client=Csharp>", "85"); //Console.WriteLine(repo.Url); }
public void init() { BaseUrl = "http://172.16.2.21:10035"; Username = "******"; Password = "******"; server = new AGServerInfo(BaseUrl, Username, Password); catalog = new AGCatalog(server, "chainyi"); TestRepositoryName = "TestCsharpclient"; repository = new AGRepository(catalog, TestRepositoryName); Testnamespace = new Namespace("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); TestIndexName = "gospi"; statement = new Statement("<http://example/test?abc=1&def=2>", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#value>", "<http://example/test?abc=1&def=2>", "<http://example/test?client=Csharp>", "85"); }
public void TestRemoveDuplicateStatements() { Statement statement = new Statement("<http://example/test?abc=1&def=2>", "<http://www.w3.org/1999/02/22-rdf-syntax-ns#value>", "<http://example/test?abc=1&def=9>", "<http://example/test?client=Csharp>", "85"); repoConn.RemoveTriples(null, null, statement.Object, null); string[][] quads = new string[1][] { new string[4] { statement.Subject,statement.Predicate,statement.Object,statement.Context} }; repoConn.AddTriples(quads); repoConn.AddTriples(quads); int preSize = repoConn.GetSize(); repoConn.RemoveDuplicateStatements(); Assert.AreEqual(preSize - 1, repoConn.GetSize()); }
/// <summary> /// Add the supplied statement to the specified contexts in the repository. /// </summary> /// <param name="statement">Statement object</param> /// <param name="contexts">named contexts</param> public void AddStatement(Statement statement) { AddTriple(statement.Subject, statement.Predicate, statement.Object, statement.Context); }
/// <summary> /// Delete a statement in contexts /// </summary> /// <param name="statement">Target statement</param> /// <param name="contexts">Context(named graph)</param> /// <returns>The number of statements deleted</returns> public int RemoveStatement(Statement statement, string[] contexts = null) { return RemoveTriples(statement.Subject, statement.Predicate, statement.Object, contexts); }