openbel-api 0.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/.gemspec +65 -0
  3. data/CHANGELOG.md +22 -0
  4. data/INSTALL.md +19 -0
  5. data/INSTALL_RUBY.md +107 -0
  6. data/LICENSE +191 -0
  7. data/README.md +208 -0
  8. data/app/openbel/api/app.rb +83 -0
  9. data/app/openbel/api/config.rb +45 -0
  10. data/app/openbel/api/config.ru +3 -0
  11. data/app/openbel/api/helpers/pager.rb +109 -0
  12. data/app/openbel/api/middleware/auth.rb +112 -0
  13. data/app/openbel/api/resources/adapters/basic_json.rb +52 -0
  14. data/app/openbel/api/resources/annotation.rb +141 -0
  15. data/app/openbel/api/resources/base.rb +16 -0
  16. data/app/openbel/api/resources/completion.rb +89 -0
  17. data/app/openbel/api/resources/evidence.rb +115 -0
  18. data/app/openbel/api/resources/evidence_transform.rb +143 -0
  19. data/app/openbel/api/resources/function.rb +98 -0
  20. data/app/openbel/api/resources/match_result.rb +79 -0
  21. data/app/openbel/api/resources/namespace.rb +174 -0
  22. data/app/openbel/api/routes/annotations.rb +168 -0
  23. data/app/openbel/api/routes/authenticate.rb +108 -0
  24. data/app/openbel/api/routes/base.rb +326 -0
  25. data/app/openbel/api/routes/datasets.rb +519 -0
  26. data/app/openbel/api/routes/evidence.rb +330 -0
  27. data/app/openbel/api/routes/expressions.rb +560 -0
  28. data/app/openbel/api/routes/functions.rb +41 -0
  29. data/app/openbel/api/routes/namespaces.rb +382 -0
  30. data/app/openbel/api/routes/root.rb +39 -0
  31. data/app/openbel/api/schemas.rb +34 -0
  32. data/app/openbel/api/schemas/annotation_collection.schema.json +20 -0
  33. data/app/openbel/api/schemas/annotation_resource.schema.json +36 -0
  34. data/app/openbel/api/schemas/annotation_value_collection.schema.json +21 -0
  35. data/app/openbel/api/schemas/annotation_value_resource.schema.json +35 -0
  36. data/app/openbel/api/schemas/completion_collection.schema.json +21 -0
  37. data/app/openbel/api/schemas/completion_resource.schema.json +146 -0
  38. data/app/openbel/api/schemas/evidence.schema.json +198 -0
  39. data/app/openbel/api/schemas/evidence_collection.schema.json +98 -0
  40. data/app/openbel/api/schemas/evidence_resource.schema.json +29 -0
  41. data/app/openbel/api/schemas/namespace_value_collection.schema.json +21 -0
  42. data/app/openbel/api/schemas/namespace_value_resource.schema.json +43 -0
  43. data/app/openbel/api/util.rb +11 -0
  44. data/bin/openbel-api +78 -0
  45. data/bin/openbel-config +46 -0
  46. data/config/async_evidence.rb +12 -0
  47. data/config/async_jena.rb +14 -0
  48. data/config/config.yml +31 -0
  49. data/config/server_config.rb +184 -0
  50. data/lib/openbel/api/cache/cache.rb +30 -0
  51. data/lib/openbel/api/config/config.rb +33 -0
  52. data/lib/openbel/api/evidence/api.rb +39 -0
  53. data/lib/openbel/api/evidence/facet_api.rb +18 -0
  54. data/lib/openbel/api/evidence/facet_filter.rb +83 -0
  55. data/lib/openbel/api/evidence/mongo.rb +247 -0
  56. data/lib/openbel/api/evidence/mongo_facet.rb +105 -0
  57. data/lib/openbel/api/helpers/dependency_graph.rb +52 -0
  58. data/lib/openbel/api/model/rdf_resource.rb +74 -0
  59. data/lib/openbel/api/plugin/cache/kyotocabinet.rb +85 -0
  60. data/lib/openbel/api/plugin/configure_plugins.rb +97 -0
  61. data/lib/openbel/api/plugin/evidence/evidence.rb +58 -0
  62. data/lib/openbel/api/plugin/plugin.rb +99 -0
  63. data/lib/openbel/api/plugin/plugin_manager.rb +20 -0
  64. data/lib/openbel/api/plugin/plugin_repository.rb +60 -0
  65. data/lib/openbel/api/storage/cache_proxy.rb +74 -0
  66. data/lib/openbel/api/storage/triple_storage.rb +43 -0
  67. metadata +379 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 84860112a47f326439806c8f6f81987e31a47121
