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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2146335395f5a41bb0344d6c9318fa282a992717
|
4
|
+
data.tar.gz: c9d8cb3623c5bee85f8a82a70c3f5db762229a03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44d14c01868f3c034077f1c6d33b58dc2f5b9a145a6cd79223e353c014045cd088c6a69bbba5ad2983296b896ca303d8d1a573dc48129dd8b3e92fe766fcf618
|
7
|
+
data.tar.gz: 01440f40494138c891264c19c41ebe0c31074fe1657fde659a9f7259165fee2f66620e7b42e9eb5691b215491da51995d633ae97f6f60df121b4ff095f219af0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.0.alpha.
|
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 :
|
10
|
-
attr_reader :
|
9
|
+
attr_reader :type
|
10
|
+
attr_reader :domain
|
11
11
|
|
12
|
-
def initialize(keyword,
|
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
|
-
@
|
16
|
-
@
|
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
|
-
|
31
|
+
@type == :uri
|
35
32
|
end
|
36
33
|
|
37
34
|
def url?
|
38
|
-
|
35
|
+
@type == :url
|
39
36
|
end
|
40
37
|
|
41
38
|
def [](value)
|
@@ -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] = [:
|
56
|
+
script_context[:annotation_definitions][prefix] = [:url, dataset]
|
57
57
|
end
|
58
58
|
private_class_method :handle_url
|
59
59
|
end
|