publisci 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +13 -0
  5. data/Gemfile +36 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +51 -0
  8. data/README.rdoc +48 -0
  9. data/Rakefile +68 -0
  10. data/bin/bio-publisci +106 -0
  11. data/bin/bio-publisci-server +50 -0
  12. data/examples/bio-band_integration.rb +9 -0
  13. data/examples/no_magic.prov +58 -0
  14. data/examples/no_magic.rb +58 -0
  15. data/examples/orm.prov +48 -0
  16. data/examples/primer-full.prov +120 -0
  17. data/examples/primer.prov +66 -0
  18. data/examples/prov_dsl.prov +85 -0
  19. data/examples/safe_gen.rb +7 -0
  20. data/examples/visualization/primer.prov +66 -0
  21. data/examples/visualization/prov_viz.rb +140 -0
  22. data/examples/visualization/viz.rb +35 -0
  23. data/features/create_generator.feature +21 -0
  24. data/features/integration.feature +12 -0
  25. data/features/integration_steps.rb +10 -0
  26. data/features/metadata.feature +37 -0
  27. data/features/metadata_steps.rb +40 -0
  28. data/features/orm.feature +60 -0
  29. data/features/orm_steps.rb +74 -0
  30. data/features/prov_dsl.feature +14 -0
  31. data/features/prov_dsl_steps.rb +11 -0
  32. data/features/reader.feature +25 -0
  33. data/features/reader_steps.rb +61 -0
  34. data/features/step_definitions/bio-publisci_steps.rb +0 -0
  35. data/features/store.feature +27 -0
  36. data/features/store_steps.rb +42 -0
  37. data/features/support/env.rb +13 -0
  38. data/features/writer.feature +14 -0
  39. data/features/writer_steps.rb +24 -0
  40. data/lib/bio-publisci.rb +64 -0
  41. data/lib/bio-publisci/analyzer.rb +57 -0
  42. data/lib/bio-publisci/datacube_model.rb +111 -0
  43. data/lib/bio-publisci/dataset/ORM/data_cube_orm.rb +240 -0
  44. data/lib/bio-publisci/dataset/ORM/observation.rb +20 -0
  45. data/lib/bio-publisci/dataset/configuration.rb +31 -0
  46. data/lib/bio-publisci/dataset/data_cube.rb +418 -0
  47. data/lib/bio-publisci/dataset/dataset.rb +11 -0
  48. data/lib/bio-publisci/dataset/dataset_for.rb +186 -0
  49. data/lib/bio-publisci/dataset/interactive.rb +72 -0
  50. data/lib/bio-publisci/dsl/config.rb +34 -0
  51. data/lib/bio-publisci/dsl/dataset_dsl.rb +93 -0
  52. data/lib/bio-publisci/dsl/dsl.rb +72 -0
  53. data/lib/bio-publisci/dsl/metadata_dsl.rb +85 -0
  54. data/lib/bio-publisci/dsl/prov_dsl.rb +143 -0
  55. data/lib/bio-publisci/metadata/generator.rb +323 -0
  56. data/lib/bio-publisci/metadata/metadata.rb +5 -0
  57. data/lib/bio-publisci/metadata/metadata_model.rb +25 -0
  58. data/lib/bio-publisci/metadata/prov/activity.rb +88 -0
  59. data/lib/bio-publisci/metadata/prov/agent.rb +100 -0
  60. data/lib/bio-publisci/metadata/prov/association.rb +107 -0
  61. data/lib/bio-publisci/metadata/prov/config.rb +34 -0
  62. data/lib/bio-publisci/metadata/prov/derivation.rb +60 -0
  63. data/lib/bio-publisci/metadata/prov/element.rb +120 -0
  64. data/lib/bio-publisci/metadata/prov/entity.rb +64 -0
  65. data/lib/bio-publisci/metadata/prov/model/prov_models.rb +109 -0
  66. data/lib/bio-publisci/metadata/prov/plan.rb +32 -0
  67. data/lib/bio-publisci/metadata/prov/prov.rb +78 -0
  68. data/lib/bio-publisci/metadata/prov/role.rb +40 -0
  69. data/lib/bio-publisci/metadata/prov/usage.rb +64 -0
  70. data/lib/bio-publisci/metadata/publisher.rb +25 -0
  71. data/lib/bio-publisci/mixins/custom_predicate.rb +38 -0
  72. data/lib/bio-publisci/mixins/dereferencable.rb +34 -0
  73. data/lib/bio-publisci/mixins/registry.rb +27 -0
  74. data/lib/bio-publisci/mixins/vocabulary.rb +8 -0
  75. data/lib/bio-publisci/output.rb +27 -0
  76. data/lib/bio-publisci/parser.rb +266 -0
  77. data/lib/bio-publisci/post_processor.rb +95 -0
  78. data/lib/bio-publisci/query/query_helper.rb +123 -0
  79. data/lib/bio-publisci/r_client.rb +54 -0
  80. data/lib/bio-publisci/readers/arff.rb +49 -0
  81. data/lib/bio-publisci/readers/base.rb +57 -0
  82. data/lib/bio-publisci/readers/csv.rb +88 -0
  83. data/lib/bio-publisci/readers/dataframe.rb +67 -0
  84. data/lib/bio-publisci/readers/maf.rb +199 -0
  85. data/lib/bio-publisci/readers/r_cross.rb +112 -0
  86. data/lib/bio-publisci/readers/r_matrix.rb +176 -0
  87. data/lib/bio-publisci/store.rb +56 -0
  88. data/lib/bio-publisci/writers/arff.rb +91 -0
  89. data/lib/bio-publisci/writers/base.rb +93 -0
  90. data/lib/bio-publisci/writers/csv.rb +31 -0
  91. data/lib/bio-publisci/writers/dataframe.rb +81 -0
  92. data/lib/bio-publisci/writers/json.rb +18 -0
  93. data/lib/r2rdf.rb +226 -0
  94. data/lib/template_bak.rb +12 -0
  95. data/lib/template_bak/publisci.rb +3 -0
  96. data/lib/vocabs/cc.rb +18 -0
  97. data/lib/vocabs/cert.rb +13 -0
  98. data/lib/vocabs/dc.rb +63 -0
  99. data/lib/vocabs/dc11.rb +23 -0
  100. data/lib/vocabs/doap.rb +45 -0
  101. data/lib/vocabs/exif.rb +168 -0
  102. data/lib/vocabs/foaf.rb +69 -0
  103. data/lib/vocabs/geo.rb +13 -0
  104. data/lib/vocabs/http.rb +26 -0
  105. data/lib/vocabs/ma.rb +78 -0
  106. data/lib/vocabs/owl.rb +59 -0
  107. data/lib/vocabs/rdfs.rb +17 -0
  108. data/lib/vocabs/rsa.rb +12 -0
  109. data/lib/vocabs/rss.rb +14 -0
  110. data/lib/vocabs/sioc.rb +93 -0
  111. data/lib/vocabs/skos.rb +36 -0
  112. data/lib/vocabs/wot.rb +21 -0
  113. data/lib/vocabs/xhtml.rb +9 -0
  114. data/lib/vocabs/xsd.rb +58 -0
  115. data/resources/maf_example.maf +10 -0
  116. data/resources/maf_rdf.ttl +1173 -0
  117. data/resources/primer.ttl +38 -0
  118. data/resources/queries/code_resources.rq +10 -0
  119. data/resources/queries/codes.rq +18 -0
  120. data/resources/queries/dataset.rq +7 -0
  121. data/resources/queries/dimension_ranges.rq +8 -0
  122. data/resources/queries/dimensions.rq +12 -0
  123. data/resources/queries/gene.rq +16 -0
  124. data/resources/queries/hugo_to_ensembl.rq +7 -0
  125. data/resources/queries/maf_column.rq +26 -0
  126. data/resources/queries/measures.rq +12 -0
  127. data/resources/queries/observation_labels.rq +8 -0
  128. data/resources/queries/observations.rq +13 -0
  129. data/resources/queries/patient.rq +11 -0
  130. data/resources/queries/patient_list.rq +11 -0
  131. data/resources/queries/patients_with_mutation.rq +18 -0
  132. data/resources/queries/properties.rq +8 -0
  133. data/resources/queries/test.rq +3 -0
  134. data/resources/weather.numeric.arff +28 -0
  135. data/scripts/get_gene_lengths.rb +50 -0
  136. data/scripts/islet_mlratio.rb +6 -0
  137. data/scripts/scan_islet.rb +6 -0
  138. data/scripts/update_reference.rb +25 -0
  139. data/server/helpers.rb +215 -0
  140. data/server/public/src-min-noconflict/LICENSE +24 -0
  141. data/server/public/src-min-noconflict/ace.js +11 -0
  142. data/server/public/src-min-noconflict/ext-chromevox.js +1 -0
  143. data/server/public/src-min-noconflict/ext-elastic_tabstops_lite.js +1 -0
  144. data/server/public/src-min-noconflict/ext-emmet.js +1 -0
  145. data/server/public/src-min-noconflict/ext-keybinding_menu.js +1 -0
  146. data/server/public/src-min-noconflict/ext-language_tools.js +1 -0
  147. data/server/public/src-min-noconflict/ext-modelist.js +1 -0
  148. data/server/public/src-min-noconflict/ext-old_ie.js +1 -0
  149. data/server/public/src-min-noconflict/ext-searchbox.js +1 -0
  150. data/server/public/src-min-noconflict/ext-settings_menu.js +1 -0
  151. data/server/public/src-min-noconflict/ext-spellcheck.js +1 -0
  152. data/server/public/src-min-noconflict/ext-split.js +1 -0
  153. data/server/public/src-min-noconflict/ext-static_highlight.js +1 -0
  154. data/server/public/src-min-noconflict/ext-statusbar.js +1 -0
  155. data/server/public/src-min-noconflict/ext-textarea.js +1 -0
  156. data/server/public/src-min-noconflict/ext-themelist.js +1 -0
  157. data/server/public/src-min-noconflict/ext-whitespace.js +1 -0
  158. data/server/public/src-min-noconflict/keybinding-emacs.js +1 -0
  159. data/server/public/src-min-noconflict/keybinding-vim.js +1 -0
  160. data/server/public/src-min-noconflict/mode-ruby.js +1 -0
  161. data/server/public/src-min-noconflict/snippets/ruby.js +1 -0
  162. data/server/public/src-min-noconflict/theme-twilight.js +1 -0
  163. data/server/public/src-min-noconflict/worker-coffee.js +1 -0
  164. data/server/public/src-min-noconflict/worker-css.js +1 -0
  165. data/server/public/src-min-noconflict/worker-javascript.js +1 -0
  166. data/server/public/src-min-noconflict/worker-json.js +1 -0
  167. data/server/public/src-min-noconflict/worker-lua.js +1 -0
  168. data/server/public/src-min-noconflict/worker-php.js +1 -0
  169. data/server/public/src-min-noconflict/worker-xquery.js +1 -0
  170. data/server/routes.rb +123 -0
  171. data/server/views/dsl.haml +65 -0
  172. data/server/views/dump.haml +3 -0
  173. data/server/views/import.haml +35 -0
  174. data/server/views/new_repository.haml +25 -0
  175. data/server/views/query.haml +28 -0
  176. data/server/views/repository.haml +25 -0
  177. data/spec/ORM/data_cube_orm_spec.rb +33 -0
  178. data/spec/ORM/prov_model_spec.rb +72 -0
  179. data/spec/analyzer_spec.rb +36 -0
  180. data/spec/bnode_spec.rb +66 -0
  181. data/spec/csv/bacon.csv +4 -0
  182. data/spec/csv/moar_bacon.csv +11 -0
  183. data/spec/data_cube_spec.rb +169 -0
  184. data/spec/dataset_for_spec.rb +77 -0
  185. data/spec/dsl_spec.rb +134 -0
  186. data/spec/generators/csv_spec.rb +44 -0
  187. data/spec/generators/dataframe_spec.rb +44 -0
  188. data/spec/generators/maf_spec.rb +40 -0
  189. data/spec/generators/r_cross_spec.rb +51 -0
  190. data/spec/generators/r_matrix_spec.rb +44 -0
  191. data/spec/length_lookup_spec.rb +0 -0
  192. data/spec/maf_query_spec.rb +343 -0
  193. data/spec/metadata/metadata_dsl_spec.rb +68 -0
  194. data/spec/prov/activity_spec.rb +74 -0
  195. data/spec/prov/agent_spec.rb +54 -0
  196. data/spec/prov/association_spec.rb +55 -0
  197. data/spec/prov/config_spec.rb +28 -0
  198. data/spec/prov/derivation_spec.rb +30 -0
  199. data/spec/prov/entity_spec.rb +52 -0
  200. data/spec/prov/role_spec.rb +94 -0
  201. data/spec/prov/usage_spec.rb +98 -0
  202. data/spec/queries/integrity/1.rq +21 -0
  203. data/spec/queries/integrity/11.rq +29 -0
  204. data/spec/queries/integrity/12.rq +37 -0
  205. data/spec/queries/integrity/14.rq +25 -0
  206. data/spec/queries/integrity/19_1.rq +21 -0
  207. data/spec/queries/integrity/19_2.rq +15 -0
  208. data/spec/queries/integrity/2.rq +22 -0
  209. data/spec/queries/integrity/3.rq +19 -0
  210. data/spec/queries/integrity/4.rq +13 -0
  211. data/spec/queries/integrity/5.rq +14 -0
  212. data/spec/r_builder_spec.rb +33 -0
  213. data/spec/resource/.RData +0 -0
  214. data/spec/resource/example.Rhistory +3 -0
  215. data/spec/spec_helper.rb +17 -0
  216. data/spec/turtle/bacon +147 -0
  217. data/spec/turtle/reference +2064 -0
  218. data/spec/turtle/weather +275 -0
  219. data/spec/writer_spec.rb +75 -0
  220. metadata +589 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 276af2e741bcad49c2e8ff5c6b2e83dbfc331ba1
