Difference between revisions of " Code Examples"

From Blazegraph
Jump to: navigation, search
(updated documentation 1.5.2)
 
Line 55: Line 55:
 
|-
 
|-
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalExample.java JournalExample]
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalExample.java JournalExample]
|This example show how to create a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal], register a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree] and perform basic operations on the BTree. The [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] is the right choice when you want a standalone persistence store. When using the  [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] in this manner, you must remember to [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] commit()  your write sets.
+
|This example shows how to create a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal], register a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree] and perform basic operations on the BTree. The [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] is the right choice when you want a standalone persistence store. When using the  [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] in this manner, you must remember to [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal] commit()  your write sets.
 
|-
 
|-
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalReadOnlyTxExample.java JournalReadOnlyTxExample]
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalReadOnlyTxExample.java JournalReadOnlyTxExample]
Line 61: Line 61:
 
|-
 
|-
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalTxExample.java JournalTxExample]
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/JournalTxExample.java JournalTxExample]
|This example show how to create a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal], register a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree], start a transaction, obtain a B+Tree view isolated by that transaction, perform basic operations on the [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree], and commit the transaction.
+
|This example shows how to create a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/Journal.java Journal], register a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree], start a transaction, obtain a B+Tree view isolated by that transaction, perform basic operations on the [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree], and commit the transaction.
 
|-
 
|-
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/ReadWriteIndexExample.java ReadWriteIndexExample]
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/ReadWriteIndexExample.java ReadWriteIndexExample]
Line 70: Line 70:
 
|-
 
|-
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/TempStoreExample.java TempStoreExample]
 
|[https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/samples/com/bigdata/samples/btree/TempStoreExample.java TempStoreExample]
|Sample for for using the [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree] with a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/TemporaryStore.java TemporaryStore].
+
|Sample for using the [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/btree/BTree.java BTree] with a [https://github.com/SYSTAP/bigdata/blob/6ed51f02efd2d9a2364c9042661284390f1fd675/bigdata/src/java/com/bigdata/journal/TemporaryStore.java TemporaryStore].
 
|}
 
|}

Revision as of 11:55, 3 August 2015

Various test cases located in bigdata/src/test, bigdata-rdf/src/test, bigdata-sail/src/test packages could be useful for you as code examples demonstrating using Blazegraph in different situations.

For example:

Class Name Description
SampleCode Demonstrate how to use bigdata. You are free to use this code for whatever purpose without restriction.
SparqlBuilder Demonstrate how to use bigdata. You are free to use this code for whatever purpose without restriction.
NSSEmbeddedExample Class demonstrates how to start the NanoSparqlServer from within embedded code.
TestAccessPaths Test suite for LexiconRelation newAccessPath(IIndexManager, IPredicate, IKeyOrder).
TestAddTerms Test suite for adding terms to the lexicon.
TestFullTextIndex Test of adding terms with the full text index enabled and of lookup of terms by tokens which appear within those terms.
TestBigdataSailWithQuads Test suite for the BigdataSail with quads enabled. The provenance mode is disabled. Inference is disabled. This version of the test suite uses the pipeline join algorithm.
TestQuadsAPI Unit tests the quads aspects of the BigdataSail implementation.
TestProvenanceQuery Test suite for high-level query against a graph containing statements about statements.
TestSearchQuery Test suite for high-level query against a graph containing statements about statements.
TestEncodeDecodeValue Test suite for utility class to encode and decode RDF Values for interchange via the REST API.
TestSubqueryPatterns Test suite for translating queries which use subquery constructions
TestTriplePatternBuilder Test suite for building up triple patterns
TestSPO Test suite for the SPO class.
TestSPOAccessPath Test suite for SPOAccessPath.
TestSPORelation Test ability to insert, update, or remove elements from a relation and the ability to select the right access path given a predicate for that relation and query for those elements
JournalExample This example shows how to create a Journal, register a BTree and perform basic operations on the BTree. The Journal is the right choice when you want a standalone persistence store. When using the Journal in this manner, you must remember to Journal commit() your write sets.
JournalReadOnlyTxExample This example illustrates how to safely interact with a zero retention configuration of the RWStore using a mixture of read-only transactions and unisolated index writes.
JournalTxExample This example shows how to create a Journal, register a BTree, start a transaction, obtain a B+Tree view isolated by that transaction, perform basic operations on the BTree, and commit the transaction.
ReadWriteIndexExample This example shows how to wrap a B+Tree with a skin which makes it thread safe for concurrent readers and writers (the underlying B+Tree implementation is already thread-safe for concurrent readers, but is single-threaded for mutation).
ReadWriteIndexTxExample This example shows how to wrap a B+Tree with a skin which makes it thread safe for concurrent readers and writers (the underlying B+Tree implementation is already thread-safe for concurrent readers, but is single-threaded for mutation).
TempStoreExample Sample for using the BTree with a TemporaryStore.