bel_parser 1.0.0.alpha.34-java → 1.0.0.alpha.35-java
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: 1bee9bb5548e37c4791fb17862924577964a6aba
|
4
|
+
data.tar.gz: a101322192c6e9d5a9d540282a48809b2797c058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85bae47ad26722aa889ea30cc4cdced771a8a875e49df767bd7109bd79f909b72e7ee003539fe01a63ed8040fc4b85c66b717f3935419b5dd7f6fcff8752c68f
|
7
|
+
data.tar.gz: e24ffb234ed915b63b8d02c20ea417da6fc8a250ab602b52817bc37c793073ba307dac61880737125c50075f5f9e888ff084875e504f86e6794b9b3e737abfb5
|
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
|