publisci 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,98 @@
1
+ require_relative '../../lib/bio-publisci.rb'
2
+ include PubliSci::Prov::DSL
3
+
4
+ describe PubliSci::Prov::Usage do
5
+
6
+ before(:each) do
7
+ @evaluator = PubliSci::Prov::DSL::Instance.new
8
+ end
9
+
10
+ it "can create simple associations" do
11
+ ent1 = @ev.entity :some_data
12
+ ent2 = @ev.entity :other_data
13
+ ag = @ev.agent :some_guy
14
+ act = @ev.activity :do_things do
15
+ generated :some_data
16
+ associated_with :some_guy
17
+ used do
18
+ entity :other_data
19
+ role :plagirized
20
+ end
21
+ end
22
+ act.used[0].entity.should == ent2
23
+ end
24
+
25
+ it "can generate n3" do
26
+ ent1 = @ev.entity :some_data
27
+ ent2 = @ev.entity :other_data
28
+ ag = @ev.agent :some_guy
29
+ act = @ev.activity :do_things do
30
+ generated :some_data
31
+ associated_with :some_guy
32
+ used do
33
+ entity :other_data
34
+ role :plagirized
35
+ end
36
+ end
37
+ act.to_n3["prov:qualifiedUsage"].size.should > 0
38
+ act.used[0].to_n3["a prov:Usage"].size.should > 0
39
+ end
40
+
41
+ # it "can specify fields manually" do
42
+ # a = activity :name, subject: "http://example.org/name"
43
+ # a.subject.should == "http://example.org/name"
44
+ # end
45
+
46
+ # it "can be created with a block" do
47
+ # e = entity :data
48
+ # a = activity :ag do
49
+ # subject "http://things.com/stuff"
50
+ # generated :data
51
+ # end
52
+ # a.is_a?(Activity).should be true
53
+ # a.subject.should == "http://things.com/stuff"
54
+ # end
55
+
56
+ # it "lazy loads other objects" do
57
+ # a = activity :ag do
58
+ # subject "http://things.com/stuff"
59
+ # generated :data
60
+ # end
61
+ # e = entity :data
62
+
63
+ # a.generated[0].should == e
64
+ # end
65
+
66
+ # it "raises an exception when used does not refer to an entity" do
67
+ # a = activity :name, used: :some_data
68
+ # expect {a.used[0]}.to raise_error
69
+ # end
70
+
71
+ # it "raises an exception when generated does not refer to an entity" do
72
+ # a = activity :name, generated: :other_data
73
+ # expect {a.generated[0]}.to raise_error
74
+ # end
75
+
76
+ # it "lazy loads generated relationships" do
77
+ # a = activity :act, generated: :data
78
+ # e = entity :data
79
+
80
+ # a.generated[0].should == e
81
+ # end
82
+
83
+ # it "lazy loads used relationships" do
84
+ # a = activity :act, generated: :data, used: :other_data
85
+ # e = entity :data
86
+ # f = entity :other_data
87
+
88
+ # a.used[0].should == f
89
+ # end
90
+
91
+ # it "lazy loads other objects, so declaration order doesn't usually matter" do
92
+ # a = activity :name, on_behalf_of: :other
93
+ # b = activity :other
94
+
95
+ # a.on_behalf_of.should == b
96
+ # end
97
+
98
+ end
@@ -0,0 +1,21 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-1. Unique DataSet
9
+
10
+ SELECT ?obs {
11
+ {
12
+ # Check observation has a data set
13
+ ?obs a qb:Observation .
14
+ MINUS { ?obs qb:dataSet ?dataset1 . }
15
+ } UNION {
16
+ # Check has just one data set
17
+ ?obs a qb:Observation ;
18
+ qb:dataSet ?dataset1, ?dataset2 .
19
+ FILTER (?dataset1 != ?dataset2)
20
+ }
21
+ }
@@ -0,0 +1,29 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-11. All dimensions required (modified)
9
+
10
+ SELECT * WHERE {
11
+ #also include qb:dimension resources
12
+ {
13
+ ?obs qb:dataSet ?ds .
14
+ ?ds qb:structure ?dsd .
15
+ ?dsd qb:component ?comp .
16
+ ?comp qb:componentProperty ?dim .
17
+ }
18
+ UNION
19
+ {
20
+ ?obs qb:dataSet ?ds .
21
+ ?ds qb:structure ?dsd .
22
+ ?dsd qb:component ?comp .
23
+ ?comp qb:dimension ?dim .
24
+ }
25
+
26
+
27
+ ?dim a qb:DimensionProperty;
28
+ FILTER NOT EXISTS { ?obs ?dim [] }
29
+ }
@@ -0,0 +1,37 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-12. No duplicate observations (modified)
9
+ # No two qb:Observations in the same qb:DataSet may have the same value for all dimensions.
10
+
11
+ SELECT * WHERE {
12
+ FILTER( ?allEqual )
13
+ {
14
+ # For each pair of observations test if all the dimension values are the same
15
+ SELECT (MIN(?equal) AS ?allEqual) WHERE {
16
+ ?obs1 qb:dataSet ?dataset .
17
+ ?obs2 qb:dataSet ?dataset .
18
+ FILTER (?obs1 != ?obs2)
19
+ {
20
+ ?dataset qb:structure ?dsd .
21
+ ?ds qb:component ?comp .
22
+ ?comp qb:componentProperty ?dim.
23
+ }
24
+ UNION
25
+ {
26
+ ?dataset qb:structure ?dsd .
27
+ ?dsd qb:component ?comp .
28
+ ?comp qb:dimension ?dim .
29
+ }
30
+
31
+ ?dim a qb:DimensionProperty .
32
+ ?obs1 ?dim ?value1 .
33
+ ?obs2 ?dim ?value2 .
34
+ BIND( ?value1 = ?value2 AS ?equal)
35
+ } GROUP BY ?obs1 ?obs2
36
+ }
37
+ }
@@ -0,0 +1,25 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-14. All measures present
9
+
10
+ SELECT * WHERE {
11
+ # Observation in a non-measureType cube
12
+ ?obs qb:dataSet ?dset .
13
+ ?dset qb:structure ?dsd .
14
+ FILTER NOT EXISTS {
15
+ ?dsd qb:component ?comp .
16
+ ?comp qb:componentProperty ?prop .
17
+ ?prop qb:measureType [] .
18
+ }
19
+
20
+ # verify every measure is present
21
+ ?dsd qb:component ?comp .
22
+ ?comp qb:componentProperty ?measure .
23
+ ?measure a qb:MeasureProperty;
24
+ FILTER NOT EXISTS { ?obs ?measure [] }
25
+ }
@@ -0,0 +1,21 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ #IC-19_1 Codes from code list
9
+
10
+ SELECT * WHERE {
11
+ ?obs qb:dataSet ?ds .
12
+ ?ds qb:structure ?str .
13
+ ?str qb:component ?prop .
14
+ ?prop qb:componentProperty ?dim .
15
+ ?dim a qb:DimensionProperty ;
16
+ qb:codeList ?list .
17
+ ?list a skos:ConceptScheme .
18
+ ?obs ?dim ?v .
19
+ FILTER NOT EXISTS { ?v a skos:Concept ; skos:inScheme ?list }
20
+ }
21
+
@@ -0,0 +1,15 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ SELECT * WHERE {
9
+ ?obs qb:dataSet/qb:structure/qb:component/qb:componentProperty ?dim .
10
+ ?dim a qb:DimensionProperty ;
11
+ qb:codeList ?list .
12
+ ?list a skos:Collection .
13
+ ?obs ?dim ?v .
14
+ FILTER NOT EXISTS { ?v a skos:Concept . ?list skos:member+ ?v }
15
+ }
@@ -0,0 +1,22 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-2. Unique DSD
9
+
10
+ SELECT * {
11
+ {
12
+ # Check dataset has a dsd
13
+ ?dataset a qb:DataSet .
14
+ FILTER NOT EXISTS { ?dataset qb:structure ?dsd . }
15
+ } UNION {
16
+ # Check has just one dsd
17
+ ?dataset a qb:DataSet ;
18
+ qb:structure ?dsd1, ?dsd2 .
19
+ FILTER (?dsd1 != ?dsd2)
20
+ }
21
+ }
22
+
@@ -0,0 +1,19 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-3. DSD includes measure (modified)
9
+
10
+ SELECT * WHERE {
11
+ ?dsd a qb:DataStructureDefinition ;
12
+
13
+ FILTER NOT EXISTS {
14
+ #original spec missing this definition
15
+ { ?dsd qb:component [qb:measure []] }
16
+ UNION
17
+ { ?dsd qb:component [qb:componentProperty [a qb:MeasureProperty]] }
18
+ }
19
+ }
@@ -0,0 +1,13 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-4. Dimensions have range
9
+
10
+ SELECT * WHERE {
11
+ ?dim a qb:DimensionProperty .
12
+ FILTER NOT EXISTS { ?dim rdfs:range [] }
13
+ }
@@ -0,0 +1,14 @@
1
+ PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
2
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
3
+ PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
4
+ PREFIX qb: <http://purl.org/linked-data/cube#>
5
+ PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
6
+ PREFIX owl: <http://www.w3.org/2002/07/owl#>
7
+
8
+ # IC-5. Concept dimensions have code lists
9
+
10
+ SELECT * WHERE {
11
+ ?dim a qb:DimensionProperty ;
12
+ rdfs:range skos:Concept .
13
+ #FILTER NOT EXISTS { ?dim qb:codeList [] }
14
+ }
@@ -0,0 +1,33 @@
1
+ # require_relative '../lib/r2rdf/data_cube.rb'
2
+ # require_relative '../lib/r2rdf/generators/dataframe.rb'
3
+ # require_relative '../lib/r2rdf/r_client.rb'
4
+ # require_relative '../lib/r2rdf/r_builder.rb'
5
+ # require_relative '../lib/r2rdf/query_helper.rb'
6
+ # require_relative '../lib/r2rdf/generators/csv.rb'
7
+ require_relative '../lib/bio-publisci.rb'
8
+
9
+
10
+ describe PubliSci::Writers::Dataframe do
11
+
12
+ context "when using r/qtl dataframe", no_travis: true do
13
+
14
+ before(:all) do
15
+ @r = Rserve::Connection.new
16
+ @r.eval <<-EOF
17
+ library(qtl)
18
+ data(listeria)
19
+ mr = scanone(listeria,method="mr")
20
+ EOF
21
+ @builder = PubliSci::Writers::Builder.new
22
+ end
23
+
24
+ it "produces equivalent dataframe from rdf" #do
25
+ #(a) problem is that builder and the @r connection are different b/c of
26
+ #how rserve works
27
+ # @builder.from_turtle(File.dirname(__FILE__) +'/turtle/reference', @r, 'mr', 'mo', false, false)
28
+ # puts @r.eval('ls()').payload.to_ruby
29
+ # @r.eval('identical(mr,mo)').to_ruby.should == true
30
+ #end
31
+
32
+ end
33
+ end
Binary file
@@ -0,0 +1,3 @@
1
+ library(qtl)
2
+ data(listeria)
3
+ mr = scanone(listeria,method='mr')
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
data/spec/turtle/bacon ADDED
@@ -0,0 +1,147 @@
1
+ @base <http://onto.strinz.me/dc/dataset/bacon/> .
2
+ @prefix ns: <http://onto.strinz.me/dc/dataset/bacon/> .
3
+ @prefix qb: <http://purl.org/linked-data/cube#> .
4
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
5
+ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
6
+ @prefix prop: <http://onto.strinz.me/properties/> .
7
+ @prefix dct: <http://purl.org/dc/terms/> .
8
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
9
+ @prefix cs: <http://onto.strinz.me/dc/dataset/bacon/cs/> .
10
+ @prefix code: <http://onto.strinz.me/dc/dataset/bacon/code/> .
11
+ @prefix owl: <http://www.w3.org/2002/07/owl#> .
12
+ @prefix skos: <http://www.w3.org/2004/02/skos/core#> .
13
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
14
+ @prefix org: <http://www.w3.org/ns/org#> .
15
+ @prefix prov: <http://www.w3.org/ns/prov#> .
16
+
17
+ ns:dsd-bacon a qb:DataStructureDefinition;
18
+ qb:component cs:producer ;
19
+ qb:component cs:pricerange ;
20
+ qb:component cs:chunkiness ;
21
+ qb:component cs:deliciousness .
22
+
23
+ ns:dataset-bacon a qb:DataSet ;
24
+ rdfs:label "bacon"@en ;
25
+ qb:structure ns:dsd-bacon .
26
+
27
+ cs:producer a qb:ComponentSpecification ;
28
+ rdfs:label "producer" ;
29
+ qb:dimension prop:producer .
30
+
31
+ cs:pricerange a qb:ComponentSpecification ;
32
+ rdfs:label "pricerange" ;
33
+ qb:dimension prop:pricerange .
34
+
35
+ cs:chunkiness a qb:ComponentSpecification ;
36
+ rdfs:label "chunkiness" ;
37
+ qb:measure prop:chunkiness .
38
+
39
+ cs:deliciousness a qb:ComponentSpecification ;
40
+ rdfs:label "deliciousness" ;
41
+ qb:measure prop:deliciousness .
42
+
43
+ prop:producer a rdf:Property, qb:DimensionProperty ;
44
+ rdfs:label "producer"@en ;
45
+ qb:codeList code:producer ;
46
+ rdfs:range code:Producer .
47
+
48
+ prop:pricerange a rdf:Property, qb:DimensionProperty ;
49
+ rdfs:label "pricerange"@en ;
50
+ qb:codeList code:pricerange ;
51
+ rdfs:range code:Pricerange .
52
+
53
+ prop:chunkiness a rdf:Property, qb:MeasureProperty ;
54
+ rdfs:label "chunkiness"@en .
55
+
56
+ prop:deliciousness a rdf:Property, qb:MeasureProperty ;
57
+ rdfs:label "deliciousness"@en .
58
+
59
+ code:Producer a rdfs:Class, owl:Class;
60
+ rdfs:subClassOf skos:Concept ;
61
+ rdfs:label "Code list for producer - codelist class"@en;
62
+ rdfs:comment "Specifies the producer for each observation";
63
+ rdfs:seeAlso code:producer .
64
+
65
+ code:producer a skos:ConceptScheme;
66
+ skos:prefLabel "Code list for producer - codelist scheme"@en;
67
+ rdfs:label "Code list for producer - codelist scheme"@en;
68
+ skos:notation "CL_PRODUCER";
69
+ skos:note "Specifies the producer for each observation";
70
+ skos:hasTopConcept <code/producer/hormel> ;
71
+ skos:hasTopConcept <code/producer/newskies> ;
72
+ skos:hasTopConcept <code/producer/whys> ;
73
+ .
74
+
75
+ code:Pricerange a rdfs:Class, owl:Class;
76
+ rdfs:subClassOf skos:Concept ;
77
+ rdfs:label "Code list for pricerange - codelist class"@en;
78
+ rdfs:comment "Specifies the pricerange for each observation";
79
+ rdfs:seeAlso code:pricerange .
80
+
81
+ code:pricerange a skos:ConceptScheme;
82
+ skos:prefLabel "Code list for pricerange - codelist scheme"@en;
83
+ rdfs:label "Code list for pricerange - codelist scheme"@en;
84
+ skos:notation "CL_PRICERANGE";
85
+ skos:note "Specifies the pricerange for each observation";
86
+ skos:hasTopConcept <code/pricerange/low> ;
87
+ skos:hasTopConcept <code/pricerange/medium> ;
88
+ skos:hasTopConcept <code/pricerange/nonexistant> ;
89
+ .
90
+
91
+ <code/producer/hormel> a skos:Concept, code:Producer;
92
+ skos:topConceptOf code:producer ;
93
+ skos:prefLabel "hormel" ;
94
+ skos:inScheme code:producer .
95
+
96
+ <code/producer/newskies> a skos:Concept, code:Producer;
97
+ skos:topConceptOf code:producer ;
98
+ skos:prefLabel "newskies" ;
99
+ skos:inScheme code:producer .
100
+
101
+ <code/producer/whys> a skos:Concept, code:Producer;
102
+ skos:topConceptOf code:producer ;
103
+ skos:prefLabel "whys" ;
104
+ skos:inScheme code:producer .
105
+
106
+ <code/pricerange/low> a skos:Concept, code:Pricerange;
107
+ skos:topConceptOf code:pricerange ;
108
+ skos:prefLabel "low" ;
109
+ skos:inScheme code:pricerange .
110
+
111
+ <code/pricerange/medium> a skos:Concept, code:Pricerange;
112
+ skos:topConceptOf code:pricerange ;
113
+ skos:prefLabel "medium" ;
114
+ skos:inScheme code:pricerange .
115
+
116
+ <code/pricerange/nonexistant> a skos:Concept, code:Pricerange;
117
+ skos:topConceptOf code:pricerange ;
118
+ skos:prefLabel "nonexistant" ;
119
+ skos:inScheme code:pricerange .
120
+
121
+ ns:obshormel a qb:Observation ;
122
+ qb:dataSet ns:dataset-bacon ;
123
+ rdfs:label "hormel" ;
124
+ prop:producer <code/producer/hormel> ;
125
+ prop:pricerange <code/pricerange/low> ;
126
+ prop:chunkiness 1 ;
127
+ prop:deliciousness 1 ;
128
+ .
129
+
130
+ ns:obsnewskies a qb:Observation ;
131
+ qb:dataSet ns:dataset-bacon ;
132
+ rdfs:label "newskies" ;
133
+ prop:producer <code/producer/newskies> ;
134
+ prop:pricerange <code/pricerange/medium> ;
135
+ prop:chunkiness 6 ;
136
+ prop:deliciousness 9 ;
137
+ .
138
+
139
+ ns:obswhys a qb:Observation ;
140
+ qb:dataSet ns:dataset-bacon ;
141
+ rdfs:label "whys" ;
142
+ prop:producer <code/producer/whys> ;
143
+ prop:pricerange <code/pricerange/nonexistant> ;
144
+ prop:chunkiness 9001 ;
145
+ prop:deliciousness 6 ;
146
+ .
147
+