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.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +36 -0
- data/LICENSE.txt +20 -0
- data/README.md +51 -0
- data/README.rdoc +48 -0
- data/Rakefile +68 -0
- data/bin/bio-publisci +106 -0
- data/bin/bio-publisci-server +50 -0
- data/examples/bio-band_integration.rb +9 -0
- data/examples/no_magic.prov +58 -0
- data/examples/no_magic.rb +58 -0
- data/examples/orm.prov +48 -0
- data/examples/primer-full.prov +120 -0
- data/examples/primer.prov +66 -0
- data/examples/prov_dsl.prov +85 -0
- data/examples/safe_gen.rb +7 -0
- data/examples/visualization/primer.prov +66 -0
- data/examples/visualization/prov_viz.rb +140 -0
- data/examples/visualization/viz.rb +35 -0
- data/features/create_generator.feature +21 -0
- data/features/integration.feature +12 -0
- data/features/integration_steps.rb +10 -0
- data/features/metadata.feature +37 -0
- data/features/metadata_steps.rb +40 -0
- data/features/orm.feature +60 -0
- data/features/orm_steps.rb +74 -0
- data/features/prov_dsl.feature +14 -0
- data/features/prov_dsl_steps.rb +11 -0
- data/features/reader.feature +25 -0
- data/features/reader_steps.rb +61 -0
- data/features/step_definitions/bio-publisci_steps.rb +0 -0
- data/features/store.feature +27 -0
- data/features/store_steps.rb +42 -0
- data/features/support/env.rb +13 -0
- data/features/writer.feature +14 -0
- data/features/writer_steps.rb +24 -0
- data/lib/bio-publisci.rb +64 -0
- data/lib/bio-publisci/analyzer.rb +57 -0
- data/lib/bio-publisci/datacube_model.rb +111 -0
- data/lib/bio-publisci/dataset/ORM/data_cube_orm.rb +240 -0
- data/lib/bio-publisci/dataset/ORM/observation.rb +20 -0
- data/lib/bio-publisci/dataset/configuration.rb +31 -0
- data/lib/bio-publisci/dataset/data_cube.rb +418 -0
- data/lib/bio-publisci/dataset/dataset.rb +11 -0
- data/lib/bio-publisci/dataset/dataset_for.rb +186 -0
- data/lib/bio-publisci/dataset/interactive.rb +72 -0
- data/lib/bio-publisci/dsl/config.rb +34 -0
- data/lib/bio-publisci/dsl/dataset_dsl.rb +93 -0
- data/lib/bio-publisci/dsl/dsl.rb +72 -0
- data/lib/bio-publisci/dsl/metadata_dsl.rb +85 -0
- data/lib/bio-publisci/dsl/prov_dsl.rb +143 -0
- data/lib/bio-publisci/metadata/generator.rb +323 -0
- data/lib/bio-publisci/metadata/metadata.rb +5 -0
- data/lib/bio-publisci/metadata/metadata_model.rb +25 -0
- data/lib/bio-publisci/metadata/prov/activity.rb +88 -0
- data/lib/bio-publisci/metadata/prov/agent.rb +100 -0
- data/lib/bio-publisci/metadata/prov/association.rb +107 -0
- data/lib/bio-publisci/metadata/prov/config.rb +34 -0
- data/lib/bio-publisci/metadata/prov/derivation.rb +60 -0
- data/lib/bio-publisci/metadata/prov/element.rb +120 -0
- data/lib/bio-publisci/metadata/prov/entity.rb +64 -0
- data/lib/bio-publisci/metadata/prov/model/prov_models.rb +109 -0
- data/lib/bio-publisci/metadata/prov/plan.rb +32 -0
- data/lib/bio-publisci/metadata/prov/prov.rb +78 -0
- data/lib/bio-publisci/metadata/prov/role.rb +40 -0
- data/lib/bio-publisci/metadata/prov/usage.rb +64 -0
- data/lib/bio-publisci/metadata/publisher.rb +25 -0
- data/lib/bio-publisci/mixins/custom_predicate.rb +38 -0
- data/lib/bio-publisci/mixins/dereferencable.rb +34 -0
- data/lib/bio-publisci/mixins/registry.rb +27 -0
- data/lib/bio-publisci/mixins/vocabulary.rb +8 -0
- data/lib/bio-publisci/output.rb +27 -0
- data/lib/bio-publisci/parser.rb +266 -0
- data/lib/bio-publisci/post_processor.rb +95 -0
- data/lib/bio-publisci/query/query_helper.rb +123 -0
- data/lib/bio-publisci/r_client.rb +54 -0
- data/lib/bio-publisci/readers/arff.rb +49 -0
- data/lib/bio-publisci/readers/base.rb +57 -0
- data/lib/bio-publisci/readers/csv.rb +88 -0
- data/lib/bio-publisci/readers/dataframe.rb +67 -0
- data/lib/bio-publisci/readers/maf.rb +199 -0
- data/lib/bio-publisci/readers/r_cross.rb +112 -0
- data/lib/bio-publisci/readers/r_matrix.rb +176 -0
- data/lib/bio-publisci/store.rb +56 -0
- data/lib/bio-publisci/writers/arff.rb +91 -0
- data/lib/bio-publisci/writers/base.rb +93 -0
- data/lib/bio-publisci/writers/csv.rb +31 -0
- data/lib/bio-publisci/writers/dataframe.rb +81 -0
- data/lib/bio-publisci/writers/json.rb +18 -0
- data/lib/r2rdf.rb +226 -0
- data/lib/template_bak.rb +12 -0
- data/lib/template_bak/publisci.rb +3 -0
- data/lib/vocabs/cc.rb +18 -0
- data/lib/vocabs/cert.rb +13 -0
- data/lib/vocabs/dc.rb +63 -0
- data/lib/vocabs/dc11.rb +23 -0
- data/lib/vocabs/doap.rb +45 -0
- data/lib/vocabs/exif.rb +168 -0
- data/lib/vocabs/foaf.rb +69 -0
- data/lib/vocabs/geo.rb +13 -0
- data/lib/vocabs/http.rb +26 -0
- data/lib/vocabs/ma.rb +78 -0
- data/lib/vocabs/owl.rb +59 -0
- data/lib/vocabs/rdfs.rb +17 -0
- data/lib/vocabs/rsa.rb +12 -0
- data/lib/vocabs/rss.rb +14 -0
- data/lib/vocabs/sioc.rb +93 -0
- data/lib/vocabs/skos.rb +36 -0
- data/lib/vocabs/wot.rb +21 -0
- data/lib/vocabs/xhtml.rb +9 -0
- data/lib/vocabs/xsd.rb +58 -0
- data/resources/maf_example.maf +10 -0
- data/resources/maf_rdf.ttl +1173 -0
- data/resources/primer.ttl +38 -0
- data/resources/queries/code_resources.rq +10 -0
- data/resources/queries/codes.rq +18 -0
- data/resources/queries/dataset.rq +7 -0
- data/resources/queries/dimension_ranges.rq +8 -0
- data/resources/queries/dimensions.rq +12 -0
- data/resources/queries/gene.rq +16 -0
- data/resources/queries/hugo_to_ensembl.rq +7 -0
- data/resources/queries/maf_column.rq +26 -0
- data/resources/queries/measures.rq +12 -0
- data/resources/queries/observation_labels.rq +8 -0
- data/resources/queries/observations.rq +13 -0
- data/resources/queries/patient.rq +11 -0
- data/resources/queries/patient_list.rq +11 -0
- data/resources/queries/patients_with_mutation.rq +18 -0
- data/resources/queries/properties.rq +8 -0
- data/resources/queries/test.rq +3 -0
- data/resources/weather.numeric.arff +28 -0
- data/scripts/get_gene_lengths.rb +50 -0
- data/scripts/islet_mlratio.rb +6 -0
- data/scripts/scan_islet.rb +6 -0
- data/scripts/update_reference.rb +25 -0
- data/server/helpers.rb +215 -0
- data/server/public/src-min-noconflict/LICENSE +24 -0
- data/server/public/src-min-noconflict/ace.js +11 -0
- data/server/public/src-min-noconflict/ext-chromevox.js +1 -0
- data/server/public/src-min-noconflict/ext-elastic_tabstops_lite.js +1 -0
- data/server/public/src-min-noconflict/ext-emmet.js +1 -0
- data/server/public/src-min-noconflict/ext-keybinding_menu.js +1 -0
- data/server/public/src-min-noconflict/ext-language_tools.js +1 -0
- data/server/public/src-min-noconflict/ext-modelist.js +1 -0
- data/server/public/src-min-noconflict/ext-old_ie.js +1 -0
- data/server/public/src-min-noconflict/ext-searchbox.js +1 -0
- data/server/public/src-min-noconflict/ext-settings_menu.js +1 -0
- data/server/public/src-min-noconflict/ext-spellcheck.js +1 -0
- data/server/public/src-min-noconflict/ext-split.js +1 -0
- data/server/public/src-min-noconflict/ext-static_highlight.js +1 -0
- data/server/public/src-min-noconflict/ext-statusbar.js +1 -0
- data/server/public/src-min-noconflict/ext-textarea.js +1 -0
- data/server/public/src-min-noconflict/ext-themelist.js +1 -0
- data/server/public/src-min-noconflict/ext-whitespace.js +1 -0
- data/server/public/src-min-noconflict/keybinding-emacs.js +1 -0
- data/server/public/src-min-noconflict/keybinding-vim.js +1 -0
- data/server/public/src-min-noconflict/mode-ruby.js +1 -0
- data/server/public/src-min-noconflict/snippets/ruby.js +1 -0
- data/server/public/src-min-noconflict/theme-twilight.js +1 -0
- data/server/public/src-min-noconflict/worker-coffee.js +1 -0
- data/server/public/src-min-noconflict/worker-css.js +1 -0
- data/server/public/src-min-noconflict/worker-javascript.js +1 -0
- data/server/public/src-min-noconflict/worker-json.js +1 -0
- data/server/public/src-min-noconflict/worker-lua.js +1 -0
- data/server/public/src-min-noconflict/worker-php.js +1 -0
- data/server/public/src-min-noconflict/worker-xquery.js +1 -0
- data/server/routes.rb +123 -0
- data/server/views/dsl.haml +65 -0
- data/server/views/dump.haml +3 -0
- data/server/views/import.haml +35 -0
- data/server/views/new_repository.haml +25 -0
- data/server/views/query.haml +28 -0
- data/server/views/repository.haml +25 -0
- data/spec/ORM/data_cube_orm_spec.rb +33 -0
- data/spec/ORM/prov_model_spec.rb +72 -0
- data/spec/analyzer_spec.rb +36 -0
- data/spec/bnode_spec.rb +66 -0
- data/spec/csv/bacon.csv +4 -0
- data/spec/csv/moar_bacon.csv +11 -0
- data/spec/data_cube_spec.rb +169 -0
- data/spec/dataset_for_spec.rb +77 -0
- data/spec/dsl_spec.rb +134 -0
- data/spec/generators/csv_spec.rb +44 -0
- data/spec/generators/dataframe_spec.rb +44 -0
- data/spec/generators/maf_spec.rb +40 -0
- data/spec/generators/r_cross_spec.rb +51 -0
- data/spec/generators/r_matrix_spec.rb +44 -0
- data/spec/length_lookup_spec.rb +0 -0
- data/spec/maf_query_spec.rb +343 -0
- data/spec/metadata/metadata_dsl_spec.rb +68 -0
- data/spec/prov/activity_spec.rb +74 -0
- data/spec/prov/agent_spec.rb +54 -0
- data/spec/prov/association_spec.rb +55 -0
- data/spec/prov/config_spec.rb +28 -0
- data/spec/prov/derivation_spec.rb +30 -0
- data/spec/prov/entity_spec.rb +52 -0
- data/spec/prov/role_spec.rb +94 -0
- data/spec/prov/usage_spec.rb +98 -0
- data/spec/queries/integrity/1.rq +21 -0
- data/spec/queries/integrity/11.rq +29 -0
- data/spec/queries/integrity/12.rq +37 -0
- data/spec/queries/integrity/14.rq +25 -0
- data/spec/queries/integrity/19_1.rq +21 -0
- data/spec/queries/integrity/19_2.rq +15 -0
- data/spec/queries/integrity/2.rq +22 -0
- data/spec/queries/integrity/3.rq +19 -0
- data/spec/queries/integrity/4.rq +13 -0
- data/spec/queries/integrity/5.rq +14 -0
- data/spec/r_builder_spec.rb +33 -0
- data/spec/resource/.RData +0 -0
- data/spec/resource/example.Rhistory +3 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/turtle/bacon +147 -0
- data/spec/turtle/reference +2064 -0
- data/spec/turtle/weather +275 -0
- data/spec/writer_spec.rb +75 -0
- metadata +589 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
require 'bio-publisci'
|
|
2
|
+
require 'graphviz'
|
|
3
|
+
|
|
4
|
+
def entity_node(label)
|
|
5
|
+
ent = @g.add_nodes(label)
|
|
6
|
+
ent.color = "#F3F781"
|
|
7
|
+
ent.style = "filled"
|
|
8
|
+
ent
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def agent_node(label)
|
|
12
|
+
ag = @g.add_nodes(label)
|
|
13
|
+
ag.color = "#FE9A2E"
|
|
14
|
+
ag.style = "filled"
|
|
15
|
+
ag.shape = "box"
|
|
16
|
+
ag
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def activity_node(label)
|
|
20
|
+
act = @g.add_nodes(label)
|
|
21
|
+
act.color = "#5858FA"
|
|
22
|
+
act.style = "filled"
|
|
23
|
+
act.shape = "box"
|
|
24
|
+
act
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def generic_node(label)
|
|
28
|
+
act = @g.add_nodes(label)
|
|
29
|
+
# act.color = "#5858FA"
|
|
30
|
+
# act.style = "filled"
|
|
31
|
+
act.shape = "box"
|
|
32
|
+
act
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def make_edges(from_obj,to_class,predicate)
|
|
36
|
+
# from_class.enum_for.to_a.map{|from_obj|
|
|
37
|
+
raise "Unknown From Node: #{from_obj.subject}" unless @nodemap[from_obj.subject]
|
|
38
|
+
relation = from_obj.send(predicate)
|
|
39
|
+
if relation
|
|
40
|
+
if relation.is_a? Array
|
|
41
|
+
relation.map{|r|
|
|
42
|
+
other = to_class.for(r)
|
|
43
|
+
raise "Unknown To Node: #{other.subject}" unless @nodemap[other.subject]
|
|
44
|
+
@g.add_edges(@nodemap[from_obj.subject],@nodemap[other.subject]).label=predicate.to_s
|
|
45
|
+
}
|
|
46
|
+
else
|
|
47
|
+
other = to_class.for(relation)
|
|
48
|
+
raise "Unknown To Node: #{other.subject}" unless @nodemap[other.subject]
|
|
49
|
+
@g.add_edges(@nodemap[from_obj.subject],@nodemap[other.subject]).label=predicate.to_s
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
# }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
@nodemap={}
|
|
56
|
+
@g = GraphViz.new(:G, type: :digraph)
|
|
57
|
+
infile = ARGV[0] || 'primer.prov'
|
|
58
|
+
runner = PubliSci::Prov::DSL::Instance.new
|
|
59
|
+
runner.instance_eval(IO.read(infile),infile)
|
|
60
|
+
repo = runner.to_repository
|
|
61
|
+
Spira.add_repository :default, repo
|
|
62
|
+
|
|
63
|
+
include PubliSci::Prov::Model
|
|
64
|
+
|
|
65
|
+
Entity.enum_for.to_a.map{|e|
|
|
66
|
+
@nodemap[e.subject]=entity_node(e.label)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Agent.enum_for.to_a.map{|agent|
|
|
70
|
+
@nodemap[agent.subject]=agent_node(agent.label)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
Activity.enum_for.to_a.map{|act|
|
|
74
|
+
@nodemap[act.subject]=activity_node(act.label)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Association.enum_for.to_a.map{|association|
|
|
78
|
+
@nodemap[association.subject]=generic_node(association.label)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
Plan.enum_for.to_a.map{|plan|
|
|
82
|
+
@nodemap[plan.subject]=generic_node(plan.label)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# Derivation.enum_for.to_a.map{|deriv|
|
|
87
|
+
# @nodemap[deriv.subject]=generic_node(deriv.label)
|
|
88
|
+
# }
|
|
89
|
+
|
|
90
|
+
Entity.enum_for.to_a.map{|e|
|
|
91
|
+
attribs ={
|
|
92
|
+
"wasAttributedTo" => Agent,
|
|
93
|
+
"wasGeneratedBy" => Activity,
|
|
94
|
+
"wasDerivedFrom" => Entity,
|
|
95
|
+
}
|
|
96
|
+
attribs.each{|predicate,range| make_edges(e,range,predicate)}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
Activity.enum_for.to_a.map{|act|
|
|
100
|
+
attribs ={
|
|
101
|
+
"generated" => Entity,
|
|
102
|
+
"used" => Entity,
|
|
103
|
+
"wasAssociatedWith" => Agent,
|
|
104
|
+
"qualifiedAssociation" => Agent,
|
|
105
|
+
}
|
|
106
|
+
attribs.each{|predicate,range| make_edges(act,range,predicate)}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
Agent.enum_for.to_a.map{|agent|
|
|
110
|
+
attribs = {
|
|
111
|
+
"actedOnBehalfOf" => Agent
|
|
112
|
+
}
|
|
113
|
+
attribs.each{|predicate,range| make_edges(agent,range,predicate)}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
Association.enum_for.to_a.map{|assoc|
|
|
117
|
+
attribs ={
|
|
118
|
+
"agent" => Agent,
|
|
119
|
+
"hadPlan" => Plan
|
|
120
|
+
}
|
|
121
|
+
attribs.each{|predicate,range| make_edges(assoc,range,predicate)}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# Association.enum_for.to_a.map{|assoc|
|
|
125
|
+
# attribs ={
|
|
126
|
+
# "agent" => Agent
|
|
127
|
+
# "hadPlan" => Plan
|
|
128
|
+
# }
|
|
129
|
+
# attribs.each{|predicate,range| make_edges(assoc,range,predicate)}
|
|
130
|
+
# }
|
|
131
|
+
|
|
132
|
+
# Derivation.enum_for.to_a.map{|assoc|
|
|
133
|
+
# attribs ={
|
|
134
|
+
# "agent" => Entity
|
|
135
|
+
# }
|
|
136
|
+
# attribs.each{|predicate,range| make_edges(assoc,range,predicate)}
|
|
137
|
+
# }
|
|
138
|
+
|
|
139
|
+
@g.output(png: "out.png")
|
|
140
|
+
begin `eog out.png` rescue nil end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require 'graphviz'
|
|
2
|
+
|
|
3
|
+
def entity_node(label)
|
|
4
|
+
ent = @g.add_nodes(label)
|
|
5
|
+
ent.color = "#F3F781"
|
|
6
|
+
ent.style = "filled"
|
|
7
|
+
ent
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def agent_node(label)
|
|
11
|
+
ag = @g.add_nodes(label)
|
|
12
|
+
ag.color = "#FE9A2E"
|
|
13
|
+
ag.style = "filled"
|
|
14
|
+
ag.shape = "box"
|
|
15
|
+
ag
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def activity_node(label)
|
|
19
|
+
act = @g.add_nodes(label)
|
|
20
|
+
act.color = "#5858FA"
|
|
21
|
+
act.style = "filled"
|
|
22
|
+
act.shape = "box"
|
|
23
|
+
act
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
@g = GraphViz.new(:G, type: :digraph)
|
|
27
|
+
g = @g
|
|
28
|
+
|
|
29
|
+
ent_n = entity_node("entity") #g.add_nodes("entity")
|
|
30
|
+
ag_n = activity_node("activity")
|
|
31
|
+
|
|
32
|
+
g.add_edges(ent_n,ag_n).label="attributed"
|
|
33
|
+
|
|
34
|
+
g.output(png: "out.png")
|
|
35
|
+
`eog out.png`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Feature: create generators
|
|
2
|
+
|
|
3
|
+
In order to check that objects conform to a common interface
|
|
4
|
+
I want to be able to call a generate method on various classes
|
|
5
|
+
|
|
6
|
+
Scenario: create a Dataframe generator
|
|
7
|
+
Given a Dataframe generator
|
|
8
|
+
Then I should be able to call its generate_n3 method
|
|
9
|
+
|
|
10
|
+
Scenario: create a CSV generator
|
|
11
|
+
Given a CSV generator
|
|
12
|
+
Then I should be able to call its generate_n3 method
|
|
13
|
+
|
|
14
|
+
Scenario: create a RMatrix generator
|
|
15
|
+
Given a RMatrix generator
|
|
16
|
+
Then I should be able to call its generate_n3 method
|
|
17
|
+
|
|
18
|
+
Scenario: create a RCross generator
|
|
19
|
+
Given a RCross generator
|
|
20
|
+
Then I should be able to call its generate_n3 method
|
|
21
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Feature: Integrate with other GSOC projects
|
|
2
|
+
|
|
3
|
+
In order to leverage the data sharing and comprehension power of RDF
|
|
4
|
+
I want to integrate my code with that of other GSOC students
|
|
5
|
+
|
|
6
|
+
Scenario: Integrate with Ruby Mining
|
|
7
|
+
Given a CSV generator
|
|
8
|
+
When I provide the reference file spec/csv/moar_bacon.csv and the label "moar_bacon" and the options {dimensions:["producer","pricerange"]}
|
|
9
|
+
And generate a turtle string from it
|
|
10
|
+
Given a ARFF writer
|
|
11
|
+
When I call its from_turtle method on the turtle string
|
|
12
|
+
Then I should be able to cluster the result and print statistics
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Then(/^I should be able to cluster the result and print statistics$/) do
|
|
2
|
+
pending
|
|
3
|
+
# f=Tempfile.open('arff'); f.write @result; f.close
|
|
4
|
+
# clustering = Weka::Clusterer::SimpleKMeans::Base
|
|
5
|
+
# clustering.set_options "-N 5"
|
|
6
|
+
# clustering.set_data(Core::Parser::parse_ARFF(f.path))
|
|
7
|
+
# f.unlink
|
|
8
|
+
# clustered = clustering.new
|
|
9
|
+
# puts clustered
|
|
10
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Feature: Receive metadata as user input or extract from data sources
|
|
2
|
+
|
|
3
|
+
In order to publish and share data about my datasets
|
|
4
|
+
I want to be able to attach metadata
|
|
5
|
+
|
|
6
|
+
Scenario: Attach basic DC Terms info
|
|
7
|
+
Given a class which includes the Metadata module
|
|
8
|
+
When I call its basic method with the hash {var: "example", title: "example dataset", creator: "Will Strinz", description: "an example dataset", date: "1-10-2010"}
|
|
9
|
+
Then I should receive a metadata string
|
|
10
|
+
|
|
11
|
+
Scenario: Auto Generate some fields
|
|
12
|
+
Given a class which includes the Metadata module
|
|
13
|
+
When I call its basic method with the hash {var: "example", title: "example dataset", description: "an example dataset"}
|
|
14
|
+
Then I should receive a metadata string
|
|
15
|
+
|
|
16
|
+
Scenario: Generate process information
|
|
17
|
+
Given a class which includes the Metadata module
|
|
18
|
+
And the source object {resource: 'http://example.org/software/R/var/ex', software:'http://r-project.org', process: 'spec/resource/example.Rhistory'}
|
|
19
|
+
And the rdf dataset {resource:'http://example.org/data'}
|
|
20
|
+
When I call its provenance method with the source object and the rdf object
|
|
21
|
+
Then I should receive a metadata string
|
|
22
|
+
|
|
23
|
+
Scenario: Generate organizational provenance information
|
|
24
|
+
Given a class which includes the Metadata module
|
|
25
|
+
And the source object {resource: 'http://example.org/software/R/var/ex', author: 'http://example.org/people/jrs', author_name: "J Random Scientist", organization: 'http://example.org/org/science', organization_name: "The League of Science" }
|
|
26
|
+
And the rdf dataset {resource:'http://example.org/data', author: 'http://gsocsemantic.wordpress.com/me', author_name: "Will Strinz", organization: 'http://sciruby.com/'}
|
|
27
|
+
When I call its provenance method with the source object and the rdf object
|
|
28
|
+
Then I should receive a metadata string
|
|
29
|
+
|
|
30
|
+
Scenario: Generate a provenance chain
|
|
31
|
+
Given a class which includes the Metadata module
|
|
32
|
+
And the source object {resource: 'http://example.org/software/R/var/ex', software:'http://r-project.org'}
|
|
33
|
+
And the rdf dataset {resource:'http://example.org/data'}
|
|
34
|
+
And the chain object {resource: 'http://example.org/lab_results/1', author: 'http://example.org/people/brl', author_name: "B Random Labtech"}
|
|
35
|
+
And the chain object {resource: 'http://example.org/field_work/1', author: 'http://example.org/people/arn', organization: 'http://example.org/org/science'}
|
|
36
|
+
When I call its provenance method with the source object, the rdf object, and the chain
|
|
37
|
+
Then I should receive a metadata string
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Given(/^a class which includes the Metadata module$/) do
|
|
2
|
+
|
|
3
|
+
@klass = Class.new {include PubliSci::Metadata::Generator}
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Given(/^the source object (\{.+\})$/) do |fields|
|
|
7
|
+
@original = eval(fields)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Given(/^the rdf dataset (\{.+\})$/) do |fields|
|
|
11
|
+
@rdf = eval(fields)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Given(/^the chain object (\{.+\})$/) do |fields|
|
|
15
|
+
(@chain ||= []) << eval(fields)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
When(/^I call its provenance method with the source object, the rdf object, and the chain$/) do
|
|
19
|
+
@response = @klass.new.provenance(@original, @rdf, @chain)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
When(/^I call its provenance method with the source object and the rdf object$/) do
|
|
24
|
+
@response = @klass.new.provenance(@original, @rdf, nil)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
When(/^I call its basic method with the hash (\{.+\})$/) do |fields|
|
|
28
|
+
fields = eval(fields)
|
|
29
|
+
@response = @klass.new.basic(fields)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
When(/^I call its provenance method with the hash (\{.+\})$/) do |fields|
|
|
33
|
+
fields = eval(fields)
|
|
34
|
+
@response = @klass.new.provenance(fields)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Then(/^I should receive a metadata string$/) do
|
|
38
|
+
@response.is_a?(String).should be true
|
|
39
|
+
puts @response
|
|
40
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
Feature: generate data using ORM
|
|
2
|
+
|
|
3
|
+
In order to make the generator simpler and more accessible to ruby users
|
|
4
|
+
I want to implement an ORM (OTM? OGM?) to assist creation of datacube objects
|
|
5
|
+
|
|
6
|
+
Scenario: build data cube and export turtle
|
|
7
|
+
Given an ORM::DataCube entitled "cats"
|
|
8
|
+
When I add a "size" dimension
|
|
9
|
+
And I add a "breed" dimension
|
|
10
|
+
And I add a "fluffiness" measure
|
|
11
|
+
And I add the observation {size: "big", breed: "American Shorthair", fluffiness: 100}
|
|
12
|
+
And I add the observation {size: "huge", breed: "Maine Coon", fluffiness: 9001}
|
|
13
|
+
And I add the observation {size: "little", breed: "American Shorthair", fluffiness: 15}
|
|
14
|
+
Then the to_n3 method should return a string
|
|
15
|
+
|
|
16
|
+
Scenario: load from turtle string
|
|
17
|
+
Given a turtle string from file spec/turtle/bacon
|
|
18
|
+
When I call the ORM::DataCube class method load on it
|
|
19
|
+
Then I should receive an ORM::DataCube object
|
|
20
|
+
And the to_n3 method should return a string
|
|
21
|
+
|
|
22
|
+
Scenario: load from endpoint
|
|
23
|
+
Given the URI string "http://localhost:8080"
|
|
24
|
+
When I call the ORM::DataCube class method load on it
|
|
25
|
+
Then I should receive an ORM::DataCube object
|
|
26
|
+
And the to_n3 method should return a string
|
|
27
|
+
|
|
28
|
+
Scenario: raise error when unknown components are used
|
|
29
|
+
Given an ORM::DataCube entitled "animals"
|
|
30
|
+
When I add a "robustness" dimension
|
|
31
|
+
And I add a "species" measure
|
|
32
|
+
And I add the observation {species: "Balaenoptera musculus", robustness: 25}
|
|
33
|
+
And I add the observation {species: "Hypsibius dujardini", robustness: 9001}
|
|
34
|
+
Then the to_n3 method should return a string
|
|
35
|
+
When I add the observation {species: "Deinococcus radiodurans", robustness: 350, chunkiness: 9}
|
|
36
|
+
Then the to_n3 method should raise error UnknownProperty ["chunkiness"]
|
|
37
|
+
|
|
38
|
+
Scenario: raise error when components are missing
|
|
39
|
+
Given an ORM::DataCube entitled "animals"
|
|
40
|
+
When I add a "robustness" dimension
|
|
41
|
+
And I add a "species" measure
|
|
42
|
+
And I add the observation {species: "Felis catus"}
|
|
43
|
+
Then the to_n3 method should raise error MissingValues for ["robustness"]
|
|
44
|
+
|
|
45
|
+
Scenario: raise error when components are missing
|
|
46
|
+
Given an ORM::DataCube entitled "animals" with the following options:
|
|
47
|
+
| key | value |
|
|
48
|
+
| :validate_each | true |
|
|
49
|
+
When I add a "robustness" dimension
|
|
50
|
+
And I add a "species" measure
|
|
51
|
+
Then adding the observation {species: "Caenorhabditis elegans"} should raise error MissingValues for ["robustness"]
|
|
52
|
+
|
|
53
|
+
Scenario: add metadata
|
|
54
|
+
Given an ORM::DataCube entitled "meta"
|
|
55
|
+
When I add a "robustness" dimension
|
|
56
|
+
And I add a "species" measure
|
|
57
|
+
And I add the observation {species: "Hypsibius dujardini", robustness: 9001}
|
|
58
|
+
And I call the cubes add_publisher method with the arguments "Moss Piglets Unlimited", "http://mosspiglet.org/"
|
|
59
|
+
Then the to_n3 method should return a string with a "dct:publisher"
|
|
60
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
require_relative '../lib/bio-publisci.rb'
|
|
2
|
+
|
|
3
|
+
Given /^an ORM::DataCube entitled "(.*?)"$/ do |name|
|
|
4
|
+
@cube = PubliSci::DataSet::ORM::DataCube.new(name: name)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Given /^an ORM::DataCube entitled "(.*?)" with the following options:$/ do |name, opts|
|
|
8
|
+
options_hash = {name: name}
|
|
9
|
+
opts.hashes.map{|hash|
|
|
10
|
+
k = hash["key"]
|
|
11
|
+
k = k[1..-1].to_sym if k[0] == ":"
|
|
12
|
+
|
|
13
|
+
v = hash["value"]
|
|
14
|
+
v = v[1..-1].to_sym if k[0] == ":"
|
|
15
|
+
|
|
16
|
+
v = true if v =="true"
|
|
17
|
+
v = false if v =="false"
|
|
18
|
+
|
|
19
|
+
options_hash[k] = v
|
|
20
|
+
}
|
|
21
|
+
@cube = PubliSci::DataSet::ORM::DataCube.new(options_hash)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
Given(/^a turtle string from file (.*)$/) do |file|
|
|
25
|
+
@string = IO.read(file)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Given(/^the URI string "(.*?)"$/) do |uri|
|
|
29
|
+
@string = uri
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
When(/^I call the ORM::DataCube class method load on it$/) do
|
|
33
|
+
@cube = PubliSci::DataSet::ORM::DataCube.load(@string)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
When /^I add a "(.*?)" dimension$/ do |dim|
|
|
37
|
+
@cube.add_dimension(dim)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
When /^I add a "(.*?)" measure$/ do |meas|
|
|
41
|
+
@cube.add_measure(meas)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
When /^I add the observation (.*)$/ do |obs|
|
|
45
|
+
data = eval(obs)
|
|
46
|
+
# obs.split(',').map{|entry| data[entry.chomp.strip.split(':')[0].to_s] = eval(entry.chomp.strip.split(':')[1])}
|
|
47
|
+
@cube.add_observation(data)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
When /^adding the observation (.*) should raise error (.*)$/ do |obs,err|
|
|
51
|
+
data = eval(obs)
|
|
52
|
+
expect { @cube.add_observation(data) }.to raise_error(err)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
When /^I call the cubes (.*) method with the arguments (.*)$/ do |method,args|
|
|
56
|
+
eval("args = #{args}")
|
|
57
|
+
@cube.send(method.to_sym, *args)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
Then /^the to_n3 method should return a string$/ do
|
|
61
|
+
@cube.to_n3.is_a?(String).should be true
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
Then /^the to_n3 method should raise error (.*?)$/ do |err|
|
|
65
|
+
expect { @cube.to_n3 }.to raise_error(err)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
Then /^the to_n3 method should return a string with a "(.*?)"$/ do |search|
|
|
69
|
+
@cube.to_n3[search].should_not be nil
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
Then(/^I should receive an ORM::DataCube object$/) do
|
|
73
|
+
@cube.is_a?(PubliSci::DataSet::ORM::DataCube).should == true
|
|
74
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Receive metadata as user input or extract from data sources
|
|
2
|
+
|
|
3
|
+
To generate clean provenance strings through a friendly interface
|
|
4
|
+
I want to use a DSL for the PROV ontology
|
|
5
|
+
|
|
6
|
+
Scenario: Generate based on example for w3.org
|
|
7
|
+
Given the prov DSL string from file examples/primer-full.prov
|
|
8
|
+
When I call Prov.run on it
|
|
9
|
+
Then I should receive a provenance string
|
|
10
|
+
|
|
11
|
+
Scenario: Generate from file
|
|
12
|
+
Given the prov DSL string from file examples/prov_dsl.prov
|
|
13
|
+
When I call Prov.run on it
|
|
14
|
+
Then I should receive a provenance string
|