bel_parser 1.0.0.alpha.12 → 1.0.0.alpha.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gemspec +1 -1
- data/VERSION +1 -1
- data/bin/bel2_validator +35 -8
- data/lib/bel_parser/expression/validator.rb +3 -2
- data/lib/bel_parser/language/apply_namespace_encoding.rb +96 -0
- data/lib/bel_parser/language/base_specification.rb +82 -0
- data/lib/bel_parser/language/expression_validator.rb +6 -2
- data/lib/bel_parser/language/relationship.rb +1 -1
- data/lib/bel_parser/language/semantics/signature_mapping.rb +26 -32
- data/lib/bel_parser/language/semantics_ast.rb +285 -149
- data/lib/bel_parser/language/semantics_ast_warnings.rb +180 -0
- data/lib/bel_parser/language/semantics_result.rb +11 -2
- data/lib/bel_parser/language/semantics_type_warning.rb +22 -0
- data/lib/bel_parser/language/semantics_warning.rb +8 -0
- data/lib/bel_parser/language/specification.rb +38 -55
- data/lib/bel_parser/language/syntax/undefined_namespace_value.rb +43 -0
- data/lib/bel_parser/language/syntax_error.rb +8 -0
- data/lib/bel_parser/language/syntax_result.rb +8 -0
- data/lib/bel_parser/language/syntax_warning.rb +9 -4
- data/lib/bel_parser/language/version1_0/functions/abundance.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/biological_process.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/complex_abundance.rb +6 -7
- data/lib/bel_parser/language/version1_0/functions/fusion.rb +39 -60
- data/lib/bel_parser/language/version1_0/functions/gene_abundance.rb +9 -12
- data/lib/bel_parser/language/version1_0/functions/list.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/micro_rna_abundance.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/pathology.rb +5 -6
- data/lib/bel_parser/language/version1_0/functions/protein_abundance.rb +16 -30
- data/lib/bel_parser/language/version1_0/functions/protein_modification.rb +15 -27
- data/lib/bel_parser/language/version1_0/functions/rna_abundance.rb +8 -11
- data/lib/bel_parser/language/version1_0/functions/substitution.rb +6 -12
- data/lib/bel_parser/language/version1_0/functions/translocation.rb +9 -12
- data/lib/bel_parser/language/version1_0/functions/truncation.rb +2 -4
- data/lib/bel_parser/language/version1_0/value_encodings/abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/any.rb +74 -0
- data/lib/bel_parser/language/version1_0/value_encodings/biological_process.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/complex_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/gene_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/micro_rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/pathology.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/protein_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0/value_encodings/rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version1_0.rb +6 -87
- data/lib/bel_parser/language/version2_0/functions/abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/biological_process.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/complex_abundance.rb +9 -12
- data/lib/bel_parser/language/version2_0/functions/fragment.rb +4 -9
- data/lib/bel_parser/language/version2_0/functions/from_location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/fusion.rb +39 -66
- data/lib/bel_parser/language/version2_0/functions/gene_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/list.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/molecular_activity.rb +6 -5
- data/lib/bel_parser/language/version2_0/functions/pathology.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/protein_abundance.rb +21 -30
- data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +11 -17
- data/lib/bel_parser/language/version2_0/functions/rna_abundance.rb +13 -18
- data/lib/bel_parser/language/version2_0/functions/to_location.rb +5 -6
- data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -4
- data/lib/bel_parser/language/version2_0/value_encodings/abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/activity.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/any.rb +74 -0
- data/lib/bel_parser/language/version2_0/value_encodings/biological_process.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/complex_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/gene_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/location.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/micro_rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/pathology.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb +21 -0
- data/lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb +21 -0
- data/lib/bel_parser/language/version2_0.rb +6 -60
- data/lib/bel_parser/language.rb +3 -4
- data/lib/bel_parser/parsers/ast/node.rb +14 -2
- data/lib/bel_parser/{language/quoting.rb → quoting.rb} +0 -56
- data/lib/bel_parser/resource/concept.rb +56 -0
- data/lib/bel_parser/resource/concept_scheme.rb +35 -0
- data/lib/bel_parser/resource/dataset.rb +34 -0
- data/lib/bel_parser/resource/eager_reader.rb +75 -0
- data/lib/bel_parser/resource/eager_sparql_reader.rb +51 -0
- data/lib/bel_parser/resource/http_cache.rb +71 -0
- data/lib/bel_parser/resource/jena_tdb_reader.rb +246 -0
- data/lib/bel_parser/resource/lru_cache.rb +111 -0
- data/lib/bel_parser/resource/lru_reader.rb +38 -0
- data/lib/bel_parser/resource/reader.rb +18 -0
- data/lib/bel_parser/resource/resource_file_reader.rb +134 -0
- data/lib/bel_parser/resource/sparql_reader.rb +178 -0
- data/lib/bel_parser/resource/value.rb +31 -0
- metadata +42 -4
- data/lib/bel_parser/language/version1_0/syntax/function.rb +0 -28
@@ -0,0 +1,134 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require_relative 'reader'
|
3
|
+
require_relative 'eager_reader'
|
4
|
+
require_relative 'dataset'
|
5
|
+
require_relative 'http_cache'
|
6
|
+
require_relative 'value'
|
7
|
+
|
8
|
+
module BELParser
|
9
|
+
module Resource
|
10
|
+
# ResourceFileReader retrieves {Dataset datasets} and {Value values} from
|
11
|
+
# Annotation (i.e. belanno extension) and Namespace (i.e. belns extension)
|
12
|
+
# files.
|
13
|
+
#
|
14
|
+
# Only supports resource identifiers with an HTTP or HTTPS scheme.
|
15
|
+
class ResourceFileReader
|
16
|
+
include Reader
|
17
|
+
prepend EagerReader
|
18
|
+
|
19
|
+
DEFAULT_RESOURCE_VALUE_DELIMITER = '|'
|
20
|
+
private_constant :DEFAULT_RESOURCE_VALUE_DELIMITER
|
21
|
+
|
22
|
+
def initialize
|
23
|
+
@http_cache = HTTPCache.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def retrieve_resource(resource_identifier)
|
27
|
+
read_resource(resource_identifier)
|
28
|
+
end
|
29
|
+
|
30
|
+
def retrieve_value_from_resource(resource_identifier, value)
|
31
|
+
file_resource = read_resource(resource_identifier)
|
32
|
+
|
33
|
+
io = @http_cache.get(resource_identifier)
|
34
|
+
delimiter = DEFAULT_RESOURCE_VALUE_DELIMITER
|
35
|
+
io.each_line do |line|
|
36
|
+
case line
|
37
|
+
when /^DelimiterString *=(.*)/
|
38
|
+
delimiter = Regexp.last_match[1]
|
39
|
+
when /^#{Regexp.escape('[Values]')}/
|
40
|
+
break
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
value_match = "#{value}#{delimiter}"
|
45
|
+
value_line = io.each_line.find do |line|
|
46
|
+
line.start_with?(value_match)
|
47
|
+
end
|
48
|
+
return nil unless value_line
|
49
|
+
value, encoding = value_line.strip.split(delimiter)
|
50
|
+
FileResourceValue.new(file_resource, value, encoding)
|
51
|
+
end
|
52
|
+
|
53
|
+
def retrieve_values_from_resource(resource_identifier)
|
54
|
+
file_resource = read_resource(resource_identifier)
|
55
|
+
|
56
|
+
io = @http_cache.get(resource_identifier)
|
57
|
+
delimiter = DEFAULT_RESOURCE_VALUE_DELIMITER
|
58
|
+
io.each_line do |line|
|
59
|
+
case line
|
60
|
+
when /^DelimiterString *=(.*)/
|
61
|
+
delimiter = Regexp.last_match[1]
|
62
|
+
when /^#{Regexp.escape('[Values]')}/
|
63
|
+
break
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
io.each_line.map do |line|
|
68
|
+
value, encoding = line.strip.split(delimiter)
|
69
|
+
FileResourceValue.new(file_resource, value, encoding)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def read_resource(url)
|
76
|
+
io = @http_cache.get(url)
|
77
|
+
|
78
|
+
type, name, keyword, domain = nil
|
79
|
+
io.each_line do |line|
|
80
|
+
case line
|
81
|
+
when /^#{Regexp.escape('[AnnotationDefinition]')}/
|
82
|
+
type = Dataset::ANNOTATION
|
83
|
+
when /^#{Regexp.escape('[Namespace]')}/
|
84
|
+
type = Dataset::NAMESPACE
|
85
|
+
when /^NameString *= *(.*)$/
|
86
|
+
name = Regexp.last_match[1]
|
87
|
+
when /^Keyword *= *(.*)$/
|
88
|
+
keyword = Regexp.last_match[1]
|
89
|
+
when /^DomainString *= *(.*)$/
|
90
|
+
domain = Regexp.last_match[1]
|
91
|
+
when /^#{Regexp.escape('[Values]')}/
|
92
|
+
break
|
93
|
+
end
|
94
|
+
end
|
95
|
+
FileResource.new(url, domain, keyword, name, type)
|
96
|
+
end
|
97
|
+
|
98
|
+
# FileResource is a {Dataset} description obtained from a Annotation or
|
99
|
+
# Namespace file.
|
100
|
+
class FileResource
|
101
|
+
include Dataset
|
102
|
+
|
103
|
+
attr_reader :identifier, :domain, :keyword, :name, :types
|
104
|
+
|
105
|
+
def initialize(identifier, domain, keyword, name, type)
|
106
|
+
@identifier = identifier.to_s
|
107
|
+
@domain = domain.to_s
|
108
|
+
@keyword = keyword.to_s
|
109
|
+
@name = name.to_s
|
110
|
+
@types = [type]
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# FileResourceValue is a {Value} obtained from a Annotation or Namespace
|
115
|
+
# file.
|
116
|
+
class FileResourceValue
|
117
|
+
include Value
|
118
|
+
|
119
|
+
attr_reader :dataset, :name, :encodings
|
120
|
+
|
121
|
+
def initialize(dataset, name, encodings)
|
122
|
+
@dataset = dataset
|
123
|
+
@name = name
|
124
|
+
@encodings =
|
125
|
+
if dataset.annotation_resource? && !dataset.namespace_resource?
|
126
|
+
nil
|
127
|
+
else
|
128
|
+
encodings.chars.map(&:to_sym)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'net/http'
|
3
|
+
require 'sparql/client'
|
4
|
+
require 'uri'
|
5
|
+
|
6
|
+
require_relative 'reader'
|
7
|
+
require_relative 'lru_reader'
|
8
|
+
require_relative 'concept'
|
9
|
+
require_relative 'concept_scheme'
|
10
|
+
|
11
|
+
module BELParser
|
12
|
+
module Resource
|
13
|
+
# SPARQLReader
|
14
|
+
class SPARQLReader
|
15
|
+
include Reader
|
16
|
+
prepend LRUReader
|
17
|
+
|
18
|
+
SCHEMES = [URI::HTTP, URI::HTTPS].freeze
|
19
|
+
ALLOW_HEADER = 'Allow'.freeze
|
20
|
+
|
21
|
+
def initialize(sparql_endpoint_url, validate_url = true)
|
22
|
+
validate_sparql_endpoint_url(sparql_endpoint_url) if validate_url
|
23
|
+
@sparql_repository = SPARQL::Client.new(sparql_endpoint_url)
|
24
|
+
end
|
25
|
+
|
26
|
+
def retrieve_resource(resource_identifier)
|
27
|
+
uri = URI(resource_identifier.to_s)
|
28
|
+
template_binding = binding
|
29
|
+
sparql_query = RESOLVE_CONCEPT_SCHEME.result(template_binding)
|
30
|
+
hash_to_concept_scheme(resource_identifier,
|
31
|
+
execute_select(sparql_query).first)
|
32
|
+
end
|
33
|
+
|
34
|
+
def retrieve_value_from_resource(resource_identifier, value)
|
35
|
+
uri = URI(resource_identifier.to_s)
|
36
|
+
template_binding = binding
|
37
|
+
sparql_query = RESOLVE_CONCEPT.result(template_binding)
|
38
|
+
concept_scheme = retrieve_resource(resource_identifier)
|
39
|
+
to_concept = method(:hash_to_concept).to_proc.curry[concept_scheme]
|
40
|
+
|
41
|
+
execute_select(sparql_query).map(&to_concept)
|
42
|
+
end
|
43
|
+
|
44
|
+
def retrieve_values_from_resource(resource_identifier)
|
45
|
+
uri = URI(resource_identifier.to_s)
|
46
|
+
template_binding = binding
|
47
|
+
sparql_query = RESOLVE_CONCEPTS.result(template_binding)
|
48
|
+
concept_scheme = retrieve_resource(resource_identifier)
|
49
|
+
to_concept = method(:hash_to_concept).to_proc.curry[concept_scheme]
|
50
|
+
|
51
|
+
execute_select(sparql_query).map(&to_concept)
|
52
|
+
end
|
53
|
+
|
54
|
+
protected
|
55
|
+
|
56
|
+
def execute_select(sparql_query)
|
57
|
+
@sparql_repository.query(sparql_query).map do |solution|
|
58
|
+
solution.to_hash
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def hash_to_concept_scheme(resource_identifier, hash)
|
63
|
+
ConceptScheme.new(resource_identifier,
|
64
|
+
*hash.values_at(:domain, :prefix, :prefLabel, :types))
|
65
|
+
end
|
66
|
+
|
67
|
+
def hash_to_concept(concept_scheme, hash)
|
68
|
+
Concept.new(concept_scheme,
|
69
|
+
*hash.values_at(:concept, :prefLabel, :identifier, :title,
|
70
|
+
:altLabels, :types))
|
71
|
+
end
|
72
|
+
|
73
|
+
def validate_sparql_endpoint_url(url)
|
74
|
+
url_s = url.to_s
|
75
|
+
scheme, host, port = URI(url_s).select(:scheme, :host, :port)
|
76
|
+
validate_uri_scheme(scheme, url_s)
|
77
|
+
|
78
|
+
options_request = Net::HTTP::Options.new(url_s)
|
79
|
+
options_response = Net::HTTP.start(host, port) do |http|
|
80
|
+
http.request(Net::HTTP::Options.new(url_s))
|
81
|
+
end
|
82
|
+
validate_200(options_response, url_s)
|
83
|
+
validate_allowed_methods(options_response, url_s)
|
84
|
+
end
|
85
|
+
|
86
|
+
def validate_uri_scheme(scheme, url_s)
|
87
|
+
unless SCHEMES.include?(URI.scheme_list[scheme.upcase])
|
88
|
+
raise ArgumentError,
|
89
|
+
"expected HTTP or HTTPS scheme for url: #{url_s}"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def validate_200(response, url_s)
|
94
|
+
unless response.code_type == Net::HTTPOK
|
95
|
+
raise ArgumentError,
|
96
|
+
<<-MSG.gsub(/ {14}/, '').delete("\n")
|
97
|
+
expected URL to respond 200 (received #{response.code}) for
|
98
|
+
OPTIONS request to: #{url_s}"
|
99
|
+
MSG
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def validate_allowed_methods(response, url_s)
|
104
|
+
unless response[ALLOW_HEADER].to_s =~ /GET|POST/
|
105
|
+
raise ArgumentError,
|
106
|
+
"expected URL to allow GET or POST: #{url_s}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
RESOLVE_CONCEPT_SCHEME = ERB.new(<<-SPARQL)
|
111
|
+
prefix belv: <http://www.openbel.org/vocabulary/>
|
112
|
+
prefix dct: <http://purl.org/dc/terms/>
|
113
|
+
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
114
|
+
prefix skos: <http://www.w3.org/2004/02/skos/core#>
|
115
|
+
select ?domain ?prefix ?prefLabel (group_concat(?type;separator='|') as ?types)
|
116
|
+
where {
|
117
|
+
<<%= uri %>> rdf:type skos:ConceptScheme .
|
118
|
+
<<%= uri %>> rdf:type ?type .
|
119
|
+
<<%= uri %>> belv:domain ?domain .
|
120
|
+
<<%= uri %>> belv:prefix ?prefix .
|
121
|
+
<<%= uri %>> skos:prefLabel ?prefLabel .
|
122
|
+
}
|
123
|
+
group by ?domain ?prefix ?prefLabel
|
124
|
+
SPARQL
|
125
|
+
|
126
|
+
RESOLVE_CONCEPT = ERB.new(<<-SPARQL)
|
127
|
+
prefix belv: <http://www.openbel.org/vocabulary/>
|
128
|
+
prefix dct: <http://purl.org/dc/terms/>
|
129
|
+
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
130
|
+
prefix skos: <http://www.w3.org/2004/02/skos/core#>
|
131
|
+
select ?concept ?prefLabel ?identifier ?title
|
132
|
+
(group_concat(distinct(?type);separator='|') as ?types)
|
133
|
+
(group_concat(distinct(?altLabel);separator='|') as ?altLabels)
|
134
|
+
where {
|
135
|
+
{?concept skos:prefLabel "<%= value %>"}
|
136
|
+
UNION
|
137
|
+
{?concept dct:identifier "<%= value %>"}
|
138
|
+
UNION
|
139
|
+
{?concept dct:title "<%= value %>"}
|
140
|
+
UNION
|
141
|
+
{?concept skos:altLabel "<%= value %>"}
|
142
|
+
|
143
|
+
?concept skos:inScheme <<%= uri %>> .
|
144
|
+
?concept rdf:type ?type .
|
145
|
+
|
146
|
+
?concept skos:prefLabel ?prefLabel .
|
147
|
+
?concept dct:identifier ?identifier .
|
148
|
+
optional {
|
149
|
+
?concept dct:title ?title .
|
150
|
+
?concept skos:altLabel ?altLabel .
|
151
|
+
}
|
152
|
+
}
|
153
|
+
group by ?concept ?prefLabel ?identifier ?title
|
154
|
+
SPARQL
|
155
|
+
|
156
|
+
RESOLVE_CONCEPTS = ERB.new(<<-SPARQL)
|
157
|
+
prefix belv: <http://www.openbel.org/vocabulary/>
|
158
|
+
prefix dct: <http://purl.org/dc/terms/>
|
159
|
+
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
|
160
|
+
prefix skos: <http://www.w3.org/2004/02/skos/core#>
|
161
|
+
select ?concept ?prefLabel ?identifier ?title
|
162
|
+
(group_concat(distinct(?type);separator='|') as ?types)
|
163
|
+
(group_concat(distinct(?altLabel);separator='|') as ?altLabels)
|
164
|
+
where {
|
165
|
+
?concept skos:inScheme <<%= uri %>> .
|
166
|
+
?concept rdf:type ?type .
|
167
|
+
?concept skos:prefLabel ?prefLabel .
|
168
|
+
optional {
|
169
|
+
?concept dct:identifier ?identifier .
|
170
|
+
?concept dct:title ?title .
|
171
|
+
?concept skos:altLabel ?altLabel
|
172
|
+
}
|
173
|
+
}
|
174
|
+
group by ?concept ?prefLabel ?identifier ?title
|
175
|
+
SPARQL
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module BELParser
|
2
|
+
module Resource
|
3
|
+
# Value
|
4
|
+
module Value
|
5
|
+
|
6
|
+
def dataset
|
7
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
8
|
+
end
|
9
|
+
|
10
|
+
def name
|
11
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
12
|
+
end
|
13
|
+
|
14
|
+
def identifier
|
15
|
+
nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def title
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def synonyms
|
23
|
+
[]
|
24
|
+
end
|
25
|
+
|
26
|
+
def encodings
|
27
|
+
raise NotImplementedError, "#{__method__} is not implemented."
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
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.
|
4
|
+
version: 1.0.0.alpha.13
|
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: 2016-04-
|
12
|
+
date: 2016-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Implements language versions 1.0 and 2.0.
|
15
15
|
email: abargnesi@selventa.com
|
@@ -31,10 +31,11 @@ files:
|
|
31
31
|
- lib/bel_parser/expression/validator.rb
|
32
32
|
- lib/bel_parser/language.rb
|
33
33
|
- lib/bel_parser/language/amino_acid.rb
|
34
|
+
- lib/bel_parser/language/apply_namespace_encoding.rb
|
35
|
+
- lib/bel_parser/language/base_specification.rb
|
34
36
|
- lib/bel_parser/language/covalent_protein_modification.rb
|
35
37
|
- lib/bel_parser/language/expression_validator.rb
|
36
38
|
- lib/bel_parser/language/function.rb
|
37
|
-
- lib/bel_parser/language/quoting.rb
|
38
39
|
- lib/bel_parser/language/relationship.rb
|
39
40
|
- lib/bel_parser/language/semantics.rb
|
40
41
|
- lib/bel_parser/language/semantics/deeply_nested_statement.rb
|
@@ -47,9 +48,11 @@ files:
|
|
47
48
|
- lib/bel_parser/language/semantics/relationship_not_listable.rb
|
48
49
|
- lib/bel_parser/language/semantics/signature_mapping.rb
|
49
50
|
- lib/bel_parser/language/semantics_ast.rb
|
51
|
+
- lib/bel_parser/language/semantics_ast_warnings.rb
|
50
52
|
- lib/bel_parser/language/semantics_function.rb
|
51
53
|
- lib/bel_parser/language/semantics_match.rb
|
52
54
|
- lib/bel_parser/language/semantics_result.rb
|
55
|
+
- lib/bel_parser/language/semantics_type_warning.rb
|
53
56
|
- lib/bel_parser/language/semantics_warning.rb
|
54
57
|
- lib/bel_parser/language/signature.rb
|
55
58
|
- lib/bel_parser/language/specification.rb
|
@@ -57,6 +60,7 @@ files:
|
|
57
60
|
- lib/bel_parser/language/syntax/invalid_function.rb
|
58
61
|
- lib/bel_parser/language/syntax/invalid_relationship.rb
|
59
62
|
- lib/bel_parser/language/syntax/undefined_namespace.rb
|
63
|
+
- lib/bel_parser/language/syntax/undefined_namespace_value.rb
|
60
64
|
- lib/bel_parser/language/syntax_error.rb
|
61
65
|
- lib/bel_parser/language/syntax_function.rb
|
62
66
|
- lib/bel_parser/language/syntax_result.rb
|
@@ -147,7 +151,15 @@ files:
|
|
147
151
|
- lib/bel_parser/language/version1_0/return_types/transcriptional_activity.rb
|
148
152
|
- lib/bel_parser/language/version1_0/return_types/transport_activity.rb
|
149
153
|
- lib/bel_parser/language/version1_0/return_types/truncation.rb
|
150
|
-
- lib/bel_parser/language/version1_0/
|
154
|
+
- lib/bel_parser/language/version1_0/value_encodings/abundance.rb
|
155
|
+
- lib/bel_parser/language/version1_0/value_encodings/any.rb
|
156
|
+
- lib/bel_parser/language/version1_0/value_encodings/biological_process.rb
|
157
|
+
- lib/bel_parser/language/version1_0/value_encodings/complex_abundance.rb
|
158
|
+
- lib/bel_parser/language/version1_0/value_encodings/gene_abundance.rb
|
159
|
+
- lib/bel_parser/language/version1_0/value_encodings/micro_rna_abundance.rb
|
160
|
+
- lib/bel_parser/language/version1_0/value_encodings/pathology.rb
|
161
|
+
- lib/bel_parser/language/version1_0/value_encodings/protein_abundance.rb
|
162
|
+
- lib/bel_parser/language/version1_0/value_encodings/rna_abundance.rb
|
151
163
|
- lib/bel_parser/language/version2_0.rb
|
152
164
|
- lib/bel_parser/language/version2_0/functions/abundance.rb
|
153
165
|
- lib/bel_parser/language/version2_0/functions/activity.rb
|
@@ -225,6 +237,18 @@ files:
|
|
225
237
|
- lib/bel_parser/language/version2_0/return_types/rna_abundance.rb
|
226
238
|
- lib/bel_parser/language/version2_0/return_types/to_location.rb
|
227
239
|
- lib/bel_parser/language/version2_0/return_types/variant.rb
|
240
|
+
- lib/bel_parser/language/version2_0/value_encodings/abundance.rb
|
241
|
+
- lib/bel_parser/language/version2_0/value_encodings/activity.rb
|
242
|
+
- lib/bel_parser/language/version2_0/value_encodings/any.rb
|
243
|
+
- lib/bel_parser/language/version2_0/value_encodings/biological_process.rb
|
244
|
+
- lib/bel_parser/language/version2_0/value_encodings/complex_abundance.rb
|
245
|
+
- lib/bel_parser/language/version2_0/value_encodings/gene_abundance.rb
|
246
|
+
- lib/bel_parser/language/version2_0/value_encodings/location.rb
|
247
|
+
- lib/bel_parser/language/version2_0/value_encodings/micro_rna_abundance.rb
|
248
|
+
- lib/bel_parser/language/version2_0/value_encodings/pathology.rb
|
249
|
+
- lib/bel_parser/language/version2_0/value_encodings/protein_abundance.rb
|
250
|
+
- lib/bel_parser/language/version2_0/value_encodings/protein_modification.rb
|
251
|
+
- lib/bel_parser/language/version2_0/value_encodings/rna_abundance.rb
|
228
252
|
- lib/bel_parser/mixin/line_continuator.rb
|
229
253
|
- lib/bel_parser/mixin/line_mapping.rb
|
230
254
|
- lib/bel_parser/parser.rb
|
@@ -272,6 +296,20 @@ files:
|
|
272
296
|
- lib/bel_parser/parsers/line_parser.rb
|
273
297
|
- lib/bel_parser/parsers/mixin/buffer.rb
|
274
298
|
- lib/bel_parser/parsers/nonblocking_io_wrapper.rb
|
299
|
+
- lib/bel_parser/quoting.rb
|
300
|
+
- lib/bel_parser/resource/concept.rb
|
301
|
+
- lib/bel_parser/resource/concept_scheme.rb
|
302
|
+
- lib/bel_parser/resource/dataset.rb
|
303
|
+
- lib/bel_parser/resource/eager_reader.rb
|
304
|
+
- lib/bel_parser/resource/eager_sparql_reader.rb
|
305
|
+
- lib/bel_parser/resource/http_cache.rb
|
306
|
+
- lib/bel_parser/resource/jena_tdb_reader.rb
|
307
|
+
- lib/bel_parser/resource/lru_cache.rb
|
308
|
+
- lib/bel_parser/resource/lru_reader.rb
|
309
|
+
- lib/bel_parser/resource/reader.rb
|
310
|
+
- lib/bel_parser/resource/resource_file_reader.rb
|
311
|
+
- lib/bel_parser/resource/sparql_reader.rb
|
312
|
+
- lib/bel_parser/resource/value.rb
|
275
313
|
- lib/bel_parser/script/parser.rb
|
276
314
|
- lib/bel_parser/vendor/ast.rb
|
277
315
|
- lib/bel_parser/vendor/ast/node.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'bel_parser/parsers/ast/node'
|
2
|
-
|
3
|
-
module BELParser
|
4
|
-
module Language
|
5
|
-
module Version1_0
|
6
|
-
module Syntax
|
7
|
-
# Function will add syntax errors to
|
8
|
-
# {BELParser::Parsers::AST::Function} nodes that do not have a valid
|
9
|
-
# BEL 1.0 functon name.
|
10
|
-
class Function
|
11
|
-
private_class_method :new
|
12
|
-
|
13
|
-
V1 = ::BELParser::Language::Version1_0::Specification.new
|
14
|
-
|
15
|
-
def self.match(input_ast)
|
16
|
-
input_ast.traverse do |node|
|
17
|
-
next unless node.is_a?(BELParser::Parsers::AST::Function)
|
18
|
-
function_name = node.identifier.string_literal
|
19
|
-
unless V1.function(function_name.to_sym)
|
20
|
-
node.add_syntax_error(:FunctionV1)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|