bel 1.0.0 → 1.0.1

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/bin/bel_validate.rb +85 -0
  4. metadata +18 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee6f5ca76360462e55335f9e1c46479ce56798da
4
- data.tar.gz: b0f1a01dddc5d8cccf586b08c957cf153d6d8cfd
3
+ metadata.gz: 908e31594a6af1d90f0c9f73b8ef47c7593b2fbc
4
+ data.tar.gz: ad65172e5a69d3274e965339260d1e0550307702
5
5
  SHA512:
6
- metadata.gz: 86319d2b95fb02b39a18d9f7034adf147ab7e9625dd2915150a91ea7d657de471c7ea7641f8fba5195d6a3dabd421c869331fc68c407a02f03a6783c0d24b74e
7
- data.tar.gz: def4cf7f97273305d73d706b7362f14facdfbf9620a82c1b98731dc064e633fd31bf787ae3b225a71d582cf337173f753a5451576a3dc66d691fbf788f69b0cb
6
+ metadata.gz: 57467e0b474808bcb1f2b63a34b2bd48de86cffada5c077a71ba95a139c8dc22c355b7a094c2fc87fdbae8ce4903719e9ea6ce97ab8bb2d0b060c1ed8ed03448
7
+ data.tar.gz: 9318c0ff4fcb9b499c400b7466d8a66e7518d77ca72a6f78228e86ab35d2ddf38656fe9fa42a6baebde3a5c3596dc27fb4afcfd1dddba9934299b99217b1aae4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+ # bel_validate: Show parsed objects from XBEL file or stdin content for debugging purposes.
3
+ #
4
+ # From file
5
+ # usage: bel_validate -f file.xbel
6
+ #
7
+ # From standard in
8
+ # usage: echo "<BEL DOCUMENT STRING>" | bel_validate
9
+
10
+ $:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
11
+ require 'bel'
12
+ require 'optparse'
13
+
14
+ # additive String helpers
15
+ class String
16
+ def rjust_relative(distance, string)
17
+ rjust(distance - string.size + size)
18
+ end
19
+ end
20
+
21
+ # setup and parse options
22
+ options = {}
23
+ OptionParser.new do |opts|
24
+ opts.banner = "Usage: bel_validate [options] [.xbel file]"
25
+ opts.on('-x', '--xbel FILE', 'XBEL file to parse. STDIN (standard in) can also be used for XBEL content.') do |xbel|
26
+ options[:xbel] = xbel
27
+ end
28
+ end.parse!
29
+
30
+ if options[:xbel] and not File.exists? options[:xbel]
31
+ $stderr.puts "No file for xbel, #{options[:xbel]}"
32
+ exit 1
33
+ end
34
+
35
+ # read xbel content
36
+ content =
37
+ if options[:xbel]
38
+ File.open(options[:xbel], :external_encoding => 'UTF-8')
39
+ else
40
+ $stdin
41
+ end
42
+
43
+ #namespaces = ... # bel2_validate
44
+
45
+ class Main
46
+
47
+ def initialize(content)
48
+ BEL.nanopub(content, :xbel).each do |obj|
49
+ spec = BELParser::Language.specification obj.metadata.bel_version
50
+ namespaces = obj.references.namespaces.each.map do |ns|
51
+ end
52
+ stmt_str = obj.bel_statement.to_s
53
+ namespaces = {}
54
+ BELParser::Expression::Validator
55
+ .new(spec, namespaces, BELParser::Resource.default_uri_reader, BELParser::Resource.default_url_reader)
56
+ .each(StringIO.new stmt_str) do |(line_number, line, ast, results)|
57
+ puts "#{line_number}: #{line}"
58
+ puts " AST Type: #{ast.type}"
59
+
60
+ puts " Syntax results:"
61
+
62
+ results.syntax_results.each do |res|
63
+ puts " #{res}"
64
+ end
65
+
66
+ puts " Semantics results:"
67
+ results.semantics_results.each do |res|
68
+ if res.is_a?(BELParser::Language::Semantics::SignatureMappingSuccess)
69
+ puts " Matched signature: #{res.signature.string_form}"
70
+ end
71
+ if res.is_a?(BELParser::Language::Semantics::SignatureMappingWarning)
72
+ puts " Failed signature: #{res.signature.string_form}"
73
+ res.results.select(&:failure?).each do |warning|
74
+ puts " #{warning}"
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+ Main.new(content)
84
+ # vim: ts=2 sw=2:
85
+ # encoding: utf-8
metadata CHANGED
@@ -1,76 +1,76 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Bargnesi
8
8
  - Natalie Catlett
