Module: RDF::SPARQL::Common
Instance Method Summary collapse
-
#distinct? ⇒ Boolean
Check whether ‘distinct` flag was specified.
-
#each_statement {|statement| ... } ⇒ Reader
Yields each statement of SPARQL query.
-
#each_target {|variable| ... } ⇒ Reader
Yields each target variable in SPARQL query.
-
#each_triple {|triple| ... } ⇒ Reader
Yields each triple of SPARQL query.
-
#each_variable {|variable| ... } ⇒ Reader
Yields each variable in SPARQL query.
-
#reduced? ⇒ Boolean
Check whether ‘reduced` flag was specified.
-
#statements ⇒ Object
[-].
-
#targets ⇒ Object
[-].
-
#triples ⇒ Object
[-].
-
#type ⇒ Object
[-].
-
#variables ⇒ Object
[-].
Instance Method Details
#distinct? ⇒ Boolean
Check whether ‘distinct` flag was specified
92 93 94 |
# File 'lib/lib/common.rb', line 92 def distinct? @options[:distinct] == true end |
#each_statement {|statement| ... } ⇒ Reader
Yields each statement of SPARQL query
11 12 13 14 |
# File 'lib/lib/common.rb', line 11 def each_statement(&block) @graph.each_statement { |statement| block.call(statement) } self end |
#each_target {|variable| ... } ⇒ Reader
Yields each target variable in SPARQL query
33 34 35 36 |
# File 'lib/lib/common.rb', line 33 def each_target(&block) @targets.each { |target| block.call(target) } self end |
#each_triple {|triple| ... } ⇒ Reader
Yields each triple of SPARQL query
22 23 24 25 |
# File 'lib/lib/common.rb', line 22 def each_triple(&block) @graph.each_triple { |*triple| block.call(*triple) } self end |
#each_variable {|variable| ... } ⇒ Reader
Yields each variable in SPARQL query
44 45 46 47 |
# File 'lib/lib/common.rb', line 44 def each_variable(&block) variables.each { |variable| block.call(variable) } self end |
#reduced? ⇒ Boolean
Check whether ‘reduced` flag was specified
100 101 102 |
# File 'lib/lib/common.rb', line 100 def reduced? @options[:reduced] == true end |
#statements ⇒ Object
- -
59 60 61 |
# File 'lib/lib/common.rb', line 59 def statements @graph.statements end |
#targets ⇒ Object
- -
52 53 54 |
# File 'lib/lib/common.rb', line 52 def targets @targets end |
#triples ⇒ Object
- -
66 67 68 |
# File 'lib/lib/common.rb', line 66 def triples @graph.triples end |
#type ⇒ Object
- -
84 85 86 |
# File 'lib/lib/common.rb', line 84 def type @type || @options[:type] end |
#variables ⇒ Object
- -
73 74 75 76 77 78 79 |
# File 'lib/lib/common.rb', line 73 def variables Hash[@graph.map { |pattern| pattern.variables.values }.flatten.uniq.map { |variable| [variable.name, variable] }] end |