10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/active_rdf/queryengine/query2sparql.rb', line 10
def self.translate(query)
str = ""
if query.select?
distinct = query.distinct? ? "DISTINCT " : ""
select_clauses = query.select_clauses.collect{|s| construct_clause(s)}
str << "SELECT #{distinct}#{select_clauses.join(' ')} "
str << "WHERE { #{where_clauses(query)} }"
elsif query.ask?
str << "ASK { #{where_clauses(query)} }"
end
$log.debug "Query2SPARQL: translated the query to #{str}"
return str
end
|