openbel-api 0.6.2-java → 1.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gemspec +11 -14
  3. data/CHANGELOG.md +18 -12
  4. data/README.md +25 -36
  5. data/VERSION +1 -1
  6. data/app/openbel/api/app.rb +13 -12
  7. data/app/openbel/api/config.rb +53 -11
  8. data/app/openbel/api/helpers/{evidence.rb → nanopub.rb} +13 -14
  9. data/app/openbel/api/middleware/auth.rb +22 -29
  10. data/app/openbel/api/resources/annotation.rb +7 -7
  11. data/app/openbel/api/resources/function.rb +12 -35
  12. data/app/openbel/api/resources/namespace.rb +13 -13
  13. data/app/openbel/api/resources/{evidence.rb → nanopub.rb} +23 -23
  14. data/app/openbel/api/resources/{evidence_transform.rb → nanopub_transform.rb} +8 -8
  15. data/app/openbel/api/resources/relationship.rb +74 -0
  16. data/app/openbel/api/routes/annotations.rb +1 -1
  17. data/app/openbel/api/routes/base.rb +11 -7
  18. data/app/openbel/api/routes/datasets.rb +74 -84
  19. data/app/openbel/api/routes/expressions.rb +86 -396
  20. data/app/openbel/api/routes/language.rb +118 -0
  21. data/app/openbel/api/routes/namespaces.rb +2 -2
  22. data/app/openbel/api/routes/{evidence.rb → nanopubs.rb} +68 -69
  23. data/app/openbel/api/routes/root.rb +2 -2
  24. data/app/openbel/api/routes/version.rb +37 -23
  25. data/app/openbel/api/schemas/annotation_resource.schema.json +1 -1
  26. data/app/openbel/api/schemas/{evidence.schema.json → nanopub.schema.json} +10 -10
  27. data/app/openbel/api/schemas/{evidence_collection.schema.json → nanopub_collection.schema.json} +5 -5
  28. data/app/openbel/api/schemas/{evidence_resource.schema.json → nanopub_resource.schema.json} +4 -4
  29. data/config/config.yml +15 -5
  30. data/lib/openbel/api/helpers/uuid_generator.rb +22 -0
  31. data/lib/openbel/api/{evidence → nanopub}/api.rb +9 -9
  32. data/lib/openbel/api/{evidence → nanopub}/facet_api.rb +2 -2
  33. data/lib/openbel/api/{evidence → nanopub}/facet_filter.rb +6 -6
  34. data/lib/openbel/api/{evidence → nanopub}/mongo.rb +54 -52
  35. data/lib/openbel/api/{evidence → nanopub}/mongo_facet.rb +17 -28
  36. data/lib/openbel/api/plugin/{evidence/evidence.rb → nanopub/nanopub.rb} +7 -7
  37. metadata +44 -56
  38. data/app/openbel/api/routes/functions.rb +0 -41
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6bcf575f4340f45cbe5e89d6dac75acff1ddf359
4
- data.tar.gz: efdf772df684ef6926fccac408fc7dff0adbdd19
3
+ metadata.gz: 4df60f72d77dbb37e32d9f9fb7d9c6dbcd21f836
4
+ data.tar.gz: a48d473b49a7b09a9569e747dcd8f8cdca228ca8
5
5
  SHA512:
6
- metadata.gz: a34194c1df9d2e44105833471dac6ab1c2c53ea1155d6e9ce6cd2015202a27c1fb38b1dbc6e81ebd369605ccea0a0892f5b26c064d8982a7735d8583db56acac
7
- data.tar.gz: 5005874c63134c908d5da718f532e756a85daa492220b28fa20e08766292c5a1f0bb288ca7c3e8f1a6472ad6347deac3a782e743a482b3ebd5d0ee92085ba8cf
6
+ metadata.gz: ce3f3a1adf0daf1bbc6ec420900741b3c5c3d1aaa226520d2f9ec2984d0e0b17b583b3e0daefc0735d79380c64cf9b0503f27b7c9f32860b21f5c797161c1048
7
+ data.tar.gz: 43820b24697b0ed4c2171f12e8749d41578a55af7815055e19727aa94d32a5cadd864dbd37269583ab91b3f02c5892bb3afe78fd619144a7708757e222ae3227
data/.gemspec CHANGED
@@ -34,27 +34,24 @@ Gem::Specification.new do |spec|
34
34
  # Dependencies
