bel_parser 1.0.0.alpha.34 → 1.0.0.alpha.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e1e76aac6cddc28a72044c48817cd06f64fbb46
4
- data.tar.gz: 7f94685c8bea050f62113df06eff30289fe7b23a
3
+ metadata.gz: 2146335395f5a41bb0344d6c9318fa282a992717
4
+ data.tar.gz: c9d8cb3623c5bee85f8a82a70c3f5db762229a03
5
5
  SHA512:
6
- metadata.gz: 25c0e44cc23e2713315123438330356a8730a263ef513f8948610732f2932f095d65cad1d13b2aa55ce1ae7fd7c65eaf30eed56d1027b5c46fc0aaa556f5a6f7
7
- data.tar.gz: ac99e19b7d99d34ef9309675debf385d0c4391f28614192c3307896fa866b33189b6a945eaa233cc7b8aed5091980999cabfc6b404552a86ca9d47902c692097
6
+ metadata.gz: 44d14c01868f3c034077f1c6d33b58dc2f5b9a145a6cd79223e353c014045cd088c6a69bbba5ad2983296b896ca303d8d1a573dc48129dd8b3e92fe766fcf618
7
+ data.tar.gz: 01440f40494138c891264c19c41ebe0c31074fe1657fde659a9f7259165fee2f66620e7b42e9eb5691b215491da51995d633ae97f6f60df121b4ff095f219af0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0.alpha.34
1
+ 1.0.0.alpha.35
@@ -24,9 +24,7 @@ module BEL::Translator::Plugins
24
24
  Validator.new(
25
25
  StateAggregator.new(
26
26
  FirstNode.new(Filter.new(BELParser::ASTGenerator.new(@io))),
27
- @state)),
28
- true,
29
- false
27
+ @state))
30
28
  ).each do |(num, line, ast_node, nanopub_hash)|
31
29
  yield ::BEL::Nanopub::Nanopub.create(nanopub_hash)
32
30
  end
@@ -6,36 +6,33 @@ module BELParser
6
6
  include Enumerable
7
7
 
8
8
  attr_reader :keyword
9
- attr_reader :uri
10
- attr_reader :url
9
+ attr_reader :type
10
+ attr_reader :domain
11
11
 
12
- def initialize(keyword, uri = nil, url = nil, options = {})
12
+ def initialize(keyword, type, domain, options = {})
13
13
  raise(ArgumentError, 'keyword is nil') unless keyword
14
+ raise(ArgumentError, 'type is nil') unless type
15
+ raise(ArgumentError, 'domain is nil') unless domain
16
+
14
17
  @keyword = keyword
15
- @uri = uri
16
- @url = url
18
+ @type = type.to_sym
19
+ @domain = domain
17
20
 
18
21
  # configure reader for URIs (RDF).
19
- @uri_reader =
20
- options.fetch(:uri_reader) {
21
- BELParser::Resource.default_uri_reader
22
- }
22
+ @uri_reader = options.fetch(:uri_reader, nil)
23
23
  BELParser::Resource::Reader.assert_reader(@uri_reader, 'uri_reader')
24
24
 
25
25
  # configure reader for URLs (Resource files).
26
- @url_reader =
27
- options.fetch(:url_reader) {
28
- BELParser::Resource.default_url_reader
29
- }
26
+ @url_reader = options.fetch(:url_reader, nil)
30
27
  BELParser::Resource::Reader.assert_reader(@url_reader, 'url_reader')
31
28
  end
32
29
 
33
30
  def uri?
34
- !@uri.nil?
31
+ @type == :uri
35
32
  end
36
33
 
37
34
  def url?
38
- !@url.nil?
35
+ @type == :url
39
36
  end
40
37
 
41
38
  def [](value)
@@ -127,7 +127,7 @@ module BELParser
127
127
 
128
128
  def domain_value(type, domain)
129
129
  case type
130
- when :uri
130
+ when :url, :uri
131
131
  domain.identifier
132
132
  when :list
133
133
  domain
@@ -53,7 +53,7 @@ module BELParser
53
53
  url = unquote(url_node.string.string_literal)
54
54
  dataset = script_context[:resource_reader].retrieve_resource(url)
55
55
  script_context[:annotation_definitions] ||= Concurrent::Hash.new
56
- script_context[:annotation_definitions][prefix] = [:uri, dataset]
56
+ script_context[:annotation_definitions][prefix] = [:url, dataset]
57
57
  end
58
58
  private_class_method :handle_url
59
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bel_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.alpha.34
4
+ version: 1.0.0.alpha.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Bargnesi