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() { userName = "******"; password = "******"; testCatalogName = "chainyi"; testRepoName = "TestCsharpclient"; ags = new AllegroGraphServer("172.16.2.21", 10035, userName, password); catalog = ags.OpenCatalog(testCatalogName); buildDate = "February 13, 2012 16:42:07 GMT-0800"; version = "4.5"; }
public void SetUp() { AllegroGraphServer server = new AllegroGraphServer(HOST, 10035, USERNAME, PASSWORD); Catalog cata = server.OpenCatalog(CATALOG); repo = cata.GetRepository(REPOSITORY); }
static void Main(string[] args) { /*AGServerInfo info = new AGServerInfo("http://172.16.2.21:10035", "chainyi", "chainyi123"); AGClient.Mini.AGClient client = new AGClient.Mini.AGClient(info); Console.WriteLine("VERSION = " + client.GetVersion()); foreach (string catalog in client.ListCatalogs()) { Console.WriteLine(catalog); } Console.WriteLine(); AGCatalog cat = new AGCatalog(info, "chainyi"); AGRepository repo = cat.OpenRepository("CSharpClient"); int size = repo.GetSize(null); Console.WriteLine(size); repo.AddStatements(new string[1][] { new string[3] { "<http://example.org/node>", "<http://example.org/pred>", "\"object-literal\"" }}); Console.WriteLine(repo.GetSize(null)); repo.DeleteMatchingStatements("<http://example.org/node>", null, null, null); Console.WriteLine(repo.GetSize(null)); repo.AddStatements(new string[1][] { new string[3] { "<http://example.org/node>", "<http://example.org/pred>", "<http://example.org/object>" }}); Console.WriteLine(repo.GetSize(null)); repo.DeleteStatements(new string[1][] { new string[3] { "<http://example.org/node>", "<http://example.org/pred>", "<http://example.org/object>" } }); Console.WriteLine(repo.GetSize(null)); */ /* string[][] quads = new string[1000][]; int l = 0; for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) for (int k = 0; k < 10; ++k) { string subj = "<http://example.org/node" + i + ">"; string pred = "<http://example.org/pred" + j + ">"; string obj = "<http://example.org/obj" + k + ">"; quads[l++] = new string[3] { subj, pred, obj }; } repo.AddStatements(quads); Console.WriteLine(repo.GetSize(null)); repo.DeleteStatements(quads); Console.WriteLine(repo.GetSize(null)); string[][] resarr = repo.GetStatements(new string[] { "<http://example.org/node0>", "<http://example.org/node1>" }, null, null, null); for (int i = 0; i < resarr.Length; ++i) { for (int j = 0; j < resarr[i].Length; ++j) Console.Write(resarr[i][j] + " "); Console.WriteLine(); } string query = "select ?s ?p ?o where { ?s ?p ?o . FILTER (?s = <http://example.org/node0>) }"; Console.WriteLine("query = " + query); DataTable dt = repo.EvalSPARQLQuery(query); //Console.WriteLine(queryres); foreach (DataColumn dc in dt.Columns) Console.Write(dc.ColumnName + "\t"); Console.WriteLine(); foreach (DataRow dr in dt.Rows) { foreach (DataColumn dc in dt.Columns) Console.Write(dr[dc] + " "); Console.WriteLine(); }*/ //AllegroGraphServer server = new AllegroGraphServer("172.16.2.21", 10035, "chainyi", "chainyi123"); //Catalog ca = server.OpenCatalog("chainyi"); //Repository re = ca.GetRepository("CSClient2"); //RepositoryConnection conn = re.GetConnection(); //Console.WriteLine("size=" + conn.GetSize()); //string type = "spogi"; //conn.AddIndex(type); //string[] indices = conn.ListIndices(); //indices = conn.ListValidIndices(); //conn.DropIndex(type); AllegroGraphServer server = new AllegroGraphServer(HOST, 10035, USERNAME, PASSWORD); Catalog cata = server.OpenCatalog(CATALOG); Repository repo = cata.GetRepository(REPOSITORY); RepositoryConnection repoConn = repo.GetConnection(); //repoConn.OpenSession("<" + CATALOG + ":" + REPOSITORY + ">"); //List<Namespace> spaces = repoConn.GetNamespaces(); //Console.WriteLine(spaces.Count); //foreach (var space in spaces) //{ // Console.WriteLine(space.Prefix + "\t" + space.NameSpace); //} //Console.WriteLine(repoConn.GetNamespaces("csharptest2")); //repoConn.CloseSession(); //string geoType = repoConn.SetSphericalGeoType(2); //Console.Write(geoType); repoConn.GetMiniRepository().DeleteStatementsById(new string[] {"272" }); }