Release 1.13 Kal Ahmed, Graham Moore
Total Page:16
File Type:pdf, Size:1020Kb
BrightstarDB Documentation Release 1.13 Kal Ahmed, Graham Moore January 08, 2016 Contents 1 Getting Started 1 1.1 Architect.................................................1 1.2 Data....................................................1 1.3 Developer.................................................1 2 Concepts 3 2.1 Architecture...............................................3 2.2 Data Model................................................4 2.3 Storage Features.............................................5 2.4 Client APIs................................................5 2.5 Supported RDF Syntaxes........................................5 3 Why BrightstarDB? 7 3.1 An Associative Model..........................................7 3.2 Schema-less Data Store.........................................7 3.3 A Semantic Data Model.........................................7 3.4 Automatic Data caching.........................................8 3.5 Full Historical Capabilities........................................8 3.6 Developer Friendly Toolset.......................................8 3.7 Native .NET Semantic Web Database..................................8 3.8 RDF is great for powering Object Oriented solutions..........................8 4 Developing With BrightstarDB9 5 Developer Quick Start 11 5.1 Create New Project............................................ 11 5.2 Create the Model............................................. 12 5.3 Generating the Context and Classes................................... 13 5.4 Using the Context............................................ 13 5.5 Optimistic Locking............................................ 15 5.6 Server Side Caching........................................... 16 5.7 What Next?................................................ 16 6 Connection Strings 17 7 Store Persistence Types 19 7.1 Append-Only............................................... 19 7.2 Rewritable................................................ 19 7.3 Specifying the Store Persistence Type.................................. 20 i 8 Running The BrightstarDB Samples 21 9 Entity Framework 23 9.1 Basics................................................... 23 9.2 Example LINQ Queries......................................... 26 9.3 Annotations................................................ 27 9.4 Patterns.................................................. 34 9.5 Behaviour................................................. 35 9.6 Key Properties and Composite Keys................................... 36 9.7 Optimistic Locking............................................ 39 9.8 LINQ Restrictions............................................ 40 9.9 Casting Entities.............................................. 43 9.10 OData................................................... 43 9.11 SavingChanges Event.......................................... 44 9.12 INotifyPropertyChanged and INotifyCollectionChanged Support................... 44 9.13 Graph Targeting............................................. 45 9.14 Roslyn Code Generation......................................... 46 9.15 Generated Class Visibility........................................ 47 10 Entity Framework Samples 49 10.1 Tweetbox................................................. 49 10.2 MVC Nerd Dinner............................................ 52 10.3 Mapping to Existing RDF Data..................................... 98 11 Advanced Entity Framework 101 11.1 Filter Optimization............................................ 101 11.2 Custom Queries............................................. 102 11.3 Custom SPARQL Protocol........................................ 102 11.4 Custom Type Mappings......................................... 102 12 Data Object Layer 103 12.1 Creating a Data Object Context..................................... 103 12.2 Using the IDataObjectContext...................................... 103 12.3 Working With Data Objects....................................... 104 12.4 Namespace Mappings.......................................... 106 12.5 Querying data using SPARQL...................................... 106 12.6 Binding SPARQL Results To Data Objects............................... 106 12.7 Optimistic Locking in the Data Object Layer.............................. 107 12.8 Graph Targeting in the Data Object API................................. 107 13 Dynamic API 111 13.1 Dynamic Context............................................. 111 13.2 Dynamic Object............................................. 111 13.3 Saving Changes............................................. 112 13.4 Loading Data............................................... 112 13.5 Sample Program............................................. 112 14 RDF Client API 115 14.1 Creating a client............................................. 115 14.2 Creating a Store............................................. 115 14.3 Deleting a Store............................................. 115 14.4 Jobs and IJobInfo............................................. 115 14.5 Transactional Update........................................... 116 14.6 Data Types................................................ 118 14.7 Updating Graphs............................................. 118 ii 14.8 Querying data using SPARQL...................................... 119 14.9 Querying Graphs............................................. 119 14.10 Using extension methods......................................... 120 14.11 Update data using SPARQL....................................... 120 14.12 Data Imports............................................... 121 14.13 Data Exports............................................... 121 14.14 Introduction To N-Triples........................................ 122 14.15 Introduction To SPARQL........................................ 122 15 Admin API 125 15.1 Jobs.................................................... 125 15.2 Commit Points.............................................. 126 15.3 Reverting The Store........................................... 127 15.4 Consolidating The Store......................................... 128 15.5 Creating Store Snapshots......................................... 128 15.6 Store Statistics.............................................. 129 16 HTTP API 131 16.1 Swagger API Documentation...................................... 131 16.2 Supported Media Types......................................... 131 16.3 Stores Resource............................................. 132 16.4 Store Resource.............................................. 132 16.5 SPARQL Query Endpoint........................................ 133 16.6 SPARQL Update Endpoint........................................ 134 16.7 Graphs Resource............................................. 134 16.8 Job List Resource............................................ 136 16.9 Job Resource............................................... 140 16.10 Commit Points Resource......................................... 141 16.11 Statistics List Resource.......................................... 142 16.12 Latest Statistics Resource........................................ 143 17 Concurrency and Multi-threading 145 17.1 Concurrent Access to Stores....................................... 145 17.2 Thread-safety............................................... 145 18 Developing Portable Apps 147 18.1 Supported Platforms........................................... 147 18.2 Including BrightstarDB In Your Project................................. 147 18.3 API Changes............................................... 148 18.4 Platform Notes.............................................. 148 18.5 BrightstarDB Database Portability.................................... 150 18.6 Acknowledgment............................................. 150 19 Connecting to Other Stores 151 19.1 Store Requirements........................................... 151 19.2 Configuration and Connection Strings.................................. 151 19.3 Differences to BrightstarDB Connections................................ 152 19.4 Example Configurations......................................... 153 20 API Documentation 155 21 BrightstarDB Security 157 21.1 Access Control.............................................. 157 21.2 Authentication.............................................. 158 21.3 Authorization............................................... 159 iii 22 Running BrightstarDB 161 22.1 Namespace Reservation......................................... 161 22.2 Running BrightstarDB as a Windows Service.............................. 161 22.3 Running BrightstarDB as an Application................................ 161 22.4 Running BrightstarDB In IIS....................................... 162 22.5 Running BrightstarDB in Docker.................................... 162 22.6 BrightstarDB Service Configuration................................... 162 22.7 Configuring Caching........................................... 169 22.8 Configuring Logging........................................... 170 22.9 Preloading Stores............................................. 170 22.10 Transaction Logging........................................... 172 23 SPARQL Endpoint 175 23.1 Query................................................... 175 23.2 Update.................................................. 175 23.3 Graph Store Protocol........................................... 175 23.4 SPARQL Result Formats......................................... 176 23.5 Further Reading............................................. 176 24 Polaris Management Tool 177