Class: ActiveRDF::Query2Jars2

Inherits:
Object
  • Object
show all
Defined in:
lib/active_rdf/queryengine/query2jars2.rb

Class Method Summary collapse

Class Method Details

.translate(query) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_rdf/queryengine/query2jars2.rb', line 7

def self.translate(query)
  str = ""
  if query.select?
    # concatenate each where clause using space: s p o
    # and then concatenate the clauses using dot: s p o . s2 p2 o2 .
    str << "#{query.where_clauses.collect{|w| w.collect{|w| '?'+w.to_s}.join(' ')}.join(" .\n")} ."
    # TODO: should we maybe reverse the order on the where_clauses? it depends
    # on Andreas' answer of the best order to give to jars2. Users would
    # probably put the most specific stuff first, and join to get the
    # interesting information. Maybe we should not touch it and let the user
    # figure it out.
  end

ActiveRdfLogger::log_debug(self) { "Query2Jars2: translated #{query} to #{str}" }
  return str
end