35
35
 
36
36
  ## bel.rb
37
- spec.add_runtime_dependency 'bel', '0.6.0'
37
+ spec.add_runtime_dependency 'bel', '~> 1.0.0'
38
38
 
39
39
  ## bel.rb translator dependencies
40
- spec.add_runtime_dependency 'json-ld', '1.99.0'
41
- spec.add_runtime_dependency 'rdf-json', '1.99.0'
42
- spec.add_runtime_dependency 'rdf-rdfa', '1.99.0'
43
- spec.add_runtime_dependency 'rdf-rdfxml', '1.99.0'
44
- spec.add_runtime_dependency 'rdf-trig', '1.99.0.1'
45
- spec.add_runtime_dependency 'rdf-trix', '1.99.0'
46
- spec.add_runtime_dependency 'rdf-turtle', '1.99.0'
40
+ spec.add_runtime_dependency 'json-ld', '2.0.0'
41
+ spec.add_runtime_dependency 'rdf-json', '2.0.0'
42
+ spec.add_runtime_dependency 'rdf-rdfa', '2.0.0'
43
+ spec.add_runtime_dependency 'rdf-rdfxml', '2.0.0'
44
+ spec.add_runtime_dependency 'rdf-trig', '2.0.0'
45
+ spec.add_runtime_dependency 'rdf-trix', '2.0.0'
46
+ spec.add_runtime_dependency 'rdf-turtle', '2.0.0'
47
47
 
48
48
  ## bel.rb plugin - annotation/namespace search
49
- spec.add_runtime_dependency 'bel-search-sqlite', '0.4.2'
49
+ spec.add_runtime_dependency 'bel-search-sqlite', '~> 1.0.0.beta'
50
50
 
51
51
  ## bel.rb plugin - RDF repository using Apache Jena
52
- spec.add_runtime_dependency 'bel-rdf-jena', '0.4.2'
52
+ spec.add_runtime_dependency 'bel-rdf-jena', '~> 1.0.0.beta'
53
53
 
54
- ## RDF - RDF abstraction
55
- spec.add_runtime_dependency 'rdf', '1.99.1'
56
-
57
- ## Mongo - Faceted search of evidence.
54
+ ## Mongo - Faceted search of nanopub.
58
55
  spec.add_runtime_dependency 'mongo', '1.12.5'
59
56
  spec.add_runtime_dependency 'bson', '1.12.5'
60
57
 
@@ -3,6 +3,10 @@ All notable changes to openbel-api will be documented in this file. The curated
3
3
 
4
4
  This project adheres to [Semantic Versioning][Semantic Versioning].
5
5
 
