bel_parser 1.0.8 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +12 -2
- data/VERSION +1 -1
- data/bin/bel2_compatibility +12 -9
- data/bin/bel2_upgrade +18 -6
- data/bin/bel2_validator +6 -3
- data/bin/bel_script_reader +1 -0
- data/lib/bel_parser/completion.rb +984 -0
- data/lib/bel_parser/language/apply_namespace_encoding.rb +14 -3
- data/lib/bel_parser/language/expression_validator.rb +1 -2
- data/lib/bel_parser/language/function.rb +4 -0
- data/lib/bel_parser/language/relationship.rb +4 -0
- data/lib/bel_parser/language/semantics/function_deprecation.rb +1 -0
- data/lib/bel_parser/language/semantics/list_function_subject.rb +2 -0
- data/lib/bel_parser/language/semantics/multiple_subject_object.rb +4 -1
- data/lib/bel_parser/language/semantics/nested_statement_without_object.rb +43 -0
- data/lib/bel_parser/language/semantics/non_object_list.rb +3 -0
- data/lib/bel_parser/language/semantics/relationship_not_listable.rb +2 -0
- data/lib/bel_parser/language/semantics/signature_mapping.rb +2 -0
- data/lib/bel_parser/language/semantics_ast.rb +0 -7
- data/lib/bel_parser/language/syntax/invalid_function.rb +6 -1
- data/lib/bel_parser/language/syntax/invalid_relationship.rb +1 -0
- data/lib/bel_parser/language/version1_0/relationships/acts_in.rb +9 -9
- data/lib/bel_parser/language/version1_0/relationships/analogous.rb +6 -4
- data/lib/bel_parser/language/version1_0/relationships/association.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/biomarker_for.rb +6 -5
- data/lib/bel_parser/language/version1_0/relationships/causes_no_change.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/decreases.rb +13 -12
- data/lib/bel_parser/language/version1_0/relationships/directly_decreases.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/directly_increases.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/has_component.rb +14 -14
- data/lib/bel_parser/language/version1_0/relationships/has_components.rb +12 -11
- data/lib/bel_parser/language/version1_0/relationships/has_member.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/has_members.rb +12 -11
- data/lib/bel_parser/language/version1_0/relationships/has_modification.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/has_product.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/has_variant.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/includes.rb +11 -10
- data/lib/bel_parser/language/version1_0/relationships/increases.rb +12 -13
- data/lib/bel_parser/language/version1_0/relationships/is_a.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/negative_correlation.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/orthologous.rb +9 -8
- data/lib/bel_parser/language/version1_0/relationships/positive_correlation.rb +8 -5
- data/lib/bel_parser/language/version1_0/relationships/prognostic_biomarker_for.rb +8 -6
- data/lib/bel_parser/language/version1_0/relationships/rate_limiting_step_of.rb +10 -9
- data/lib/bel_parser/language/version1_0/relationships/reactant_in.rb +10 -8
- data/lib/bel_parser/language/version1_0/relationships/sub_process_of.rb +13 -12
- data/lib/bel_parser/language/version1_0/relationships/transcribed_to.rb +8 -7
- data/lib/bel_parser/language/version1_0/relationships/translated_to.rb +9 -7
- data/lib/bel_parser/language/version1_0/relationships/translocates.rb +10 -9
- data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +1 -2
- data/lib/bel_parser/language/version2_0/functions/translocation.rb +1 -2
- data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -2
- data/lib/bel_parser/language/version2_0/relationships/acts_in.rb +10 -9
- data/lib/bel_parser/language/version2_0/relationships/biomarker_for.rb +7 -5
- data/lib/bel_parser/language/version2_0/relationships/causes_no_change.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/decreases.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/directly_decreases.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/directly_increases.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/has_component.rb +15 -14
- data/lib/bel_parser/language/version2_0/relationships/has_components.rb +12 -11
- data/lib/bel_parser/language/version2_0/relationships/has_member.rb +9 -8
- data/lib/bel_parser/language/version2_0/relationships/has_members.rb +12 -11
- data/lib/bel_parser/language/version2_0/relationships/has_modification.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/has_product.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/has_variant.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/includes.rb +11 -10
- data/lib/bel_parser/language/version2_0/relationships/increases.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/is_a.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/negative_correlation.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/orthologous.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/positive_correlation.rb +7 -5
- data/lib/bel_parser/language/version2_0/relationships/prognostic_biomarker_for.rb +8 -6
- data/lib/bel_parser/language/version2_0/relationships/rate_limiting_step_of.rb +10 -9
- data/lib/bel_parser/language/version2_0/relationships/reactant_in.rb +10 -8
- data/lib/bel_parser/language/version2_0/relationships/regulates.rb +9 -8
- data/lib/bel_parser/language/version2_0/relationships/sub_process_of.rb +13 -12
- data/lib/bel_parser/language/version2_0/relationships/transcribed_to.rb +8 -7
- data/lib/bel_parser/language/version2_0/relationships/translated_to.rb +9 -7
- data/lib/bel_parser/language/version2_0/relationships/translocates.rb +10 -9
- data/lib/bel_parser/mixin/levenshtein.rb +20 -0
- data/lib/bel_parser/parsers/ast/node.rb +49 -2
- data/lib/bel_parser/parsers/bel_script/define_annotation.rb +156 -156
- data/lib/bel_parser/parsers/bel_script/define_namespace.rb +60 -60
- data/lib/bel_parser/parsers/bel_script/set.rb +200 -200
- data/lib/bel_parser/parsers/bel_script/set_document.rb +188 -188
- data/lib/bel_parser/parsers/bel_script/unset.rb +14 -14
- data/lib/bel_parser/parsers/common/common.rl +1 -0
- data/lib/bel_parser/parsers/common/function.rb +8 -8
- data/lib/bel_parser/parsers/common/function.rl +6 -6
- data/lib/bel_parser/parsers/common/identifier.rb +3 -3
- data/lib/bel_parser/parsers/common/identifier.rl +4 -4
- data/lib/bel_parser/parsers/common/list.rb +78 -78
- data/lib/bel_parser/parsers/common/multi_identifier.rb +275 -0
- data/lib/bel_parser/parsers/common/multi_identifier.rl +141 -0
- data/lib/bel_parser/parsers/common/string.rb +6 -6
- data/lib/bel_parser/parsers/common/string.rl +4 -4
- data/lib/bel_parser/parsers/common.rb +1 -0
- data/lib/bel_parser/parsers/expression/nested_statement.rb +30180 -29055
- data/lib/bel_parser/parsers/expression/observed_term.rb +1456 -1099
- data/lib/bel_parser/parsers/expression/parameter.rb +192 -111
- data/lib/bel_parser/parsers/expression/parameter.rl +6 -3
- data/lib/bel_parser/parsers/expression/relationship.rb +43 -19
- data/lib/bel_parser/parsers/expression/relationship.rl +1 -0
- data/lib/bel_parser/parsers/expression/simple_statement.rb +17805 -17093
- data/lib/bel_parser/parsers/expression/statement_autocomplete.rb +1035 -0
- data/lib/bel_parser/parsers/expression/statement_autocomplete.rl +736 -0
- data/lib/bel_parser/parsers/expression/term.rb +960 -705
- data/lib/bel_parser/parsers/serializer.rb +8 -4
- data/lib/bel_parser/version.rb +33 -0
- data/lib/bel_parser.rb +3 -0
- metadata +25 -3
@@ -53,7 +53,9 @@ module BELParser
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def on_function(function_node)
|
56
|
-
|
56
|
+
if function_node.identifier
|
57
|
+
@string << function_node.identifier.string_literal
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
def on_identifier(identifier_node)
|
@@ -138,9 +140,11 @@ module BELParser
|
|
138
140
|
|
139
141
|
def on_statement(statement_node)
|
140
142
|
process(statement_node.subject)
|
141
|
-
return if statement_node.object.child.nil?
|
142
143
|
|
144
|
+
return unless statement_node.relationship?
|
143
145
|
process(statement_node.relationship)
|
146
|
+
|
147
|
+
return unless statement_node.object?
|
144
148
|
object_node = statement_node.object
|
145
149
|
if object_node.statement?
|
146
150
|
@string << '('
|
@@ -152,7 +156,7 @@ module BELParser
|
|
152
156
|
end
|
153
157
|
|
154
158
|
def on_string(string_node)
|
155
|
-
@string << %("#{string_node.
|
159
|
+
@string << %("#{string_node.string_value}")
|
156
160
|
end
|
157
161
|
|
158
162
|
def on_subject(subject_node)
|
@@ -197,7 +201,7 @@ if __FILE__ == $PROGRAM_NAME
|
|
197
201
|
|
198
202
|
types = ARGV.map(&:to_sym)
|
199
203
|
generator = BELParser::ASTGenerator.new($stdin)
|
200
|
-
BELParser::ASTFilter.new(generator, *types).each do |(
|
204
|
+
BELParser::ASTFilter.new(generator, *types).each do |(_, _, results)|
|
201
205
|
serializer = BELParser::Parsers::Serializer.new
|
202
206
|
serializer.process(results.first)
|
203
207
|
puts serializer.string
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module BELParser
|
2
|
+
# Captures the semantic version of the library.
|
3
|
+
module Version
|
4
|
+
# The frozen version {String}. See {Object#freeze}.
|
5
|
+
STRING =
|
6
|
+
File.read(
|
7
|
+
File.join(
|
8
|
+
File.expand_path(File.dirname(__FILE__)), '..', '..', 'VERSION'
|
9
|
+
)).chomp.freeze
|
10
|
+
|
11
|
+
# The frozen {Fixnum version numbers}. See {Object#freeze}.
|
12
|
+
MAJOR, MINOR, PATCH = STRING.split('.').map(&:freeze)
|
13
|
+
# The frozen {Array} of {Fixnum version numbers}. See {Object#freeze}.
|
14
|
+
VERSION_NUMBERS = [MAJOR, MINOR, PATCH].freeze
|
15
|
+
|
16
|
+
# Add singleton methods to the metaclass of {BEL::Version}.
|
17
|
+
class << self
|
18
|
+
|
19
|
+
# Return the frozen, semantic version {String}.
|
20
|
+
# @return [frozen String] the semantic version
|
21
|
+
def to_s
|
22
|
+
STRING
|
23
|
+
end
|
24
|
+
alias :to_str :to_s
|
25
|
+
|
26
|
+
# Return the frozen, semantic version number {Array}.
|
27
|
+
# @return [frozen Array] the semantic version numbers
|
28
|
+
def to_a
|
29
|
+
VERSION_NUMBERS
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/bel_parser.rb
CHANGED
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.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Bargnesi
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sparql-client
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: 2.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: damerau-levenshtein
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 1.2.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.2.0
|
28
42
|
description: Implements language versions 1.0 and 2.0.
|
29
43
|
email: abargnesi@selventa.com
|
30
44
|
executables:
|
@@ -57,6 +71,7 @@ files:
|
|
57
71
|
- lib/bel_parser.rb
|
58
72
|
- lib/bel_parser/ast_filter.rb
|
59
73
|
- lib/bel_parser/ast_generator.rb
|
74
|
+
- lib/bel_parser/completion.rb
|
60
75
|
- lib/bel_parser/expression.rb
|
61
76
|
- lib/bel_parser/expression/filter.rb
|
62
77
|
- lib/bel_parser/expression/model.rb
|
@@ -80,6 +95,7 @@ files:
|
|
80
95
|
- lib/bel_parser/language/semantics/function_deprecation.rb
|
81
96
|
- lib/bel_parser/language/semantics/list_function_subject.rb
|
82
97
|
- lib/bel_parser/language/semantics/multiple_subject_object.rb
|
98
|
+
- lib/bel_parser/language/semantics/nested_statement_without_object.rb
|
83
99
|
- lib/bel_parser/language/semantics/non_causal_nested_statement.rb
|
84
100
|
- lib/bel_parser/language/semantics/non_object_list.rb
|
85
101
|
- lib/bel_parser/language/semantics/relationship_deprecation.rb
|
@@ -294,6 +310,7 @@ files:
|
|
294
310
|
- lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb
|
295
311
|
- lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb
|
296
312
|
- lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb
|
313
|
+
- lib/bel_parser/mixin/levenshtein.rb
|
297
314
|
- lib/bel_parser/mixin/line_mapping.rb
|
298
315
|
- lib/bel_parser/parsers/ast/node.rb
|
299
316
|
- lib/bel_parser/parsers/ast/sexp.rb
|
@@ -321,6 +338,8 @@ files:
|
|
321
338
|
- lib/bel_parser/parsers/common/identifier.rl
|
322
339
|
- lib/bel_parser/parsers/common/list.rb
|
323
340
|
- lib/bel_parser/parsers/common/list.rl
|
341
|
+
- lib/bel_parser/parsers/common/multi_identifier.rb
|
342
|
+
- lib/bel_parser/parsers/common/multi_identifier.rl
|
324
343
|
- lib/bel_parser/parsers/common/string.rb
|
325
344
|
- lib/bel_parser/parsers/common/string.rl
|
326
345
|
- lib/bel_parser/parsers/expression.rb
|
@@ -336,6 +355,8 @@ files:
|
|
336
355
|
- lib/bel_parser/parsers/expression/relationship.rl
|
337
356
|
- lib/bel_parser/parsers/expression/simple_statement.rb
|
338
357
|
- lib/bel_parser/parsers/expression/simple_statement.rl
|
358
|
+
- lib/bel_parser/parsers/expression/statement_autocomplete.rb
|
359
|
+
- lib/bel_parser/parsers/expression/statement_autocomplete.rl
|
339
360
|
- lib/bel_parser/parsers/expression/term.rb
|
340
361
|
- lib/bel_parser/parsers/expression/term.rl
|
341
362
|
- lib/bel_parser/parsers/line_parser.rb
|
@@ -387,6 +408,7 @@ files:
|
|
387
408
|
- lib/bel_parser/vendor/ast/processor.rb
|
388
409
|
- lib/bel_parser/vendor/ast/processor/mixin.rb
|
389
410
|
- lib/bel_parser/vendor/ast/sexp.rb
|
411
|
+
- lib/bel_parser/version.rb
|
390
412
|
homepage: https://github.com/OpenBEL/bel_parser
|
391
413
|
licenses:
|
392
414
|
- Apache-2.0
|
@@ -407,7 +429,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
407
429
|
version: '0'
|
408
430
|
requirements: []
|
409
431
|
rubyforge_project:
|
410
|
-
rubygems_version: 2.
|
432
|
+
rubygems_version: 2.6.8
|
411
433
|
signing_key:
|
412
434
|
specification_version: 4
|
413
435
|
summary: Parser for Biolgical Expression Language.
|