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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918e134aad64f9a085893f1efe594fc7c7bc8176
|
4
|
+
data.tar.gz: 58c493d5631689b4230e9055dbe443381abe9e75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 747d0dfc27dae01731d43e7d464819d935be23d96a78321a88d6e82947a8a3389745381e1a23343a96494c25d43308807f8af31076e9a09e82598e6ee0ab4924
|
7
|
+
data.tar.gz: ff4584aa710cdba505a0ec05c24d731b8c8b058608178432cbd42d108bf054080372f3d1d6ae0e78a49105fed85dd793c27d3235207e9adec5f2da8ac103bd39
|
data/.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
'Anthony Bargnesi',
|
12
12
|
'Nick Bargnesi',
|
13
13
|
]
|
14
|
-
spec.date = %q{
|
14
|
+
spec.date = %q{2017-01-13}
|
15
15
|
spec.email = %q{abargnesi@selventa.com}
|
16
16
|
spec.files = [
|
17
17
|
Dir.glob('lib/**/*.{rb,rl}'),
|
@@ -26,5 +26,15 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
spec.required_ruby_version = '>= 2.0.0'
|
28
28
|
|
29
|
-
|
29
|
+
if RUBY_ENGINE =~ /jruby/
|
30
|
+
spec.platform = 'java'
|
31
|
+
spec.add_runtime_dependency 'sparql-client', '~> 2.0.0'
|
32
|
+
spec.add_runtime_dependency 'dbm-mapdb3', '~> 0.6.0.beta'
|
33
|
+
spec.add_runtime_dependency 'levenshtein-jruby', '0.1.0'
|
34
|
+
else
|
35
|
+
spec.platform = 'ruby'
|
36
|
+
spec.add_runtime_dependency 'sparql-client', '~> 2.0.0'
|
37
|
+
spec.add_runtime_dependency 'damerau-levenshtein', '1.2.0'
|
38
|
+
end
|
30
39
|
end
|
40
|
+
# vim: ft=ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.1
|
data/bin/bel2_compatibility
CHANGED
@@ -15,6 +15,18 @@ OptionParser.new do |opts|
|
|
15
15
|
opts.banner = <<-USAGE.gsub(/^ {4}/, '')
|
16
16
|
Confirm compatibility with BEL 2.0 expressions.
|
17
17
|
USAGE
|
18
|
+
|
19
|
+
if RUBY_ENGINE =~ /^jruby/i
|
20
|
+
opts.on(
|
21
|
+
'-t',
|
22
|
+
'--read-jena-tdb DIRECTORY',
|
23
|
+
'Jena TDB directory containing BEL RDF resources.') do |tdb|
|
24
|
+
|
25
|
+
require 'bel_parser/resource/jena_tdb_reader'
|
26
|
+
options[:uri_reader] = BELParser::Resource::JenaTDBReader.new(tdb)
|
27
|
+
BELParser::Resource.default_uri_reader = options[:uri_reader]
|
28
|
+
end
|
29
|
+
end
|
18
30
|
end.parse!
|
19
31
|
|
20
32
|
def syntax_results(results)
|
@@ -32,15 +44,6 @@ end
|
|
32
44
|
require 'bel_parser/expression/validator'
|
33
45
|
require 'bel_parser/resource/resource_url_reader'
|
34
46
|
|
35
|
-
uri_reader, url_reader = options.values_at(:uri_reader, :url_reader)
|
36
|
-
|
37
|
-
namespaces = Hash[
|
38
|
-
ARGV.map do |ns|
|
39
|
-
keyword, identifier = ns.split('=')
|
40
|
-
[keyword, BELParser::Expression::Model::Namespace.new(keyword, identifier, nil)]
|
41
|
-
end.compact
|
42
|
-
]
|
43
|
-
|
44
47
|
def validate(expression)
|
45
48
|
v2 = BELParser::Language.specification('2.0')
|
46
49
|
ns = {
|
data/bin/bel2_upgrade
CHANGED
@@ -20,6 +20,18 @@ OptionParser.new do |opts|
|
|
20
20
|
opts.on('-f', '--file FILE', 'BEL script file to read.') do |bel|
|
21
21
|
options[:file] = bel
|
22
22
|
end
|
23
|
+
|
24
|
+
if RUBY_ENGINE =~ /^jruby/i
|
25
|
+
opts.on(
|
26
|
+
'-t',
|
27
|
+
'--read-jena-tdb DIRECTORY',
|
28
|
+
'Jena TDB directory containing BEL RDF resources.') do |tdb|
|
29
|
+
|
30
|
+
require 'bel_parser/resource/jena_tdb_reader'
|
31
|
+
options[:uri_reader] = BELParser::Resource::JenaTDBReader.new(tdb)
|
32
|
+
BELParser::Resource.default_uri_reader = options[:uri_reader]
|
33
|
+
end
|
34
|
+
end
|
23
35
|
end.parse!
|
24
36
|
|
25
37
|
file = options[:file]
|
@@ -49,7 +61,7 @@ puts serialize(
|
|
49
61
|
value(
|
50
62
|
string('"2.0"'))))
|
51
63
|
BELParser::ASTGenerator.new(io).each do |result|
|
52
|
-
|
64
|
+
_, line, asts = result
|
53
65
|
|
54
66
|
document_property =
|
55
67
|
asts.find { |ast|
|
@@ -57,17 +69,17 @@ BELParser::ASTGenerator.new(io).each do |result|
|
|
57
69
|
}
|
58
70
|
next if document_property && document_property.name.identifier.string_literal.downcase == 'belversion'
|
59
71
|
|
60
|
-
|
72
|
+
convert_ast =
|
61
73
|
asts.find do |ast|
|
62
74
|
ast && CONVERSION_TYPES.include?(ast.type)
|
63
75
|
end
|
64
76
|
|
65
|
-
if
|
66
|
-
|
67
|
-
upgrades.reduce(
|
77
|
+
if convert_ast
|
78
|
+
puts serialize(
|
79
|
+
upgrades.reduce(convert_ast) do |ast, upgrade|
|
68
80
|
upgrade.process(ast)
|
69
81
|
end
|
70
|
-
|
82
|
+
)
|
71
83
|
else
|
72
84
|
puts line
|
73
85
|
end
|
data/bin/bel2_validator
CHANGED
@@ -62,6 +62,7 @@ OptionParser.new do |opts|
|
|
62
62
|
|
63
63
|
require 'bel_parser/resource/jena_tdb_reader'
|
64
64
|
options[:uri_reader] = BELParser::Resource::JenaTDBReader.new(tdb)
|
65
|
+
BELParser::Resource.default_uri_reader = options[:uri_reader]
|
65
66
|
end
|
66
67
|
end
|
67
68
|
end.parse!
|
@@ -104,14 +105,16 @@ BELParser::Expression::Validator
|
|
104
105
|
|
105
106
|
puts " Semantics results:"
|
106
107
|
results.semantics_results.each do |res|
|
107
|
-
|
108
|
+
case res
|
109
|
+
when BELParser::Language::Semantics::SignatureMappingSuccess
|
108
110
|
puts " Matched signature: #{res.signature.string_form}"
|
109
|
-
|
110
|
-
if res.is_a?(BELParser::Language::Semantics::SignatureMappingWarning)
|
111
|
+
when BELParser::Language::Semantics::SignatureMappingWarning
|
111
112
|
puts " Failed signature: #{res.signature.string_form}"
|
112
113
|
res.results.select(&:failure?).each do |warning|
|
113
114
|
puts " #{warning}"
|
114
115
|
end
|
116
|
+
when BELParser::Language::Semantics::SemanticsWarning
|
117
|
+
puts " Warning: #{res}"
|
115
118
|
end
|
116
119
|
end
|
117
120
|
end
|
data/bin/bel_script_reader
CHANGED