6
+ ## [1.0.0][1.0.0] - TBD
7
+ ### Added
8
+ - Support JWT authentication via *token* query parameter ([PR #108][108]).
9
+
6
10
  ## [0.6.2][0.6.2] - 2016-03-23
7
11
  ### Fixed
8
12
  - Missing authorization header reported when header is malformed ([Issue #105][105]).
@@ -13,12 +17,12 @@ This project adheres to [Semantic Versioning][Semantic Versioning].
13
17
 
14
18
  ## [0.6.0][0.6.0] - 2016-03-16
15
19
  ### Added
16
- - Retrieve evidence in a format supported by BEL translator plugins ([Issue 44][44]).
17
- - Retrieve dataset evidence in a format supported by BEL translator plugins ([Issue 99][99]).
20
+ - Retrieve nanopub in a format supported by BEL translator plugins ([Issue 44][44]).
21
+ - Retrieve dataset nanopub in a format supported by BEL translator plugins ([Issue 99][99]).
18
22
 
19
23
  ### Fixed
20
- - Dataset evidence collection is missing annotation/namespace URIs ([Issue 95][95]).
21
- - Facets are not created for evidence uploaded through a dataset.
24
+ - Dataset nanopub collection is missing annotation/namespace URIs ([Issue 95][95]).
25
+ - Facets are not created for nanopub uploaded through a dataset.
22
26
 
23
27
  ### Changed
24
28
  - MongoDB version 3.2.0 is now required due to use of `$slice` operator in Aggregation queries.
@@ -32,7 +36,7 @@ Datasets are stored with a URI computed from the scheme and host that is serving
32
36
 
33
37
  ## [0.5.1][0.5.1] - 2015-12-18
34
38
  ### Fixed
35
- - Authentication error for MongoDB user when faceting on `GET /api/evidence` ([Issue #93][93]).
39
+ - Authentication error for MongoDB user when faceting on `GET /api/nanopub` ([Issue #93][93]).
36
40
 
37
41
  ### Changed
38
42
  - MongoDB version 3.2.0 is now required due to use of `$slice` operator in Aggregation queries ([Issue ?][]).
@@ -56,12 +60,12 @@ Datasets are stored with a URI computed from the scheme and host that is serving
56
60
 
57
61
  ## 0.4.0 - 2015-12-14
58
62
  ### Added
59
- - Evidence Store
60
- - Storage of evidence including creation, retrieval, modification, and deletion actions.
61
- - Flexible filtering of stored, evidence based on user's custom data requirements.
62
- - Upload a document (e.g. BEL script, XBEL, or Evidence JSON), to the Evidence Store, as a dataset. These can later be retrieved or deleted from the Evidence Store.
63
- - Flexible filtering of evidence contained within a dataset.
64
- - Download a document (e.g. BEL script, XBEL, or Evidence JSON) from a dataset.
63
+ - Nanopub Store
64
+ - Storage of nanopub including creation, retrieval, modification, and deletion actions.
65
+ - Flexible filtering of stored, nanopub based on user's custom data requirements.
66
+ - Upload a document (e.g. BEL script, XBEL, or Nanopub JSON), to the Nanopub Store, as a dataset. These can later be retrieved or deleted from the Nanopub Store.
67
+ - Flexible filtering of nanopub contained within a dataset.
68
+ - Download a document (e.g. BEL script, XBEL, or Nanopub JSON) from a dataset.
65
69
  - BEL Expressions
66
70
  - Autocomplete a BEL term expression.
67
71
  - Retrieve the structural components of a BEL expression.
@@ -70,13 +74,14 @@ Datasets are stored with a URI computed from the scheme and host that is serving
70
74
  - Retrieve equivalent namespace values from the individual.
71
75
  - Retrieve orthologous namespace values from the individual.
72
76
 
77
+ [1.0.0]: https://github.com/OpenBEL/openbel-api/compare/0.6.2...1.0.0
73
78
  [0.6.2]: https://github.com/OpenBEL/openbel-api/compare/0.6.1...0.6.2
74
79
  [0.6.1]: https://github.com/OpenBEL/openbel-api/compare/0.6.0...0.6.1
75
80
  [0.6.0]: https://github.com/OpenBEL/openbel-api/compare/0.5.1...0.6.0
76
81
  [0.5.1]: https://github.com/OpenBEL/openbel-api/compare/0.5.0...0.5.1
77
82
  [0.5.0]: https://github.com/OpenBEL/openbel-api/compare/0.4.0...0.5.0
78
83
  [Semantic Versioning]: http://semver.org
79
- [MongoDB User Authentication]: https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Evidence-Store#mongodb-user-authentication
84
+ [MongoDB User Authentication]: https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Nanopub-Store#mongodb-user-authentication
80
85
  [44]: https://github.com/OpenBEL/openbel-api/issues/44
81
86
  [91]: https://github.com/OpenBEL/openbel-api/issues/91
82
87
  [92]: https://github.com/OpenBEL/openbel-api/issues/92
@@ -85,3 +90,4 @@ Datasets are stored with a URI computed from the scheme and host that is serving
85
90
  [99]: https://github.com/OpenBEL/openbel-api/issues/99
86
91
  [102]: https://github.com/OpenBEL/openbel-api/issues/102
87
92
  [105]: https://github.com/OpenBEL/openbel-api/issues/105
93
+ [108]: https://github.com/OpenBEL/openbel-api/issues/108
data/README.md CHANGED
@@ -4,12 +4,12 @@ The OpenBEL API provides RESTful API access to your BEL content. It is part of [
4
4
 
5
5
  ## Features
6
6
 
7
- - Evidence Store
8
- - Storage of evidence including creation, retrieval, modification, and deletion actions.
9
- - Flexible filtering of stored, evidence based on user's custom data requirements.
10
- - Upload a document (e.g. BEL script, XBEL, or Evidence JSON), to the Evidence Store, as a dataset. These can later be retrieved or deleted from the Evidence Store.
11
- - Flexible filtering of evidence contained within a dataset.
12
- - Download a document (e.g. BEL script, XBEL, or Evidence JSON) from a dataset.
7
+ - Nanopub Store
8
+ - Storage of nanopub including creation, retrieval, modification, and deletion actions.
9
+ - Flexible filtering of stored, nanopub based on user's custom data requirements.
10
+ - Upload a document (e.g. BEL script, XBEL, or nanopub JSON), to the Nanopub Store, as a dataset. These can later be retrieved or deleted from the nanopub Store.
11
+ - Flexible filtering of nanopub contained within a dataset.
12
+ - Download a document (e.g. BEL script, XBEL, or Nanopub JSON) from a dataset.
13
13
  - BEL Expressions
14
14
  - Autocomplete a BEL term expression.
15
15
  - Retrieve the structural components of a BEL expression.
@@ -21,28 +21,28 @@ The OpenBEL API provides RESTful API access to your BEL content. It is part of [
21
21
  ## Vocabulary
22
22
 
23
23
  *Annotation*
24
- A name/value property that describes an aspect of an *Evidence*. For example *Ncbi Taxonomy*:*Homo sapiens* is an annotation for the Human species.
24
+ A name/value property that describes an aspect of a *nanopub*. For example *Ncbi Taxonomy*:*Homo sapiens* is an annotation for the Human species.
25
25
 
26
26
  *Namespace*
27
27
  A biological identifier that is curated and maintained by an organization. For example the *Gene Ontology* (i.e. *GO*) or *HGNC* (i.e. *HUGO Gene Nomenclature Committee*) database.
28
28
 
29
- *Evidence*
29
+ *nanopub*
30
30
  A biological interaction curated from scientific literature. It is comprised of five parts.
31
31
 
32
32
  - *Citation*: The identification for the scientific literature where the interaction was stated.
33
33
  - *BEL Statement*: The biological interaction curated from the *Citation*.
34
- - *Summary text*: The text (i.e. *quotation*) within the *Citation* that supports the *BEL Statement*.
34
+ - *Support*: The text (i.e. *quotation*) within the *Citation* that supports the *BEL Statement*.
35
35
  - *Experiment Context*: The biological context within the experiment where the *BEL Statement* was observed. For example if the experiment sample was a biopsy on Human, Lung tissue then you might provide *Ncbi Taxonomy*: *Homo sapiens* and *Uberon*: *lung epithelium*.
36
- - *Metadata*: Additional data about this *Evidence* that is not part of the experiment (i.e. in *Experiment Context*). For example the evidence's *Reviewer*, *Create Date*, or *Reviewed Date* would be considered metadata.
36
+ - *Metadata*: Additional data about this *nanopub* that is not part of the experiment (i.e. in *Experiment Context*). For example the nanopub's *Reviewer*, *Create Date*, or *Reviewed Date* would be considered metadata.
37
37
  - *References*: The annotation and namespace sources used in the *BEL Statement*, *Experiment Context*, and *Metadata*. For example *Ncbi Taxonomy* may refer to an annotation identified by the URI http://www.openbel.org/bel/namespace/ncbi-taxonomy.
38
38
 
39
- *Document*: A file containing a collection of *Evidence* with document metadata like *Name*, *Description*, and *Version*. The supported document formats are BEL script, XBEL, and JSON Evidence.
39
+ *Document*: A file containing a collection of *nanopub* with document metadata like *Name*, *Description*, and *Version*. The supported document formats are BEL script, XBEL, and JSON Nanopub.
40
40
 
41
- *Dataset*: The representation of a *BEL Document* within the OpenBEL API. This provides access to document metadata as well as the collection of *Evidence* stored in the OpenBEL API that originate from the *BEL Document*.
41
+ *Dataset*: The representation of a *BEL Document* within the OpenBEL API. This provides access to document metadata as well as the collection of *nanopub* stored in the OpenBEL API that originate from the *BEL Document*.
42
42
 
43
43
  *Expression*: A string encoded in BEL that may represent a parameter (e.g. *AKT1*, *GO:"apoptotic process"*), term (e.g. *bp(GO:"apoptotic process")*), or statement (e.g. *p(HGNC:AKT1) increases bp(GO:"apoptotic process")*).
44
44
 
45
- *Evidence Store*: A database used for *Evidence*. It facilitates storage, filtering, and transformation of *Evidence*.
45
+ *Nanopub Store*: A database used for BEL *nanopubs*. It facilitates storage, filtering, and transformation of *nanopubs*.
46
46
 
47
47
  ## Technical requirements
48
48
 
@@ -57,7 +57,7 @@ The OpenBEL API is built to run with [JRuby][JRuby] and [Java 8][Java 8].
57
57
  - [MongoDB][MongoDB], version 3.2 or greater
58
58
  - Follow [MongoDB download][MongoDB download] page for download and installation instructions.
59
59
  - [SQLite][SQLite], version 3.8.0 or greater
60
- - Follow [SQLite download][SQLite download] page for download and installation instructions.
60
+ - Follow [SQLite download][SQLite download] page for download and installation instructions.
61
61
 
62
62
  ## Getting up and Running
63
63
 
@@ -103,20 +103,7 @@ The OpenBEL API requires a configuration file to set up a few things. You can cr
103
103
  openbel-config --file openbel-api-config.yml
104
104
  ```
105
105
 
106
- *Configure the Evidence Store*
107
- The Evidence Store is backed by a [MongoDB][MongoDB] database. You will need to provide the *host*, *port*, and *database* option.
108
-
109
- The default configuration is:
110
-
111
- ```yaml
112
- evidence_store:
113
- mongo:
114
- host: 'localhost'
115
- port: 27017
116
- database: 'openbel'
117
- ```
118
-
119
- There are also settings for user authentication. See [MongoDB User Authentication][MongoDB User Authentication] on the wiki.
106
+ [Configuring the Nanopub Store][https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Nanopub-Store]
120
107
 
121
108
  *Resource RDF data*
122
109
  Annotations, namespaces, and dataset storage are represented as [RDF][RDF] data. The data is stored in an on-disk database using Apache Jena (Java library included with `openbel-api`).
@@ -150,7 +137,7 @@ resource_search:
150
137
  You can obtain the latest Resource Search database (20150611) from the [OpenBEL build server][Resource Search 20150611].
151
138
 
152
139
  *Token-based authentication*
153
- The OpenBEL API is equipped to require authentication for specific API paths (e.g. Evidence, Datasets). The implementation uses [Auth0][Auth0] as a single sign-on service.
140
+ The OpenBEL API is equipped to require authentication for specific API paths (e.g. nanopub, Datasets). The implementation uses [Auth0][Auth0] as a single sign-on service.
154
141
 
155
142
  By default authentication is disabled.
156
143
 
@@ -228,11 +215,13 @@ server {
228
215
  }
229
216
  ```
230
217
 
231
- ## API Documentation
218
+ ## Upgrading
232
219
 
233
- The REST API is defined by a [RAML][RAML] specification. Th is published [here][OpenBEL API RAML specification].
220
+ [Upgrading instructions][Upgrading]
221
+
222
+ ## API Documentation
234
223
 
235
- API documentation with *Try it* functionality is available [here][OpenBEL API documentation].
224
+ API documentation with *Try it* functionality is available here [OpenBEL API documentation][OpenBEL API documentation]. You can download the [RAML 0.8][RAML] or Swagger specification files, try it on the webpage or generate curl, httpie, and various language templates for using the API.
236
225
 
237
226
  -----
238
227
 
@@ -241,9 +230,8 @@ Built with collaboration and a lot of :heart: by the [OpenBEL][OpenBEL] communit
241
230
  [OpenBEL]: http://www.openbel.org
242
231
  [OpenBEL Platform]: https://github.com/OpenBEL/openbel-platform
243
232
  [RAML]: http://raml.org/
244
- [OpenBEL API RAML specification]: http://next.belframework.org/openbel-api.raml
245
- [OpenBEL API documentation]: http://next.belframework.org/
246
- [Evidence API documentation]: http://next.belframework.org/#evidence
233
+ [OpenBEL API documentation]: http://openbelapi.api-docs.io/
234
+ [Nanopub API documentation]: http://openbelapi.api-docs.io/0.0.2/models/enWQug5KYcBtXxmPN
247
235
  [JRuby]: http://jruby.org
248
236
  [JRuby Getting Started]: http://jruby.org/getting-started
249
237
  [Java 8]: http://www.oracle.com/technetwork/java/javase/overview/java8-2100321.html
@@ -251,6 +239,7 @@ Built with collaboration and a lot of :heart: by the [OpenBEL][OpenBEL] communit
251
239
  [MongoDB download]: https://www.mongodb.org/downloads#production
252
240
  [SQLite]: https://www.sqlite.org
253
241
  [SQLite download]: https://www.sqlite.org/download.html
242
+ [Upgrading]: https://github.com/OpenBEL/openbel-api/blob/master/UPGRADING.md
254
243
  [RubyGems]: https://rubygems.org
255
244
  [RDF]: http://www.w3.org/RDF/
256
245
  [Auth0]: https://auth0.com/
@@ -258,4 +247,4 @@ Built with collaboration and a lot of :heart: by the [OpenBEL][OpenBEL] communit
258
247
  [Resource RDF 20150611]: http://build.openbel.org/browse/OR-RRD2/latestSuccessful/artifact
259
248
  [Resource Search 20150611]: http://build.openbel.org/browse/OR-RSD2/latestSuccessful/artifact
260
249
  [Nginx]: http://nginx.org/
261
- [MongoDB User Authentication]: https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Evidence-Store#mongodb-user-authentication
250
+ [MongoDB User Authentication]: https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Nanopub-Store#mongodb-user-authentication
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 1.0.0
@@ -2,12 +2,12 @@ require 'rubygems'
2
2
 
3
3
  # TODO This should probably be in app-config.rb.
4
4
  require 'jrjackson'
5
+ require 'bel_parser'
5
6
 
6
7
  require_relative 'util'
7
8
 
8
9
  require 'rack/cors'
9
10
  require 'sinatra/base'
10
- require "sinatra/reloader"
11
11
  require "sinatra/cookies"
12
12
 
13
13
  require_relative 'version'
@@ -15,12 +15,12 @@ require_relative 'config'
15
15
  require_relative 'routes/base'
16
16
  require_relative 'routes/root'
17
17
  require_relative 'routes/annotations'
18
- require_relative 'routes/evidence'
18
+ require_relative 'routes/authenticate'
19
19
  require_relative 'routes/datasets'
20
20
  require_relative 'routes/expressions'
21
- require_relative 'routes/functions'
21
+ require_relative 'routes/language'
22
22
  require_relative 'routes/namespaces'
23
- require_relative 'routes/authenticate'
23
+ require_relative 'routes/nanopubs'
24
24
  require_relative 'routes/version'
25
25
  require_relative 'middleware/auth'
26
26
 
@@ -28,13 +28,13 @@ module OpenBEL
28
28
 
29
29
  class Server < Sinatra::Application
30
30
 
31
- configure :development do
32
- register Sinatra::Reloader
33
- end
34
-
35
31
  configure do
36
32
  config = OpenBEL::Config::load!
37
33
  OpenBEL.const_set :Settings, config
34
+
35
+ tdbdir = OpenBEL::Settings[:resource_rdf][:jena][:tdb_directory]
36
+ BELParser::Resource.default_uri_reader =
37
+ BELParser::Resource::JenaTDBReader.new(tdbdir)
38
38
  end
39
39
 
40
40
  if OpenBEL::Settings[:auth][:enabled]
@@ -67,19 +67,20 @@ module OpenBEL
67
67
 
68
68
  # routes not requiring authentication
69
69
  use OpenBEL::Routes::Root
70
- use OpenBEL::Routes::Version
70
+ #use OpenBEL::Routes::Version
71
71
  use OpenBEL::Routes::Annotations
72
+ use OpenBEL::Routes::Authenticate
72
73
  use OpenBEL::Routes::Expressions
73
- use OpenBEL::Routes::Functions
74
+ use OpenBEL::Routes::Language
74
75
  use OpenBEL::Routes::Namespaces
75
- use OpenBEL::Routes::Authenticate
76
+ use OpenBEL::Routes::Version
76
77
 
77
78
  # routes requiring authentication
78
79
  if OpenBEL::Settings[:auth][:enabled]
79
80
  use OpenBEL::JWTMiddleware::Authentication
80
81
  end
81
82
  use OpenBEL::Routes::Datasets
82
- use OpenBEL::Routes::Evidence
83
+ use OpenBEL::Routes::Nanopubs
83
84
  end
84
85
  end
85
86
  # vim: ts=2 sts=2 sw=2
@@ -1,4 +1,5 @@
1
1
  require 'dot_hash'
2
+ require 'bel_parser'
2
3
 
3
4
  module OpenBEL
4
5
  module Config
@@ -35,28 +36,69 @@ module OpenBEL
35
36
  private
36
37
 
37
38
  def self.validate(cfg)
38
- # validate evidence_store block
39
- evidence_store = cfg[:evidence_store]
40
- unless evidence_store
39
+ # validate BEL version
40
+ bel = cfg[:bel]
41
+ unless bel
42
+ return [
43
+ true, <<-ERR.gsub(/ {12}/, '')
44
+ The "bel" section has not been configured.
45
+ You will need to supply a "bel.version" configuration block.
46
+ #{boilerplate_help}
47
+ ERR
48
+ ]
49
+ end
50
+ bel_failure = self.validate_bel(bel)
51
+ return bel_failure if bel_failure
52
+
53
+ # validate nanopub_store block
54
+ nanopub_store = cfg[:nanopub_store]
55
+ unless nanopub_store
56
+ return [
57
+ true, <<-ERR
58
+ An "nanopub_store" is not configured.
59
+ #{boilerplate_help}
60
+ ERR
61
+ ]
62
+ end
63
+ nanopub_failure = self.validate_nanopub_store(cfg[:nanopub_store])
64
+ return nanopub_failure if nanopub_failure
65
+
66
+ nil
67
+ end
68
+
69
+ def self.validate_bel(bel)
70
+ unless bel[:version]
71
+ return [
72
+ true, <<-ERR
73
+ The "bel.version" setting is not configured. This is required to
74
+ indicate which BEL version is supported by this OpenBEL API
75
+ instance.
76
+ #{boilerplate_help}
77
+ ERR
78
+ ]
79
+ end
80
+
81
+ version = bel[:version]
82
+ unless BELParser::Language.defines_version?(version)
83
+ defined_versions = BELParser::Language.versions
41
84
  return [
42
85
  true, <<-ERR
43
- An "evidence_store" is not configured.
86
+ The "bel.version" setting of "#{version}" is not a defined BEL version. Allowed values: #{defined_versions}
44
87
  #{boilerplate_help}
45
88
  ERR
46
89
  ]
90
+
47
91
  end
48
- evidence_failure = self.validate_evidence_store(cfg[:evidence_store])
49
- return evidence_failure if evidence_failure
50
92
 
51
93
  nil
52
94
  end
53
95
 
54
- def self.validate_evidence_store(evidence_store)
55
- mongo = evidence_store[:mongo]
96
+ def self.validate_nanopub_store(nanopub_store)
97
+ mongo = nanopub_store[:mongo]
56
98
  unless mongo
57
99
  return [
58
100
  true, <<-ERR
59
- The "evidence_store.mongo" configuration block is not configured.
101
+ The "nanopub_store.mongo" configuration block is not configured.
60
102
  #{boilerplate_help}
61
103
  ERR
62
104
  ]
@@ -68,7 +110,7 @@ module OpenBEL
68
110
  unless mongo[setting]
69
111
  return [
70
112
  true, <<-ERR
71
- The "evidence_store.mongo.#{setting}" setting is not configured.
113
+ The "nanopub_store.mongo.#{setting}" setting is not configured.
72
114
  #{boilerplate_help}
73
115
  ERR
74
116
  ]
@@ -131,7 +173,7 @@ module OpenBEL
131
173
  def self.boilerplate_help
132
174
  <<-ERR.gsub(/^\s+/, '')
133
175
  Run the "openbel-config" command to see an example configuration.
134
- See https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Evidence-Store for details on how to configure an Evidence Store.
176
+ See https://github.com/OpenBEL/openbel-api/wiki/Configuring-the-Nanopub-Store for details on how to configure a Nanopub Store.
135
177
  ERR
136
178
  end
137
179
 
@@ -5,9 +5,9 @@ require_relative 'translators'
5
5
  module OpenBEL
6
6
  module Helpers
7
7
 
8
- def render_evidence_collection(
8
+ def render_nanopub_collection(
9
9
  name, page_results, start, size, filters,
10
- filtered_total, collection_total, evidence_api
10
+ filtered_total, collection_total, nanopub_api
11
11
  )
12
12
  # see if the user requested a BEL translator (Accept header or ?format)
13
13
  translator = Translators.requested_translator(request, params)
@@ -20,7 +20,7 @@ module OpenBEL
20
20
  if wants_default? || !translator
21
21
  facets = page_results[:facets]
22
22
  pager = Pager.new(start, size, filtered_total)
23
- evidence = page_results[:cursor].map { |item|
23
+ nanopub = page_results[:cursor].map { |item|
24
24
  item.delete('facets')
25
25
  item
26
26
  }.to_a
@@ -36,7 +36,7 @@ module OpenBEL
36
36
  :total_filtered => pager.total_size,
37
37
  :total_pages => pager.total_pages,
38
38
  :current_page => pager.current_page,
39
- :current_page_size => evidence.size,
39
+ :current_page_size => nanopub.size,
40
40
  }
41
41
  }
42
42
  }
@@ -45,7 +45,7 @@ module OpenBEL
45
45
  options[:previous_page] = pager.previous_page
46
46
  options[:next_page] = pager.next_page
47
47
 
48
- render_collection(evidence, :evidence, options)
48
+ render_collection(nanopub, :nanopub, options)
49
49
  else
50
50
  extension = translator_plugin.file_extensions.first
51
51
 
@@ -54,18 +54,17 @@ module OpenBEL
54
54
  attachment "#{name}.#{extension}"
55
55
  stream :keep_open do |response|
56
56
  cursor = page_results[:cursor]
57
- dataset_evidence = cursor.lazy.map { |evidence|
58
- evidence.delete('facets')
59
- evidence.delete('_id')
60
- evidence = BEL::Model::Evidence.create(BEL.keys_to_symbols(evidence))
61
- evidence.bel_statement = BEL::Model::Evidence.parse_statement(evidence)
62
- evidence
57
+ dataset_nanopub = cursor.lazy.map { |nanopub|
58
+ nanopub.delete('facets')
59
+ nanopub.delete('_id')
60
+ nanopub = BEL::Nanopub::Nanopub.create(BEL.keys_to_symbols(nanopub))
61
+ nanopub
63
62
  }
64
63
 
65
64
  translator.write(
66
- dataset_evidence, response,
67
- :annotation_reference_map => evidence_api.find_all_annotation_references,
68
- :namespace_reference_map => evidence_api.find_all_namespace_references
65
+ dataset_nanopub, response,
66
+ :annotation_reference_map => nanopub_api.find_all_annotation_references,
67
+ :namespace_reference_map => nanopub_api.find_all_namespace_references
69
68
  )
70
69
  end
71
70
  end