Class: RoadForest::SourceRigor::ResourceQuery
- Inherits:
-
RDF::Query
- Object
- RDF::Query
- RoadForest::SourceRigor::ResourceQuery
- Defined in:
- lib/roadforest/source-rigor/resource-query.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#patterns ⇒ Object
Returns the value of attribute patterns.
-
#solutions ⇒ Object
Returns the value of attribute solutions.
-
#source_rigor ⇒ Object
Returns the value of attribute source_rigor.
-
#subject_context ⇒ Object
Returns the value of attribute subject_context.
-
#variables ⇒ Object
Returns the value of attribute variables.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(pattern) ⇒ Object
-
#initialize(patterns = [], options = {}, &block) ⇒ ResourceQuery
constructor
A new instance of ResourceQuery.
- #pattern(pattern, options = nil) ⇒ Object
Constructor Details
#initialize(patterns = [], options = {}, &block) ⇒ ResourceQuery
Returns a new instance of ResourceQuery.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 6 def initialize(patterns = [], = {}, &block) @subject_context = [:subject_context] @source_rigor = [:source_rigor] super patterns = @patterns.dup @patterns.clear patterns.each do |pattern| pattern(pattern) end end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
18 19 20 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 18 def @options end |
#patterns ⇒ Object
Returns the value of attribute patterns.
18 19 20 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 18 def patterns @patterns end |
#solutions ⇒ Object
Returns the value of attribute solutions.
18 19 20 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 18 def solutions @solutions end |
#source_rigor ⇒ Object
Returns the value of attribute source_rigor.
17 18 19 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 17 def source_rigor @source_rigor end |
#subject_context ⇒ Object
Returns the value of attribute subject_context.
17 18 19 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 17 def subject_context @subject_context end |
#variables ⇒ Object
Returns the value of attribute variables.
18 19 20 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 18 def variables @variables end |
Class Method Details
.from(other, subject_context = nil, source_rigor = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 34 def self.from(other, subject_context = nil, source_rigor = nil) query = self.new if subject_context.nil? and other.respond_to?(:subject_context) query.subject_context = other.subject_context else query.subject_context = subject_context end if source_rigor.nil? and other.respond_to?(:source_rigor) query.source_rigor = other.source_rigor else query.source_rigor = source_rigor end other.patterns.each do |pattern| query.pattern(pattern) end query.variables = other.variables query.solutions = other.solutions query. = other. return query end |
Instance Method Details
#<<(pattern) ⇒ Object
20 21 22 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 20 def <<(pattern) pattern(pattern) end |
#pattern(pattern, options = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/roadforest/source-rigor/resource-query.rb', line 24 def pattern(pattern, = nil) = { :context_roles => {:subject => subject_context}, :source_rigor => source_rigor }.merge( || {}) @patterns << ResourcePattern.from(pattern, ) self end |