4
+ data.tar.gz: 289f4d7eda9047fcf18b626a9d66def6d033f3f7
5
+ SHA512:
6
+ metadata.gz: a4437108c231668ebe168d74ebb4e1027556c875f96ff49104c471e03922936de82d6d7a52beb6cfe28067b523d82f8aa890c1c0453a48db6260d40954795d30
7
+ data.tar.gz: 3dbbb11bb94f7a86e7a938b78fe9c72a177bc87b163bfea300670fab6c43e8deb440ff5017e5017a59c369bcbdf063bab894184fd3fe324fcde282fae07f8dfc
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - jruby-19mode # JRuby in 1.9 mode
6
+
7
+ # - rbx-19mode
8
+ # - 1.8.7
9
+ # - jruby-18mode # JRuby in 1.8 mode
10
+ # - rbx-18mode
11
+ #
12
+ # uncomment this line if your project needs to run something other than `rake`:
13
+ # script: bundle exec rspec spec
data/Gemfile ADDED
@@ -0,0 +1,36 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "rspec", "~> 2.8.0"
10
+ gem "rdoc", "~> 3.12"
11
+ gem "cucumber", ">= 0"
12
+ gem "jeweler", "~> 1.8.4", :git => "https://github.com/technicalpickles/jeweler.git"
13
+ gem "bundler", ">= 1.0.21"
14
+ gem "bio", ">= 1.4.2"
15
+ gem "rdoc", "~> 3.12"
16
+ gem "spoon"
17
+ gem "spira", git: "https://github.com/ruby-rdf/spira.git"
18
+ end
19
+
20
+
21
+ gem 'rdf'
22
+ gem 'rdf-4store', :git => "https://github.com/fumi/rdf-4store.git"
23
+ gem 'rdf-turtle'
24
+ gem 'rdf-rdfxml'
25
+ gem 'json-ld'
26
+ gem 'rserve-client'
27
+ gem 'sparql'
28
+
29
+ gem 'slop'
30
+
31
+ gem 'sinatra'
32
+ gem 'sinatra-contrib'
33
+ gem 'sinatra-linkeddata'
34
+ gem 'sinatra-cross_origin'
35
+ gem 'rack-flash3'
36
+ gem 'rest-client'
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 wstrinz
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # PubliSci
2
+
3
+ [![Build Status](https://secure.travis-ci.org/wstrinz/bioruby-publisci.png)](http://travis-ci.org/wstrinz/bioruby-publisci)
4
+
5
+ Full description goes here
6
+
7
+ Note: this software is under active development!
8
+
9
+ ## Installation
10
+
11
+ ```sh
12
+ gem install bio-publisci
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```ruby
18
+ require 'bio-publisci'
19
+ ```
20
+
21
+ The API doc is online. For more code examples see the test files in
22
+ the source tree.
23
+
24
+ ## Project home page
25
+
26
+ Information on the source tree, documentation, examples, issues and
27
+ how to contribute, see
28
+
29
+ http://github.com/wstrinz/bioruby-publisci
30
+
31
+ The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
32
+
33
+ ## Cite
34
+
35
+ If you use this software, please cite
36
+
37
+ * [The Ruby Science Foundation. 2013. SciRuby: Tools for scientific computing in Ruby. http://sciruby.com.](http://sciruby.com)
38
+
39
+ and one of
40
+
41
+ * [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
42
+ * [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
43
+
44
+ ## Biogems.info
45
+
46
+ This Biogem is published at (http://biogems.info/index.html#bio-publisci)
47
+
48
+ ## Copyright
49
+
50
+ Copyright (c) 2013 wstrinz. See LICENSE.txt for further details.
51
+
data/README.rdoc ADDED
@@ -0,0 +1,48 @@
1
+ = bio-publisci
2
+
3
+ {<img
4
+ src="https://secure.travis-ci.org/wstrinz/bioruby-publisci.png"
5
+ />}[http://travis-ci.org/#!/wstrinz/bioruby-publisci]
6
+
7
+ Full description goes here
8
+
9
+ Note: this software is under active development!
10
+
11
+ == Installation
12
+
13
+ gem install bio-publisci
14
+
15
+ == Usage
16
+
17
+ == Developers
18
+
19
+ To use the library
20
+
21
+ require 'bio-publisci'
22
+
23
+ The API doc is online. For more code examples see also the test files in
24
+ the source tree.
25
+
26
+ == Project home page
27
+
28
+ Information on the source tree, documentation, issues and how to contribute, see
29
+
30
+ http://github.com/wstrinz/bioruby-publisci
31
+
32
+ The BioRuby community is on IRC server: irc.freenode.org, channel: #bioruby.
33
+
34
+ == Cite
35
+
36
+ If you use this software, please cite one of
37
+
38
+ * [BioRuby: bioinformatics software for the Ruby programming language](http://dx.doi.org/10.1093/bioinformatics/btq475)
39
+ * [Biogem: an effective tool-based approach for scaling up open source software development in bioinformatics](http://dx.doi.org/10.1093/bioinformatics/bts080)
40
+
41
+ == Biogems.info
42
+
43
+ This Biogem is published at http://biogems.info/index.html#bio-publisci
44
+
45
+ == Copyright
46
+
47
+ Copyright (c) 2013 wstrinz. See LICENSE.txt for further details.
48
+
data/Rakefile ADDED
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "publisci"
18
+ gem.homepage = "http://github.com/wstrinz/bioruby-publisci"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Publish scientific results to the semantic web}
21
+ gem.description = %Q{A toolkit for publishing scientific results and datasets using RDF, OWL, and related technologies }
22
+ gem.email = "wstrinz@gmail.com"
23
+ gem.authors = ["Will Strinz"]
24
+ gem.version = "0.1.2"
25
+
26
+ # dependencies defined in Gemfile
27
+ end
28
+ Jeweler::RubygemsDotOrgTasks.new
29
+
30
+ require 'rspec/core'
31
+ require 'rspec/core/rake_task'
32
+ RSpec::Core::RakeTask.new(:spec) do |spec|
33
+ spec.rspec_opts = "--tag ~no_travis"
34
+ spec.pattern = FileList['spec/**/*_spec.rb']
35
+ end
36
+
37
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
38
+ spec.pattern = 'spec/**/*_spec.rb'
39
+ spec.rcov = true
40
+ end
41
+
42
+
43
+ require 'cucumber/rake/task'
44
+ Cucumber::Rake::Task.new(:features)
45
+
46
+ # task :default => :spec
47
+
48
+ task :default => [] do
49
+ Rake::Task[:spec].invoke
50
+ end
51
+
52
+ task :test => [] do
53
+ begin
54
+ Rake::Task[:spec].invoke
55
+ rescue
56
+ end
57
+ Rake::Task[:features].invoke
58
+ end
59
+
60
+ require 'rdoc/task'
61
+ Rake::RDocTask.new do |rdoc|
62
+ version = File.exist?('VERSION') ? File.read('VERSION') : "0.0.1"
63
+
64
+ rdoc.rdoc_dir = 'rdoc'
65
+ rdoc.title = "publisci #{version}"
66
+ rdoc.rdoc_files.include('README*')
67
+ rdoc.rdoc_files.include('lib/**/*.rb')
68
+ end
data/bin/bio-publisci ADDED
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # BioRuby bio-publisci Plugin BioPublisci
4
+ # Author:: wstrinz
5
+ # Copyright:: 2013
6
+
7
+ version = "0.0.4" #File.new(VERSION_FILENAME).read.chomp
8
+
9
+ USAGE = <<-EOF
10
+ bio-publisci #{version} by Will Strinz 2013
11
+
12
+ Usage:
13
+
14
+ bio-publisci file
15
+ (execute PROV dsl file)
16
+ EOF
17
+
18
+ gempath = File.dirname(File.dirname(__FILE__))
19
+ $: << File.join(gempath,'lib')
20
+ require 'bio-publisci'
21
+
22
+ #VERSION_FILENAME=File.join(gempath,'VERSION')
23
+
24
+ # print banner
25
+
26
+ if ARGV.size == 0
27
+ print USAGE
28
+ elsif ARGV.size == 1
29
+ #assume file, run DSL (prov for now)
30
+ if File.exist? ARGV[0]
31
+ puts "#{PubliSci::Prov.prefixes}\n#{PubliSci::Prov.run(ARGV[0])}"
32
+ else
33
+ puts "(no file #{ARGV[0]})"
34
+ print USAGE
35
+ end
36
+ else
37
+ if ARGV.size % 2 == 0
38
+ opts=Hash[*ARGV]
39
+ puts "got options #{opts}"
40
+ else
41
+ print USAGE
42
+ end
43
+ end
44
+
45
+ require 'bio-publisci'
46
+ require 'optparse'
47
+
48
+ # Uncomment when using the bio-logger
49
+ # require 'bio-logger'
50
+ # Bio::Log::CLI.logger('stderr')
51
+ # Bio::Log::CLI.trace('info')
52
+
53
+ options = {:example_switch=>false,:show_help=>false}
54
+ opts = OptionParser.new do |o|
55
+ o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
56
+
57
+ o.on('--example_parameter [EXAMPLE_PARAMETER]', 'TODO: put a description for the PARAMETER') do |example_parameter|
58
+ # TODO: your logic here, below an example
59
+ options[:example_parameter] = 'this is a parameter'
60
+ end
61
+
62
+ o.separator ""
63
+ o.on("--switch-example", 'TODO: put a description for the SWITCH') do
64
+ # TODO: your logic here, below an example
65
+ self[:example_switch] = true
66
+ end
67
+
68
+ # Uncomment the following when using the bio-logger
69
+ # o.separator ""
70
+ # o.on("--logger filename",String,"Log to file (default stderr)") do | name |
71
+ # Bio::Log::CLI.logger(name)
72
+ # end
73
+ #
74
+ # o.on("--trace options",String,"Set log level (default INFO, see bio-logger)") do | s |
75
+ # Bio::Log::CLI.trace(s)
76
+ # end
77
+ #
78
+ # o.on("-q", "--quiet", "Run quietly") do |q|
79
+ # Bio::Log::CLI.trace('error')
80
+ # end
81
+ #
82
+ # o.on("-v", "--verbose", "Run verbosely") do |v|
83
+ # Bio::Log::CLI.trace('info')
84
+ # end
85
+ #
86
+ # o.on("--debug", "Show debug messages") do |v|
87
+ # Bio::Log::CLI.trace('debug')
88
+ # end
89
+
90
+ o.separator ""
91
+ o.on_tail('-h', '--help', 'display this help and exit') do
92
+ options[:show_help] = true
93
+ end
94
+ end
95
+
96
+ begin
97
+ opts.parse!(ARGV)
98
+
99
+ # Uncomment the following when using the bio-logger
100
+ # Bio::Log::CLI.configure('bio-publisci')
101
+
102
+ # TODO: your code here
103
+ # use options for your logic
104
+ rescue OptionParser::InvalidOption => e
105
+ options[:invalid_argument] = e.message
106
+ end
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cgi'
3
+ require 'yaml'
4
+
5
+ require 'bio-publisci'
6
+ require 'slop'
7
+
8
+ require 'sinatra/base'
9
+ require "sinatra/linkeddata"
10
+ require "sinatra/cross_origin"
11
+ require 'rack-flash'
12
+
13
+ class PubliSciServer < Sinatra::Base
14
+ configure do
15
+ enable :sessions
16
+ enable :cross_origin
17
+ end
18
+
19
+ set :views, File.dirname(__FILE__) + '/../server/views'
20
+ # set :repository, RDF::Repository.new
21
+ set :sudo_pass, nil
22
+
23
+ use Rack::Flash
24
+
25
+ require_relative '../server/helpers.rb'
26
+
27
+ if ARGV[0]
28
+ opts = Slop.parse do
29
+ banner 'Usage: bio-publisci-server [options]'
30
+
31
+ on 'uri', 'Store URI', argument: :optional
32
+ on 't', 'type', 'The repository type', argument: :optional
33
+ on 'a', 'sudo_pass', 'Password for sudo (currently needed to clear 4store)', argument: :optional
34
+ on 'p', 'port', 'Sinatra port', argument: :optional
35
+ on 'o', 'bind', 'Bind address ', argument: :optional
36
+ end
37
+
38
+ configure_server(opts)
39
+ else
40
+ # set :repository, RDF::FourStore::Repository.new('http://localhost:8080')
41
+ set :repository, RDF::Repository.new
42
+
43
+ settings.repository.load(File.dirname(__FILE__) + '/../resources/primer.ttl')
44
+ end
45
+
46
+ require_relative '../server/routes.rb'
47
+
48
+
49
+ run!
50
+ end
@@ -0,0 +1,9 @@
1
+ require 'bio-band'
2
+ require 'bio-publisci'
3
+
4
+ f = open(File.dirname(__FILE__) + '/../resources/weather.numeric.arff')
5
+ clustering = Weka::Clusterer::SimpleKMeans::Base
6
+ clustering.set_options "-N 5"
7
+ clustering.set_data(Core::Parser::parse_ARFF(f.path))
8
+ clustered = clustering.new
9
+ puts clustered
@@ -0,0 +1,58 @@
1
+ # Example using as little generation "magic" as possible, for execution
2
+ # as plain Ruby script.
3
+ #
4
+ # Run using "ruby no_magic.prov"
5
+
6
+ require 'bio-publisci'
7
+ include PubliSci::Prov::DSL
8
+
9
+
10
+ # Subject and type for most elements can be set manually
11
+ agent :publisci, subject: 'http://gsocsemantic.wordpress.com/publisci', type: "software"
12
+ agent :R, subject: "http://r-project.org"
13
+ agent :sciruby, subject: "http://sciruby.com", type: "organization"
14
+
15
+ plan :R_steps, subject: "http://example.org/plan/R_steps", steps: "spec/resource/example.Rhistory"
16
+
17
+ agent :Will do
18
+ # subject can be called within a block as well
19
+ subject "http://gsocsemantic.wordpress.com/me"
20
+ type "person"
21
+ name "Will Strinz"
22
+ on_behalf_of "http://sciruby.com"
23
+ end
24
+
25
+ # The wasGeneratedBy relationship is usually created automatically when an activitiy
26
+ # is associated with an entity, but it can be specified manually
27
+ entity :triplified_example, subject: "http://example.org/dataset/ex", generated_by: :triplify
28
+
29
+ entity :original do
30
+ generated_by :use_R
31
+ subject "http://example.org/R/ex"
32
+ source "./example.RData"
33
+
34
+ # Custom predicates and objects can be used for flexibility and extensibility
35
+ has "http://purl.org/dc/terms/title", "original data object"
36
+ end
37
+
38
+ activity :triplify do
39
+ # Most methods will take either Symbols or Strings, and correctly handle
40
+ # resources vs literals
41
+ subject "http://example.org/activity/triplify"
42
+ generated "http://example.org/dataset/ex"
43
+ associated_with :publisci
44
+ used :original
45
+ end
46
+
47
+ activity :use_R do
48
+ subject "http://example.org/activity/use_R"
49
+ generated "http://example.org/R/ex"
50
+
51
+ associated_with :R
52
+ associated_with :Will
53
+ end
54
+
55
+ # Running a prov script using the gem executable will print the result, but
56
+ # if you use the DSL you'll have to do it manually. You also read out to a file
57
+ # or other method/object of course (eg "open('out.ttl','w'){|file| file.write generate_n3}")
58
+ puts generate_n3