4
+ data.tar.gz: 55a1281b0db90eae0ba49b6314d3727c29225268
5
+ SHA512:
6
+ metadata.gz: 1a3d631752e68f0be2686c1bf8eb4efa13b19f803fe9dc9a1572a3171f36f881904e5c5279e537587ee9005c49fa12c5ff61cff096ac142f42d870eb5e653562
7
+ data.tar.gz: 094034e7a35004b6e05da1174cad42e1b372a77e526159a939891824e2c20e309a658a15084a001551b9caafd1fc6c68ec6d06cd485dbe0f67c0a1c81762be41
data/.gemspec ADDED
@@ -0,0 +1,65 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = 'openbel-api'
3
+ spec.version = '0.4.0'
4
+ spec.summary = %q{The OpenBEL API provided over RESTful HTTP endpoints.}
5
+ spec.description = %q{The OpenBEL API provides a RESTful API over HTTP to manage BEL knowledge.}
6
+ spec.license = 'Apache-2.0'
7
+ spec.authors = [
8
+ 'Anthony Bargnesi',
9
+ 'Nick Bargnesi',
10
+ 'William Hayes'
11
+ ]
12
+ spec.date = %q{2015-12-02}
13
+ spec.email = %q{abargnesi@selventa.com}
14
+ spec.files = [
15
+ Dir.glob('app/**/*.{json,rb,ru}'),
16
+ Dir.glob('config/**/*.{rb,yml}'),
17
+ Dir.glob('lib/**/*.rb'),
18
+ __FILE__,
19
+ 'CHANGELOG.md',
20
+ 'LICENSE',
21
+ 'INSTALL.md',
22
+ 'INSTALL_RUBY.md',
23
+ 'README.md'
24
+ ].flatten!
25
+ spec.executables = Dir.glob('bin/*').map(&File.method(:basename))
26
+ spec.homepage = 'https://github.com/OpenBEL/openbel-server'
27
+ spec.require_paths = ['app', 'lib']
28
+ spec.platform = 'java'
29
+ spec.required_ruby_version = '>= 2.0.0'
30
+
31
+ # Dependencies
32
+
33
+ ## bel.rb
34
+ spec.add_runtime_dependency 'bel', '0.4.0'
35
+
36
+ ## bel.rb plugin - annotation/namespace search
37
+ spec.add_runtime_dependency 'bel-search-sqlite', '0.4.0'
38
+
39
+ ## bel.rb plugin - RDF repository using Apache Jena
40
+ spec.add_runtime_dependency 'bel-rdf-jena', '0.4.0'
41
+
42
+ ## RDF - RDF abstraction
43
+ spec.add_runtime_dependency 'rdf', '1.99.0'
44
+
45
+ ## Mongo - Faceted search of evidence.
46
+ spec.add_runtime_dependency 'mongo', '1.12.5'
47
+ spec.add_runtime_dependency 'bson', '1.12.5'
48
+
49
+ ## REST API dependencies
50
+ spec.add_runtime_dependency 'dot_hash', '0.5.9'
51
+ spec.add_runtime_dependency 'jrjackson', '0.3.7'
52
+ spec.add_runtime_dependency 'json_schema', '0.10.0'
53
+ spec.add_runtime_dependency 'multi_json', '1.11.2'
54
+ spec.add_runtime_dependency 'oat', '0.4.6'
55
+ spec.add_runtime_dependency 'puma', '2.15.3'
56
+ spec.add_runtime_dependency 'rack', '1.6.4'
57
+ spec.add_runtime_dependency 'rack-cors', '0.4.0'
58
+ spec.add_runtime_dependency 'rack-handlers', '0.7.0'
59
+ spec.add_runtime_dependency 'sinatra', '1.4.6'
60
+ spec.add_runtime_dependency 'sinatra-contrib', '1.4.6'
61
+ spec.add_runtime_dependency 'jwt', '1.5.2'
62
+ spec.add_runtime_dependency 'rest-client', '1.8.0'
63
+ end
64
+ # vim: ts=2 sw=2:
65
+ # encoding: utf-8
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Change Log
2
+ All notable changes to openbel-api will be documented in this file. The curated log begins at changes to version 0.4.0.
3
+
4
+ This project adheres to [Semantic Versioning][Semantic Versioning].
5
+
6
+ ## [0.4.0][0.4.0] - 2015-12-14
7
+ ### Added
8
+ - Evidence Store
9
+ - Storage of evidence including creation, retrieval, modification, and deletion actions.
10
+ - Flexible filtering of stored, evidence based on user's custom data requirements.
11
+ - 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.
12
+ - Flexible filtering of evidence contained within a dataset.
13
+ - Download a document (e.g. BEL script, XBEL, or Evidence JSON) from a dataset.
14
+ - BEL Expressions
15
+ - Autocomplete a BEL term expression.
16
+ - Retrieve the structural components of a BEL expression.
17
+ - Annotations and Namespaces
18
+ - Retrieve annotation (e.g. Disease Ontology) and namespace (e.g. GO) data.
19
+ - Retrieve equivalent namespace values from the individual.
20
+ - Retrieve orthologous namespace values from the individual.
21
+
22
+ [Semantic Versioning]: http://semver.org
data/INSTALL.md ADDED
@@ -0,0 +1,19 @@
1
+ Install
2
+ =======
3
+
4
+ This library requires [Ruby](https://www.ruby-lang.org) (**>= 2.0.0**). See [how to install ruby](https://github.com/OpenBEL/bel.rb/blob/master/INSTALL_RUBY.md).
5
+
6
+ Install from [RubyGems.org](http://rubygems.org/gems/bel)
7
+
8
+ ```bash
9
+ gem install bel
10
+ ```
11
+
12
+ Build from master branch
13
+
14
+ 1. Obtain source for master branch.
15
+ - `git clone git@github.com:OpenBEL/bel.rb.git`
16
+
17
+ 2. Build
18
+ - `gem build bel.gemspec`
19
+ - `gem install bel-[VERSION].gem`
data/INSTALL_RUBY.md ADDED
@@ -0,0 +1,107 @@
1
+ # Install Ruby
2
+
3
+
4
+ ## Install Ruby (Windows)
5
+
6
+ 1. Download [RubyInstaller](http://rubyinstaller.org/downloads).
7
+ * Versions 2.x.x are supported.
8
+ 2. Install RubyInstaller version.
9
+ * Enable the _Add Ruby executables to your PATH_ option presented during installation.
10
+ 3. Open a command prompt (Windows Key + R then type `cmd`).
11
+ * Confirm installation by typing `ruby -v`.
12
+ * The output should show the ruby version (e.g. `ruby 2.0.0p451 (2014-02-24) [x64-mingw32]`).
13
+
14
+ Continue with <a href="#install_bel_gem">Install the bel gem</a>.
15
+
16
+ ## Install Ruby (Mac OSX)
17
+
18
+ _Option 1: Homebrew_
19
+
20
+ 1. Install with homebrew by typing `brew install ruby`.
21
+ 2. Add ruby commands to your PATH.
22
+ * Add to .bash_profile.
23
+ * `echo 'export PATH="/usr/local/Cellar/ruby/VERSION/bin:$PATH"' >> .bash_profile`
24
+ * Update environment by sourcing .bash_profile.
25
+ * `source ~/.bash_profile`
26
+ 3. Confirm installation by typing `ruby -v`.
27
+
28
+ _Option 2: rbenv_
29
+
30
+ * _Install with homebrew._
31
+ * `brew update`
32
+ * `brew install rbenv ruby-build`
33
+ * More details [here] (https://github.com/sstephenson/rbenv#homebrew-on-mac-os-x).
34
+
35
+ * _Install with git._
36
+ * Clone rbenv repository.
37
+ * `git clone https://github.com/sstephenson/rbenv.git ~/.rbenv`
38
+ * Add to .bash_profile.
39
+ * `echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile`
40
+ * Enable shims and autocompletion from the terminal.
41
+ * `echo 'eval "$(rbenv init -)"' >> ~/.bash_profile`
42
+ * Clone ruby-build repository.
43
+ * `git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build`
44
+ * More details [here] (https://github.com/sstephenson/rbenv#installation).
45
+
46
+ Continue with <a href="#install_bel_gem">Install the bel gem</a>.
47
+
48
+ ## Install Ruby (Linux)
49
+
50
+ _Option 1: Install via package manager._
51
+
52
+ * Example installation with Ubuntu.
53
+ * Type `sudo apt-get install ruby` in the terminal.
54
+
55
+ _Option 2: rbenv_
56
+
57
+ * _Install with git._
58
+ * Clone rbenv repository.
59
+ * `git clone https://github.com/sstephenson/rbenv.git ~/.rbenv`
60
+ * Add to .bash_profile.
61
+ * `echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile`
62
+ * Enable shims and autocompletion from the terminal.
63
+ * `echo 'eval "$(rbenv init -)"' >> ~/.bash_profile`
64
+ * Clone ruby-build repository.
65
+ * `git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build`
66
+ * More details [here] (https://github.com/sstephenson/rbenv#installation).
67
+
68
+ Continue with <a href="#install_bel_gem">Install the bel gem</a>.
69
+
70
+ <br><br>
71
+ <div id="install_bel_gem"></div>
72
+ ## Install the _bel_ gem
73
+
74
+ 1. Open a terminal or command prompt.
75
+ 2. Use the `gem` command to install the `bel` gem.
76
+ * `gem install bel`
77
+ 3. You should see the following:
78
+
79
+ <pre>
80
+ Fetching: bel-0.2.1.gem (100%)
81
+ Successfully installed bel-0.2.1
82
+ Parsing documentation for bel-0.2.1
83
+ Installing ri documentation for bel-0.2.1
84
+ 1 gem installed
85
+ </pre>
86
+ 4. Confirm you can access the `bel_upgrade` command.
87
+ 5. Continue with <a href="#upgrading_bel">Upgrading BEL</a>.
88
+
89
+ <br><br>
90
+ <div id="upgrading_bel"></div>
91
+ ## Upgrading BEL
92
+
93
+ 1. Type `bel_upgrade --help` for option details.
94
+ 2. Run command
95
+ * Example 1 - convert a BEL file
96
+ * `bel_upgrade --bel small_corpus.bel --changelog "http://resource.belframework.org/belframework/20131211/change_log.json"
97
+ * Example 2 - convert BEL from standard in
98
+ * `curl "http://resource.belframework.org/belframework/1.0/knowledge/small_corpus.bel" | bel_upgrade --changelog "http://resource.belframework.org/belframework/20131211/change_log.json"`
99
+ * More details [here] (https://github.com/OpenBEL/bel.rb).
100
+ 3. The upgraded BEL will be written to standard out. Simply redirect to a file after that.
101
+ * `bel_upgrade ... > upgraded-version.bel`
102
+
103
+ <br><br>
104
+ ## Issues
105
+
106
+ * If you have questions with `bel_upgrade` or the `bel` gem please post to the [openbel-discuss] (https://groups.google.com/forum/#!forum/openbel-discuss) google group.
107
+ * If you encounter errors please post an issue to [github issues] (https://github.com/OpenBEL/bel.rb/issues).
data/LICENSE ADDED
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form, made
34
+ available under the License, as indicated by a copyright notice that is included
35
+ in or attached to the work (an example is provided in the Appendix below).
36
+
37
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
38
+ is based on (or derived from) the Work and for which the editorial revisions,
39
+ annotations, elaborations, or other modifications represent, as a whole, an
40
+ original work of authorship. For the purposes of this License, Derivative Works
41
+ shall not include works that remain separable from, or merely link (or bind by
42
+ name) to the interfaces of, the Work and Derivative Works thereof.
43
+
44
+ "Contribution" shall mean any work of authorship, including the original version
45
+ of the Work and any modifications or additions to that Work or Derivative Works
46
+ thereof, that is intentionally submitted to Licensor for inclusion in the Work
47
+ by the copyright owner or by an individual or Legal Entity authorized to submit
48
+ on behalf of the copyright owner. For the purposes of this definition,
49
+ "submitted" means any form of electronic, verbal, or written communication sent
50
+ to the Licensor or its representatives, including but not limited to
51
+ communication on electronic mailing lists, source code control systems, and
52
+ issue tracking systems that are managed by, or on behalf of, the Licensor for
53
+ the purpose of discussing and improving the Work, but excluding communication
54
+ that is conspicuously marked or otherwise designated in writing by the copyright
55
+ owner as "Not a Contribution."
56
+
57
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
58
+ of whom a Contribution has been received by Licensor and subsequently
59
+ incorporated within the Work.
60
+
61
+ 2. Grant of Copyright License.
62
+
63
+ Subject to the terms and conditions of this License, each Contributor hereby
64
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
65
+ irrevocable copyright license to reproduce, prepare Derivative Works of,
66
+ publicly display, publicly perform, sublicense, and distribute the Work and such
67
+ Derivative Works in Source or Object form.
68
+
69
+ 3. Grant of Patent License.
70
+
71
+ Subject to the terms and conditions of this License, each Contributor hereby
72
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
73
+ irrevocable (except as stated in this section) patent license to make, have
74
+ made, use, offer to sell, sell, import, and otherwise transfer the Work, where
75
+ such license applies only to those patent claims licensable by such Contributor
76
+ that are necessarily infringed by their Contribution(s) alone or by combination
77
+ of their Contribution(s) with the Work to which such Contribution(s) was
78
+ submitted. If You institute patent litigation against any entity (including a
79
+ cross-claim or counterclaim in a lawsuit) alleging that the Work or a
80
+ Contribution incorporated within the Work constitutes direct or contributory
81
+ patent infringement, then any patent licenses granted to You under this License
82
+ for that Work shall terminate as of the date such litigation is filed.
83
+
84
+ 4. Redistribution.
85
+
86
+ You may reproduce and distribute copies of the Work or Derivative Works thereof
87
+ in any medium, with or without modifications, and in Source or Object form,
88
+ provided that You meet the following conditions:
89
+
90
+ You must give any other recipients of the Work or Derivative Works a copy of
91
+ this License; and
92
+ You must cause any modified files to carry prominent notices stating that You
93
+ changed the files; and
94
+ You must retain, in the Source form of any Derivative Works that You distribute,
95
+ all copyright, patent, trademark, and attribution notices from the Source form
96
+ of the Work, excluding those notices that do not pertain to any part of the
97
+ Derivative Works; and
98
+ If the Work includes a "NOTICE" text file as part of its distribution, then any
99
+ Derivative Works that You distribute must include a readable copy of the
100
+ attribution notices contained within such NOTICE file, excluding those notices
101
+ that do not pertain to any part of the Derivative Works, in at least one of the
102
+ following places: within a NOTICE text file distributed as part of the
103
+ Derivative Works; within the Source form or documentation, if provided along
104
+ with the Derivative Works; or, within a display generated by the Derivative
105
+ Works, if and wherever such third-party notices normally appear. The contents of
106
+ the NOTICE file are for informational purposes only and do not modify the
107
+ License. You may add Your own attribution notices within Derivative Works that
108
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
+ provided that such additional attribution notices cannot be construed as
110
+ modifying the License.
111
+ You may add Your own copyright statement to Your modifications and may provide
112
+ additional or different license terms and conditions for use, reproduction, or
113
+ distribution of Your modifications, or for any such Derivative Works as a whole,
114
+ provided Your use, reproduction, and distribution of the Work otherwise complies
115
+ with the conditions stated in this License.
116
+
117
+ 5. Submission of Contributions.
118
+
119
+ Unless You explicitly state otherwise, any Contribution intentionally submitted
120
+ for inclusion in the Work by You to the Licensor shall be under the terms and
121
+ conditions of this License, without any additional terms or conditions.
122
+ Notwithstanding the above, nothing herein shall supersede or modify the terms of
123
+ any separate license agreement you may have executed with Licensor regarding
124
+ such Contributions.
125
+
126
+ 6. Trademarks.
127
+
128
+ This License does not grant permission to use the trade names, trademarks,
129
+ service marks, or product names of the Licensor, except as required for
130
+ reasonable and customary use in describing the origin of the Work and
131
+ reproducing the content of the NOTICE file.
132
+
133
+ 7. Disclaimer of Warranty.
134
+
135
+ Unless required by applicable law or agreed to in writing, Licensor provides the
136
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
137
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
138
+ including, without limitation, any warranties or conditions of TITLE,
139
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
140
+ solely responsible for determining the appropriateness of using or
141
+ redistributing the Work and assume any risks associated with Your exercise of
142
+ permissions under this License.
143
+
144
+ 8. Limitation of Liability.
145
+
146
+ In no event and under no legal theory, whether in tort (including negligence),
147
+ contract, or otherwise, unless required by applicable law (such as deliberate
148
+ and grossly negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special, incidental,
150
+ or consequential damages of any character arising as a result of this License or
151
+ out of the use or inability to use the Work (including but not limited to
152
+ damages for loss of goodwill, work stoppage, computer failure or malfunction, or
153
+ any and all other commercial damages or losses), even if such Contributor has
154
+ been advised of the possibility of such damages.
155
+
156
+ 9. Accepting Warranty or Additional Liability.
157
+
158
+ While redistributing the Work or Derivative Works thereof, You may choose to
159
+ offer, and charge a fee for, acceptance of support, warranty, indemnity, or
160
+ other liability obligations and/or rights consistent with this License. However,
161
+ in accepting such obligations, You may act only on Your own behalf and on Your
162
+ sole responsibility, not on behalf of any other Contributor, and only if You
163
+ agree to indemnify, defend, and hold each Contributor harmless for any liability
164
+ incurred by, or claims asserted against, such Contributor by reason of your
165
+ accepting any such warranty or additional liability.
166
+
167
+ END OF TERMS AND CONDITIONS
168
+
169
+ APPENDIX: How to apply the Apache License to your work
170
+
171
+ To apply the Apache License to your work, attach the following boilerplate
172
+ notice, with the fields enclosed by brackets "[]" replaced with your own
173
+ identifying information. (Don't include the brackets!) The text should be
174
+ enclosed in the appropriate comment syntax for the file format. We also
175
+ recommend that a file or class name and description of purpose be included on
176
+ the same "printed page" as the copyright notice for easier identification within
177
+ third-party archives.
178
+
179
+ Copyright 2013 OpenBEL Consortium
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,208 @@
1
+ # openbel-api
2
+
3
+ The OpenBEL API provides RESTful API access to your BEL content. It is part of [OpenBEL Platform][OpenBEL Platform].
4
+
5
+ ## Features
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.
13
+ - BEL Expressions
14
+ - Autocomplete a BEL term expression.
15
+ - Retrieve the structural components of a BEL expression.
16
+ - Annotations and Namespaces
17
+ - Retrieve annotation (e.g. Disease Ontology) and namespace (e.g. GO) data.
18
+ - Retrieve equivalent namespace values from the individual.
19
+ - Retrieve orthologous namespace values from the individual.
20
+
21
+ ## Vocabulary
22
+
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.
25
+
26
+ *Namespace*
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
+
29
+ *Evidence*
30
+ A biological interaction curated from scientific literature. It is comprised of five parts.
31
+
32
+ - *Citation*: The identification for the scientific literature where the interaction was stated.
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*.
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.
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
+
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.
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*.
42
+
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
+
45
+ *Evidence Store*: A database used for *Evidence*. It facilitates storage, filtering, and transformation of *Evidence*.
46
+
47
+ ## Technical requirements
48
+
49
+ The OpenBEL API is built to run with [JRuby][JRuby] and [Java 8][Java 8].
50
+
51
+ *System Requirements*
52
+
53
+ - [Java 8][Java 8]
54
+ - [JRuby][JRuby], 1.7.x or 9.x series (9.0.x.0 is recommended)
55
+ - Follow [JRuby Getting Started][JRuby Getting Started] for installation instructions.
56
+ - [MongoDB][MongoDB], version 3.0 or greater
57
+ - Follow [MongoDB download][MongoDB download] page for download and installation instructions.
58
+ - [SQLite][SQLite], version 3.8.0 or greater
59
+ - Follow [SQLite download][SQLite download] page for download and installation instructions.
60
+
61
+ ## Getting up and Running
62
+
63
+ ### Installation
64
+
65
+ The OpenBEL API is packaged and installed as a Ruby gem. A Ruby gem is packed library or application that runs on the Ruby virtual machine. In this case OpenBEL API runs only on [JRuby][JRuby].
66
+
67
+ Installation uses the [RubyGems][RubyGems] site to download and install the gem from. To install the OpenBEL API gem run the `gem install` command available within your [JRuby][JRuby] installation.
68
+
69
+ ```bash
70
+ gem install openbel-api
71
+ ```
72
+
73
+ All of the application dependencies needed by `openbel-api` will be installed during this process.
74
+
75
+ ### Configuration
76
+
77
+ The OpenBEL API requires a configuration file to set up a few things. You can create an initial configuration file using the `openbel-config` command.
78
+
79
+ ```bash
80
+ openbel-config --file openbel-api-config.yml
81
+ ```
82
+
83
+ *Configure the Evidence Store*
84
+ The Evidence Store is backed by a [MongoDB][MongoDB] database. You will need to provide the *host*, *port*, and *database* option.
85
+
86
+ The default configuration is:
87
+
88
+ ```yaml
89
+ evidence_store:
90
+ mongo:
91
+ host: 'localhost'
92
+ port: 27017
93
+ database: 'openbel'
94
+ ```
95
+
96
+ *Resource RDF data*
97
+ 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`).
98
+
99
+ You will need to configure the location of the Apache Jena TDB database that holds this data.
100
+
101
+ The default configuration is:
102
+
103
+ ```yaml
104
+ resource_rdf:
105
+ jena:
106
+ tdb_directory: 'biological-concepts-rdf'
107
+ ```
108
+
109
+ **Tip**
110
+ You can obtain the latest Resource RDF database (20150611) from the [OpenBEL build server][Resource RDF 20150611].
111
+
112
+ *Resource search*
113
+ Annotations and namespaces can be full-text searched using a [SQLite][SQLite] database. The data is stored in an on-disk file.
114
+
115
+ The default configuration is:
116
+
117
+ ```yaml
118
+ resource_search:
119
+ sqlite:
120
+ database_file: 'biological-concepts-rdf.db'
121
+ ```
122
+
123
+
124
+ **Tip**
125
+ You can obtain the latest Resource Search database (20150611) from the [OpenBEL build server][Resource Search 20150611].
126
+
127
+ *Token-based authentication*
128
+ 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.
129
+
130
+ By default authentication is disabled.
131
+
132
+ The default configuration is:
133
+
134
+ ```yaml
135
+ # Set a secret used during session creation....
136
+ session_secret: 'changeme'
137
+
138
+ # User authentication using Auth0.
139
+ auth:
140
+ enabled: false
141
+ redirect: 'https://openbel.auth0.com/authorize?response_type=code&scope=openid%20profile&client_id=K4oAPUaROjbWWTCoAhf0nKYfTGsZWbHE'
142
+ default_connection: 'linkedin'
143
+ domain: 'openbel.auth0.com'
144
+ id: 'K4oAPUaROjbWWTCoAhf0nKYfTGsZWbHE'
145
+ # secret: 'auth0 client secret here'
146
+ ```
147
+
148
+ ### Running the OpenBEL API
149
+
150
+ The OpenBEL API can be run using the `openbel-api` command and passing a configuration file.
151
+
152
+ The configuration file can be provided in two ways:
153
+ - Command option (`--file`)
154
+ - Environment variable named `OPENBEL_API_CONFIG_FILE`
155
+
156
+ *Command option*
157
+ ```
158
+ openbel-api --file "/path/to/openbel-api-config.yml"
159
+ ```
160
+
161
+ *Environment variable*
162
+ ```
163
+ export OPENBEL_API_CONFIG_FILE="/path/to/openbel-api-config.yml"
164
+
165
+ openbel-api
166
+ ```
167
+
168
+ To configure server options such as port, background execution, or number of threads you will need to provide an extra set of arguments to the `openbel-api` command. These options help configure the [Puma HTTP server][Puma HTTP server] that is included with OpenBEL API.
169
+
170
+ *Example running on port 9000 with up to 16 threads.*
171
+
172
+ ```bash
173
+ openbel-api --file openbel-api-config.yml -- --port 9000 --threads 1:16
174
+ ```
175
+
176
+ **Note**
177
+ Run `openbel-api --help` for more information and options.
178
+
179
+ ## API Documentation
180
+
181
+ The REST API is defined by a [RAML][RAML] specification. The specification is published [here][OpenBEL API RAML specification].
182
+
183
+ API documentation with *Try it* functionality is available [here][OpenBEL API documentation].
184
+
185
+ -----
186
+
187
+ Built with collaboration and :heart: by the [OpenBEL][OpenBEL] community.
188
+
189
+ [OpenBEL]: http://www.openbel.org
190
+ [OpenBEL Platform]: https://github.com/OpenBEL/openbel-platform
191
+ [RAML]: http://raml.org/
192
+ [OpenBEL API RAML specification]: http://next.belframework.org/openbel-api.raml
193
+ [OpenBEL API documentation]: http://next.belframework.org/
194
+ [Evidence API documentation]: http://next.belframework.org/#evidence
195
+ [JRuby]: http://jruby.org
196
+ [JRuby Getting Started]: http://jruby.org/getting-started
197
+ [Java 8]: http://www.oracle.com/technetwork/java/javase/overview/java8-2100321.html
198
+ [MongoDB]: https://www.mongodb.org/
199
+ [MongoDB download]: https://www.mongodb.org/downloads#production
200
+ [SQLite]: https://www.sqlite.org
201
+ [SQLite download]: https://www.sqlite.org/download.html
202
+ [RubyGems]: https://rubygems.org
203
+ [RDF]: http://www.w3.org/RDF/
204
+ [Auth0]: https://auth0.com/
205
+ [Puma HTTP server]: http://puma.io/
206
+ [Resource RDF 20150611]: http://build.openbel.org/browse/OR-RRD2/latestSuccessful/artifact
207
+ [Resource Search 20150611]: http://build.openbel.org/browse/OR-RSD2/latestSuccessful/artifact
208
+