77
88## Overview
99
10+ ** GraphDB and embedded Jena TDB triplestores support is deprecated** since
11+ [ v20.1.1] ( https://github.com/dasch-swiss/dsp-api/releases/tag/v20.1.1 ) of DSP-API.
12+
1013The store module houses the different types of data stores supported by
1114Knora. At the moment, only triplestores and IIIF servers (Sipi) are supported.
1215The triplestore support is implemented in the
@@ -20,170 +23,16 @@ which is started when Knora starts. The `StoreManager` then starts the
2023` TriplestoreManager ` and ` IIIFManager ` , which each in turn starts their
2124correct actor implementation.
2225
23- ## HTTP-based Triplestores
24-
25- HTTP-based triplestore support is implemented in the
26- ` org.knora.webapi.triplestore.http ` package.
27-
28- An HTTP-based triplestore is one that is accessed remotely over the HTTP
29- protocol. ` HttpTriplestoreConnector ` supports the open source triplestore
30- - [ Apache Jena Fuseki] ( https://jena.apache.org ) .
31-
32- ### Apache Jena Fuseki
33-
34- ## Embedded Triplestores
35-
36- Embedded triplestores are implemented in the
37- ` org.knora.webapi.triplestore.embedded ` package.
38-
39- An embedded triplestore is one that runs in the same JVM as the Knora
40- API server.
41-
42- ### Apache Jena TDB
43-
44- The support for embedded Jena TDB is currently dropped. The
45- documentation and the code will remain in the repository. You can use it
46- at your own risk.
47-
48- The support for the embedded Jena-TDB triplestore is implemented in
49- ` org.knora.webapi.triplestore.embedded.JenaTDBActor ` .
50-
51- The relevant Jena libraries that are used are the following:
52-
53- - Jena API - The library used to work programmatically with RDF data
54- - Jena TDB - Their implementation of a triple store
55-
56- #### Concurrency
57-
58- Jena provides concurrency on different levels.
59-
60- On the Jena TDB level there is the ` Dataset ` object, representing the
61- triple store. On every access, a transaction (read or write) can be
62- started.
63-
64- On the Jena API level there is a ` Model ` object, which is equivalent to
65- an RDF ` Graph ` . Here we can lock the model, so that MRSW (Multiple
66- Reader Single Writer) access is allowed.
67-
68- - < https://jena.apache.org/documentation/tdb/tdb_transactions.html >
69- - < https://jena.apache.org/documentation/notes/concurrency-howto.html >
26+ ## Triplestores
7027
71- #### Implementation
28+ Currently, the only supported triplestore is [ Apache Jena Fuseki ] ( https://jena.apache.org ) , a HTTP-based triplestore.
7229
73- We employ transactions on the ` Dataset ` level. This means that every
74- thread that accesses the triplestore, starts a read or write enabled
75- transaction.
30+ HTTP-based triplestore support is implemented in the ` org.knora.webapi.triplestore.http ` package.
7631
77- The transaction mechanism in TDB is based on write-ahead-logging. All
78- changes made inside a write-transaction are written to journals, then
79- propagated to the main database at a suitable moment. This design allows
80- for read-transactions to proceed without locking or other overhead over
81- the base database.
82-
83- Transactional TDB supports one active write transaction, and multiple
84- read transactions at the same time. Read-transactions started before a
85- write-transaction commits see the database in a state without any
86- changes visible. Any transaction starting after a write-transaction
87- commits sees the database with the changes visible, whether fully
88- propagates back to the database or not. There can be active read
89- transactions seeing the state of the database before the updates, and
90- read transactions seeing the state of the database after the updates
91- running at the same time.
92-
93- #### Configuration
94-
95- In ` application.conf ` set to use the embedded triplestore:
96-
97- ```
98- triplestore {
99- dbtype = "embedded-jena-tdb"
100-
101- embedded-jena-tdb {
102- persisted = true // "false" -> memory, "true" -> disk
103- loadExistingData = false // "false" -> use data if exists, "false" -> create a fresh store
104- storage-path = "_TMP" // ignored if "memory"
105- }
106-
107- reload-on-start = false // ignored if "memory" as it will always reload
108-
109- rdf-data = [
110- {
111- path = "knora-ontologies/knora-base.ttl"
112- name = "http://www.knora.org/ontology/knora-base"
113- }
114- {
115- path = "knora-ontologies/salsah-gui.ttl"
116- name = "http://www.knora.org/ontology/salsah-gui"
117- }
118- {
119- path = "test_data/ontologies/incunabula-onto.ttl"
120- name = "http://www.knora.org/ontology/0803/incunabula"
121- }
122- {
123- path = "test_data/demo_data/incunabula-demo-data.ttl"
124- name = "http://www.knora.org/data/incunabula"
125- }
126- {
127- path = "test_data/ontologies/images-onto.ttl"
128- name = "http://www.knora.org/ontology/0804/dokubib"
129- }
130- {
131- path = "test_data/demo_data/images-demo-data.ttl"
132- name = "http://www.knora.org/data/dokubib"
133- }
134- ]
135- }
136- ```
137-
138- Here the storage is set to ` persistent ` , meaning that a Jena TDB store
139- will be created under the defined ` tdb-storage-path ` . The
140- ` reload-on-start ` flag, if set to ` true ` would reload the triplestore
141- with the data referenced in ` rdf-data ` .
142-
143- #### TDB Disk Persisted Store
144-
145- Make sure to set ` reload-on-start ` to ` true ` if run for the first time.
146- This will create a TDB store and load the data.
147-
148- If only * read access* is performed, then Knora can be run once with
149- reloading enabled. After that, reloading can be turned off, and the
150- persisted TDB store can be reused, as any data found under the
151- ` tdb-storage-path ` will be reused.
152-
153- If the TDB storage files get corrupted, then just delete the folder and
154- reload the data anew.
155-
156- #### Actor Messages
157-
158- - ` ResetTripleStoreContent(rdfDataObjects: List[RdfDataObject]) `
159- - ` ResetTripleStoreContentACK() `
160-
161- The embedded Jena TDB can receive reset messages, and will ACK when
162- reloading of the data is finished. ` RdfDataObject ` is a simple case
163- class, containing the path and name (the same as ` rdf-data ` in the
164- config file)
165-
166- As an example, to use it inside a test you could write something like:
167-
168- ``` scala
169- val rdfDataObjects = List (
170- RdfDataObject (path = " knora-ontologies/knora-base.ttl" ,
171- name = " http://www.knora.org/ontology/knora-base" ),
172- RdfDataObject (path = " knora-ontologies/salsah-gui.ttl" ,
173- name = " http://www.knora.org/ontology/salsah-gui" ),
174- RdfDataObject (path = " test_data/ontologies/incunabula-onto.ttl" ,
175- name = " http://www.knora.org/ontology/0803/incunabula" ),
176- RdfDataObject (path = " test_data/all_data/incunabula-data.ttl" ,
177- name = " http://www.knora.org/data/incunabula" )
178- )
32+ An HTTP-based triplestore is one that is accessed remotely over the HTTP
33+ protocol. ` HttpTriplestoreConnector ` supports the open source triplestore [ Apache Jena Fuseki] ( https://jena.apache.org ) .
17934
180- " Reload data " in {
181- storeManager ! ResetTripleStoreContent (rdfDataObjects)
182- expectMsg(300 .seconds, ResetTripleStoreContentACK ())
183- }
184- ```
18535
18636## IIIF Servers
18737
188- Currently, only support for SIPI is implemented in
189- ` org.knora.webapi.store.iiifSipiConnector ` .
38+ Currently, only support for SIPI is implemented in ` org.knora.webapi.store.iiifSipiConnector ` .
0 commit comments