9
9
  - Nick Bargnesi
10
10
  - William Hayes
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
  date: 2016-06-08 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: bel_parser
18
17
  requirement: !ruby/object:Gem::Requirement
19
18
  requirements:
20
19
  - - "~>"
21
20
  - !ruby/object:Gem::Version
22
21
  version: 1.0.0
23
- type: :runtime
22
+ name: bel_parser
24
23
  prerelease: false
24
+ type: :runtime
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.0.0
30
30
  - !ruby/object:Gem::Dependency
31
- name: rdf
32
31
  requirement: !ruby/object:Gem::Requirement
33
32
  requirements:
34
33
  - - "~>"
35
34
  - !ruby/object:Gem::Version
36
35
  version: 2.0.0
37
- type: :runtime
36
+ name: rdf
38
37
  prerelease: false
38
+ type: :runtime
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: 2.0.0
44
44
  - !ruby/object:Gem::Dependency
45
- name: rdf-vocab
46
45
  requirement: !ruby/object:Gem::Requirement
47
46
  requirements:
48
47
  - - "~>"
49
48
  - !ruby/object:Gem::Version
50
49
  version: 2.0.0
51
- type: :runtime
50
+ name: rdf-vocab
52
51
  prerelease: false
52
+ type: :runtime
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
57
  version: 2.0.0
58
58
  - !ruby/object:Gem::Dependency
59
- name: ffi
60
59
  requirement: !ruby/object:Gem::Requirement
61
60
  requirements:
62
61
  - - '='
63
62
  - !ruby/object:Gem::Version
64
63
  version: 1.9.8
65
- type: :runtime
64
+ name: ffi
66
65
  prerelease: false
66
+ type: :runtime
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - '='
70
70
  - !ruby/object:Gem::Version
71
71
  version: 1.9.8
72
- description: " The BEL gem allows the reading, writing, and processing of BEL (Biological
73
- Expression Language) with a natural DSL. "
72
+ description: " The BEL gem allows the reading, writing, and processing of BEL (Biological\
73
+ \ Expression Language) with a natural DSL. "
74
74
  email:
75
75
  - abargnesi@selventa.com
76
76
  - ncatlett@selventa.com
@@ -82,6 +82,7 @@ executables:
82
82
  - bel_parse.rb
83
83
  - bel
84
84
  - bel2rdf.rb
85
+ - bel_validate.rb
85
86
  - bel_compare.rb
86
87
  - bel_rdfschema.rb
87
88
  extensions:
@@ -103,6 +104,7 @@ files:
103
104
  - bin/bel_rdfschema.rb
104
105
  - bin/bel_summarize.rb
105
106
  - bin/bel_upgrade.rb
107
+ - bin/bel_validate.rb
106
108
  - ext/mri/bel-ast.c
107
109
  - ext/mri/bel-ast.h
108
110
  - ext/mri/bel-node-stack.c
@@ -247,7 +249,7 @@ homepage: https://github.com/OpenBEL/bel.rb
247
249
  licenses:
248
250
  - Apache-2.0
249
251
  metadata: {}
250
- post_install_message:
252
+ post_install_message:
251
253
  rdoc_options:
252
254
  - "--title"
253
255
  - BEL Ruby Documentation
@@ -283,10 +285,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
285
  - !ruby/object:Gem::Version
284
286
  version: '0'
285
287
  requirements: []
286
- rubyforge_project:
287
- rubygems_version: 2.5.1
288
- signing_key:
288
+ rubyforge_project:
289
+ rubygems_version: 2.6.4
290
+ signing_key:
289
291
  specification_version: 4
290
292
  summary: Process BEL with ruby.
291
293
  test_files: []
292
- has_rdoc: