bel_parser 1.0.0.alpha.47-java → 1.0.0.alpha.48-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/bel_parser/expression/model/namespace.rb +60 -20
  4. data/lib/bel_parser/expression/model/parameter.rb +30 -36
  5. data/lib/bel_parser/expression/model/statement.rb +28 -3
  6. data/lib/bel_parser/expression/model/term.rb +46 -7
  7. data/lib/bel_parser/expression/parser.rb +15 -3
  8. data/lib/bel_parser/expression/validator.rb +13 -15
  9. data/lib/bel_parser/language/apply_namespace_encoding.rb +14 -18
  10. data/lib/bel_parser/language/expression_validator.rb +398 -23
  11. data/lib/bel_parser/language/semantics_ast_warnings.rb +1 -1
  12. data/lib/bel_parser/language/specification.rb +4 -0
  13. data/lib/bel_parser/language/syntax/undefined_namespace.rb +1 -1
  14. data/lib/bel_parser/language/syntax/undefined_namespace_value.rb +2 -1
  15. data/lib/bel_parser/language/version2_0/functions/activity.rb +2 -2
  16. data/lib/bel_parser/language/version2_0/functions/biological_process.rb +1 -2
  17. data/lib/bel_parser/language/version2_0/functions/cell_secretion.rb +2 -2
  18. data/lib/bel_parser/language/version2_0/functions/cell_surface_expression.rb +2 -2
  19. data/lib/bel_parser/language/version2_0/functions/complex_abundance.rb +1 -1
  20. data/lib/bel_parser/language/version2_0/functions/composite_abundance.rb +1 -1
  21. data/lib/bel_parser/language/version2_0/functions/degradation.rb +2 -2
  22. data/lib/bel_parser/language/version2_0/functions/fragment.rb +1 -1
  23. data/lib/bel_parser/language/version2_0/functions/from_location.rb +1 -1
  24. data/lib/bel_parser/language/version2_0/functions/fusion.rb +1 -1
  25. data/lib/bel_parser/language/version2_0/functions/micro_rna_abundance.rb +1 -1
  26. data/lib/bel_parser/language/version2_0/functions/molecular_activity.rb +1 -1
  27. data/lib/bel_parser/language/version2_0/functions/protein_modification.rb +1 -1
  28. data/lib/bel_parser/language/version2_0/functions/reaction.rb +1 -1
  29. data/lib/bel_parser/language/version2_0/functions/to_location.rb +1 -1
  30. data/lib/bel_parser/language/version2_0/functions/translocation.rb +1 -1
  31. data/lib/bel_parser/language/version2_0/functions/variant.rb +1 -1
  32. data/lib/bel_parser/resource.rb +8 -6
  33. data/lib/bel_parser/resource/concept_scheme.rb +8 -0
  34. data/lib/bel_parser/resource/dataset.rb +24 -0
  35. data/lib/bel_parser/resource/file_resource.rb +8 -0
  36. data/lib/bel_parser/resource/file_resource_value.rb +1 -0
  37. data/lib/bel_parser/resource/sparql_reader.rb +3 -1
  38. data/lib/bel_parser/resource/value.rb +20 -0
  39. metadata +1 -1
@@ -17,7 +17,7 @@ module BELParser
17
17
  return nil if prefix_identifier.nil?
18
18
 
19
19
  prefix = prefix_identifier.string_literal
20
- unless namespaces[prefix.downcase]
20
+ unless namespaces[prefix]
21
21
  UndefinedNamespaceError.new(prefix_node, spec, prefix, namespaces)
22
22
  end
23
23
  end
@@ -14,7 +14,8 @@ module BELParser
14
14
  return nil unless value_node.is_a?(BELParser::Parsers::AST::Value)
15
15
  return nil unless value_node.namespace
16
16
 
17
- unless value_node.namespace_value
17
+ nsv = value_node.namespace_value
18
+ if nsv.nil? || nsv.encoding.nil?
18
19
  value = value_node.children[0].string_literal
19
20
  UndefinedNamespaceValueWarning.new(value_node, spec, value)
20
21
  end
@@ -16,8 +16,8 @@ module BELParser
16
16
  LONG = :activity
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Activity
18
18
  DESCRIPTION = 'Denotes the frequency or abundance of events
19
- n which a member acts as a causal agent at the
20
- olecular scale.'.freeze
19
+ in which a member acts as a causal agent at the
20
+ molecular scale.'.freeze
21
21
 
22
22
  def self.short
23
23
  SHORT
@@ -15,8 +15,7 @@ module BELParser
15
15
  LONG = :biologicalProcess
16
16
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::BiologicalProcess
17
17
  B_ENC = Version2_0::ValueEncodings::BiologicalProcess
18
- DESCRIPTION = 'Denotes a process or population of
19
- vents.'.freeze
18
+ DESCRIPTION = 'Denotes a process or population of events.'.freeze
20
19
 
21
20
  def self.short
22
21
  SHORT
@@ -17,8 +17,8 @@ module BELParser
17
17
  LONG = :cellSecretion
18
18
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
19
19
  DESCRIPTION = 'Denotes the frequency or abundance of events
20
- n which members of an abundance move from cells
21
- o regions outside of the cells.'.freeze
20
+ in which members of an abundance move from cells
21
+ to regions outside of the cells.'.freeze
22
22
 
23
23
  def self.short
24
24
  SHORT
@@ -17,8 +17,8 @@ module BELParser
17
17
  LONG = :cellSurfaceExpression
18
18
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
19
19
  DESCRIPTION = 'Denotes the frequency or abundance of events in
20
- hich members of an abundance move to the surface
21
- f cells.'.freeze
20
+ which members of an abundance move to the surface
21
+ of cells.'.freeze
22
22
 
23
23
  def self.short
24
24
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::ComplexAbundance
17
17
  C_ENC = Version2_0::ValueEncodings::ComplexAbundance
18
18
  DESCRIPTION = 'Denotes the abundance of a molecular
19
- omplex.'.freeze
19
+ complex.'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  LONG = :compositeAbundance
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
18
18
  DESCRIPTION = 'Denotes the frequency or abundance of events
19
- n which members are present.'.freeze
19
+ in which members are present.'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -17,8 +17,8 @@ module BELParser
17
17
  LONG = :degradation
18
18
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
19
19
  DESCRIPTION = 'Denotes the frequency or abundance of events
20
- n which a member is degraded in some way such
21
- hat it is no longer a member.'.freeze
20
+ in which a member is degraded in some way such
21
+ that it is no longer a member.'.freeze
22
22
 
23
23
  def self.short
24
24
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  LONG = :fragment
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Fragment
18
18
  DESCRIPTION = 'Denotes a protein fragment, e.g., a product of
19
- roteolytic cleavage.'.freeze
19
+ proteolytic cleavage.'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -17,7 +17,7 @@ module BELParser
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::FromLocation
18
18
  L_ENC = Version2_0::ValueEncodings::Location
19
19
  DESCRIPTION = 'Denotes the from cellular location of the
20
- bundance.'.freeze
20
+ abundance.'.freeze
21
21
 
22
22
  def self.short
23
23
  SHORT
@@ -19,7 +19,7 @@ module BELParser
19
19
  P_ENC = Version2_0::ValueEncodings::ProteinAbundance
20
20
  R_ENC = Version2_0::ValueEncodings::RNAAbundance
21
21
  DESCRIPTION = 'Specifies the abundance of a protein translated
22
- rom the fusion of a gene.'.freeze
22
+ from the fusion of a gene.'.freeze
23
23
 
24
24
  def self.short
25
25
  SHORT
@@ -17,7 +17,7 @@ module BELParser
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::MicroRNAAbundance
18
18
  M_ENC = Version2_0::ValueEncodings::MicroRNAAbundance
19
19
  DESCRIPTION = 'Denotes the abundance of a processed, functional
20
- icroRNA'.freeze
20
+ microRNA'.freeze
21
21
 
22
22
  def self.short
23
23
  SHORT
@@ -18,7 +18,7 @@ module BELParser
18
18
  T_ENC = Version2_0::ValueEncodings::Activity
19
19
  DESCRIPTION = 'Denotes the frequency or abundance of events
20
20
  n which a member acts as a causal agent at the
21
- olecular scale'.freeze
21
+ molecular scale'.freeze
22
22
 
23
23
  def self.short
24
24
  SHORT
@@ -18,7 +18,7 @@ module BELParser
18
18
  RETURN_TYPE = Version2_0::ReturnTypes::ProteinModification
19
19
  E_ENC = Version2_0::ValueEncodings::ProteinModification
20
20
  DESCRIPTION = 'Denotes a covalently modified protein
21
- bundance'.freeze
21
+ abundance'.freeze
22
22
 
23
23
  def self.short
24
24
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  LONG = :reaction
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
18
18
  DESCRIPTION = 'Denotes the frequency or abundance of events
19
- n a reaction'.freeze
19
+ in a reaction'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::ToLocation
17
17
  L_ENC = Version2_0::ValueEncodings::Location
18
18
  DESCRIPTION = 'Denotes the to cellular location of the
19
- bundance.'.freeze
19
+ abundance.'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -16,7 +16,7 @@ module BELParser
16
16
  LONG = :translocation
17
17
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Abundance
18
18
  DESCRIPTION = 'Denotes the frequency or abundance of events
19
- n which members move between locations'.freeze
19
+ in which members move between locations'.freeze
20
20
 
21
21
  def self.short
22
22
  SHORT
@@ -15,7 +15,7 @@ module BELParser
15
15
  LONG = :variant
16
16
  RETURN_TYPE = BELParser::Language::Version2_0::ReturnTypes::Variant
17
17
  DESCRIPTION = 'Denotes a sequence variant of the specified
18
- bundance.'.freeze
18
+ abundance.'.freeze
19
19
 
20
20
  def self.short
21
21
  SHORT
@@ -5,8 +5,7 @@ require_relative 'resource/resource_url_reader'
5
5
  module BELParser
6
6
  module Resource
7
7
 
8
- DEFAULT_SPARQL_ENDPOINT = 'http://build.openbel.org/sparql'
9
- #DEFAULT_SPARQL_ENDPOINT = 'http://localhost:3030/identifiers/sparql'
8
+ DEFAULT_SPARQL_ENDPOINT = 'http://resources.openbel.org/sparql'
10
9
 
11
10
  READER_LOCK = Mutex.new
12
11
  private_constant :READER_LOCK
@@ -15,27 +14,30 @@ module BELParser
15
14
  URISTRING_PATTERN = /^URIString *= *(.*)$/
16
15
  private_constant :URISTRING_PATTERN
17
16
 
17
+ @default_uri_reader = SPARQLReader.new(DEFAULT_SPARQL_ENDPOINT, false)
18
+ @default_url_reader = ResourceURLReader.new
19
+
18
20
  def self.default_uri_reader
19
21
  READER_LOCK.synchronize do
20
- @default_uri_reader ||= SPARQLReader.new(DEFAULT_SPARQL_ENDPOINT)
22
+ @default_uri_reader
21
23
  end
22
24
  end
23
25
 
24
26
  def self.default_uri_reader=(uri_reader)
25
27
  READER_LOCK.synchronize do
26
- @default_uri_reader ||= uri_reader
28
+ @default_uri_reader = uri_reader
27
29
  end
28
30
  end
29
31
 
30
32
  def self.default_url_reader
31
33
  READER_LOCK.synchronize do
32
- @default_url_reader ||= ResourceURLReader.new
34
+ @default_url_reader
33
35
  end
34
36
  end
35
37
 
36
38
  def self.default_url_reader=(url_reader)
37
39
  READER_LOCK.synchronize do
38
- @default_url_reader ||= url_reader
40
+ @default_url_reader = url_reader
39
41
  end
40
42
  end
41
43
 
@@ -16,6 +16,14 @@ module BELParser
16
16
  @types = convert_types(types.to_s)
17
17
  end
18
18
 
19
+ def uri?
20
+ true
21
+ end
22
+
23
+ def url?
24
+ false
25
+ end
26
+
19
27
  private
20
28
 
21
29
  def convert_types(types)
@@ -29,6 +29,30 @@ module BELParser
29
29
  def types
30
30
  raise NotImplementedError, "#{__method__} is not implemented."
31
31
  end
32
+
33
+ def uri?
34
+ raise NotImplementedError, "#{__method__} is not implemented."
35
+ end
36
+
37
+ def url?
38
+ raise NotImplementedError, "#{__method__} is not implemented."
39
+ end
40
+
41
+ def <=>(another_dataset)
42
+ keyword <=> another_dataset.keyword
43
+ end
44
+
45
+ def hash
46
+ [types, identifier, keyword].hash
47
+ end
48
+
49
+ def ==(another_dataset)
50
+ return false if another_dataset == nil
51
+ types == another_dataset.types &&
52
+ identifier == another_dataset.identifier &&
53
+ keyword == another_dataset.keyword
54
+ end
55
+ alias :eql? :'=='
32
56
  end
33
57
  end
34
58
  end
@@ -16,6 +16,14 @@ module BELParser
16
16
  @name = name.to_s
17
17
  @types = [type]
18
18
  end
19
+
20
+ def uri?
21
+ false
22
+ end
23
+
24
+ def url?
25
+ true
26
+ end
19
27
  end
20
28
  end
21
29
  end
@@ -19,6 +19,7 @@ module BELParser
19
19
  encodings.chars.map(&:to_sym)
20
20
  end
21
21
  end
22
+
22
23
  end
23
24
  end
24
25
  end
@@ -122,9 +122,11 @@ module BELParser
122
122
  where {
123
123
  <<%= uri %>> rdf:type skos:ConceptScheme .
124
124
  <<%= uri %>> rdf:type ?type .
125
- <<%= uri %>> belv:domain ?domain .
126
125
  <<%= uri %>> belv:prefix ?prefix .
127
126
  <<%= uri %>> skos:prefLabel ?prefLabel .
127
+ optional {
128
+ <<%= uri %>> belv:domain ?domain .
129
+ }
128
130
  }
129
131
  group by ?domain ?prefix ?prefLabel
130
132
  SPARQL
@@ -26,6 +26,26 @@ module BELParser
26
26
  def encodings
27
27
  raise NotImplementedError, "#{__method__} is not implemented."
28
28
  end
29
+
30
+ def <=>(another_value)
31
+ name <=> another_value.name
32
+ end
33
+
34
+ def hash
35
+ [dataset, name, encodings].hash
36
+ end
37
+
38
+ def ==(another_value)
39
+ return false if another_value == nil
40
+ dataset == another_value.dataset &&
41
+ name == another_value.name &&
42
+ encodings == another_value.encodings
43
+ end
44
+ alias :eql? :'=='
45
+
46
+ def to_s
47
+ name
48
+ end
29
49
  end
30
50
  end
31
51
  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.47
4
+ version: 1.0.0.alpha.48
5
5
  platform: java
6
6
  authors:
7
7
  - Anthony Bargnesi