public void TestBitwiseAnd() { var storeName = "TestBitwiseAnd_" + DateTime.Now.Ticks; _client.CreateStore(storeName); var job = _client.ExecuteTransaction(storeName, new UpdateTransactionData { InsertData = _testData }); TestHelper.AssertJobCompletesSuccessfully(_client, storeName, job); var results = _client.ExecuteQuery(storeName, @"PREFIX bsfunc: <http://brightstardb.com/.well-known/sparql/functions/> SELECT ?s WHERE { ?s <http://example.org/p1> ?p1 ; <http://example.org/p2> ?p2 . FILTER (bsfunc:bit_and(?p1, ?p2) = 1) }"); var resultsDoc = XDocument.Load(results); Assert.AreEqual(1, resultsDoc.SparqlResultRows().Count()); var row = resultsDoc.SparqlResultRows().First(); Assert.AreEqual("http://example.org/y", row.GetColumnValue("s").ToString()); }
public void TestCreateStore() { //var storeName = "TestCreate-" + DateTime.Now.Ticks; var storeName = Guid.NewGuid().ToString(); _client.CreateStore(storeName); var stores = _client.ListStores(); Assert.IsNotNull(stores); Assert.IsTrue(stores.Contains(storeName), "Did not find newly created store in call to ListStores"); }
public StoresModule(IBrightstarService brightstarService, AbstractSystemPermissionsProvider systemPermissionsProvider) { this.RequiresBrightstarSystemPermission(systemPermissionsProvider, get:SystemPermissions.ListStores, post:SystemPermissions.CreateStore); Get["/"] = parameters => { ViewBag.Title = "Stores"; var stores = brightstarService.ListStores(); return Negotiate.WithModel(new StoresResponseModel { Stores = stores.ToList() }); }; Post["/"] = parameters => { ViewBag.Title = "Stores"; var request = this.Bind<CreateStoreRequestObject>(); if (request == null || String.IsNullOrEmpty(request.StoreName)) { return HttpStatusCode.BadRequest; } // Return 409 Conflict if attempt to create a store with a name that is currently in use if (brightstarService.DoesStoreExist(request.StoreName)) { return HttpStatusCode.Conflict; } // Attempt to create the store try { PersistenceType? storePersistenceType = request.GetBrightstarPersistenceType(); if (storePersistenceType.HasValue) { brightstarService.CreateStore(request.StoreName, storePersistenceType.Value); } else { brightstarService.CreateStore(request.StoreName); } } catch (ArgumentException) { return HttpStatusCode.BadRequest; } return Negotiate.WithModel(new StoreResponseModel(request.StoreName)) .WithStatusCode(HttpStatusCode.Created); }; }
public StoresModule(IBrightstarService brightstarService, AbstractSystemPermissionsProvider systemPermissionsProvider) { this.RequiresBrightstarSystemPermission(systemPermissionsProvider, get: SystemPermissions.ListStores, post: SystemPermissions.CreateStore); Get["/"] = parameters => { ViewBag.Title = "Stores"; var stores = brightstarService.ListStores(); return (Negotiate.WithModel(new StoresResponseModel { Stores = stores.ToList() })); }; Post["/"] = parameters => { ViewBag.Title = "Stores"; var request = this.Bind <CreateStoreRequestObject>(); if (request == null || String.IsNullOrEmpty(request.StoreName)) { return(HttpStatusCode.BadRequest); } // Return 409 Conflict if attempt to create a store with a name that is currently in use if (brightstarService.DoesStoreExist(request.StoreName)) { return(HttpStatusCode.Conflict); } // Attempt to create the store try { PersistenceType?storePersistenceType = request.GetBrightstarPersistenceType(); if (storePersistenceType.HasValue) { brightstarService.CreateStore(request.StoreName, storePersistenceType.Value); } else { brightstarService.CreateStore(request.StoreName); } } catch (ArgumentException) { return(HttpStatusCode.BadRequest); } return (Negotiate.WithModel(new StoreResponseModel(request.StoreName)) .WithStatusCode(HttpStatusCode.Created)); }; }
private string CreateStore(string prefix) { var storeName = prefix + DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture); _client.CreateStore(storeName); return(storeName); }
/// <summary> /// Creates a new store. /// </summary> /// <param name="storeName">The name of the store to create</param> /// <param name="namespaceMappings">A collection of prefix to URI mappings to enable CURIEs to be used for resource addresses instead of full URIs</param> /// <param name="optimisticLockingEnabled">A boolean flag indicating if optimistic locking should be enabled</param> /// <param name="persistenceType">The type of persistence to use in the newly created store. If not specified, defaults to the value specified in the application configuration file or <see cref="PersistenceType.AppendOnly"/></param> /// <returns>The newly created data object store</returns> public IDataObjectStore CreateStore(string storeName, Dictionary <string, string> namespaceMappings, bool?optimisticLockingEnabled = null, PersistenceType?persistenceType = null) { Client.CreateStore(storeName, persistenceType.HasValue ? persistenceType.Value : Configuration.PersistenceType); return(new RestDataObjectStore( _connectionString, storeName, namespaceMappings, optimisticLockingEnabled.HasValue ? optimisticLockingEnabled.Value : _optimisticLockingEnabled)); }
/// <summary> /// Creates a new store. /// </summary> /// <param name="storeName">The name of the store to create</param> /// <param name="namespaceMappings">A collection of prefix to URI mappings to enable CURIEs to be used for resource addresses instead of full URIs</param> /// <param name="optimisticLockingEnabled">A boolean flag indicating if optimistic locking should be enabled</param> /// <returns>The newly created data object store</returns> public IDataObjectStore CreateStore(string storeName, Dictionary <string, string> namespaceMappings = null, bool?optimisticLockingEnabled = new bool?(), PersistenceType?persistenceType = null) { // For now persistenceType is ignored, and the store is always an append-only store to match the way the block provider works _client.CreateStore(storeName); return(new BrightstarClusterDataObjectStore(storeName, namespaceMappings, optimisticLockingEnabled.HasValue ? optimisticLockingEnabled.Value : _optimisticLockingEnabled)); }
public void Run() { _brightstar.CreateStore(_storeName, PersistenceType.AppendOnly); for (int i = 0; i < SourceFiles.Length; i++) { ImportSourceFile(i); VerifyTriples(_triplesImported); } WaitForAllExportsToComplete(); }
/// <summary> /// Creates a new store. /// </summary> /// <param name="storeName">The name of the store to create</param> /// <param name="namespaceMappings">A collection of prefix to URI mappings to enable CURIEs to be used for resource addresses instead of full URIs</param> /// <param name="optimisticLockingEnabled">A boolean flag indicating if optimistic locking should be enabled</param> /// <param name="persistenceType">The type of persistence to use in the newly created store. If not specified, defaults to the value specified in the application configuration file or <see cref="PersistenceType.AppendOnly"/></param> /// <param name="updateGraph">OPTIONAL: The URI identifier of the graph to be updated with any new triples created by operations on the store. If /// not defined, the default graph in the store will be updated.</param> /// <param name="versionTrackingGraph">OPTIONAL: The URI identifier of the graph that contains version number statements for data objects. /// If not defined, the <paramref name="updateGraph"/> will be used.</param> /// <returns>The newly created data object store</returns> public IDataObjectStore CreateStore(string storeName, Dictionary <string, string> namespaceMappings, bool?optimisticLockingEnabled = null, PersistenceType?persistenceType = null, string updateGraph = null, string versionTrackingGraph = null) { Client.CreateStore(storeName, persistenceType.HasValue ? persistenceType.Value : Configuration.PersistenceType); if (String.IsNullOrEmpty(updateGraph)) { updateGraph = Constants.DefaultGraphUri; } if (String.IsNullOrEmpty(versionTrackingGraph)) { versionTrackingGraph = updateGraph; } return(new RestDataObjectStore( _connectionString, storeName, namespaceMappings, optimisticLockingEnabled.HasValue ? optimisticLockingEnabled.Value : _optimisticLockingEnabled, updateGraph, new string[] { updateGraph }, versionTrackingGraph)); }
private static string CreateTestStore(IBrightstarService client) { var storeName = "CommitPointsTest_" +DateTime.Now.ToString("yyyyMMdd_HHmmss"); client.CreateStore(storeName); // These are the different triple sets to add const string addSet1 = "<http://example.org/people/alice> <http://www.w3.org/2000/01/rdf-schema#label> \"Alice\"."; const string addSet2 = "<http://example.org/people/bob> <http://www.w3.org/2000/01/rdf-schema#label> \"Bob\"."; const string addSet3 = "<http://example.org/people/carol> <http://www.w3.org/2000/01/rdf-schema#label> \"Carol\"."; // Transaction 1: Add Alice client.ExecuteTransaction(storeName, null, null, addSet1); // Transaction 2 : Add Bob client.ExecuteTransaction(storeName, null, null, addSet2); // Transaction 3 : Add Carol client.ExecuteTransaction(storeName, null, null, addSet3); return storeName; }
private static string CreateTestStore(IBrightstarService client) { var storeName = "CommitPointsTest_" + DateTime.Now.ToString("yyyyMMdd_HHmmss"); client.CreateStore(storeName); // These are the different triple sets to add const string addSet1 = "<http://example.org/people/alice> <http://www.w3.org/2000/01/rdf-schema#label> \"Alice\"."; const string addSet2 = "<http://example.org/people/bob> <http://www.w3.org/2000/01/rdf-schema#label> \"Bob\"."; const string addSet3 = "<http://example.org/people/carol> <http://www.w3.org/2000/01/rdf-schema#label> \"Carol\"."; // Transaction 1: Add Alice client.ExecuteTransaction(storeName, null, null, addSet1); // Transaction 2 : Add Bob client.ExecuteTransaction(storeName, null, null, addSet2); // Transaction 3 : Add Carol client.ExecuteTransaction(storeName, null, null, addSet3); return(storeName); }
public void CreateStore() { _storeName = Guid.NewGuid().ToString(); _service.CreateStore(_storeName); }
public BrightstarTest() { Client.CreateStore("test", PersistenceType.Rewrite); }