Class: CqlRuby::CqlNode

Inherits:
Object
  • Object
show all
Defined in:
lib/cql_ruby/cql_nodes.rb,
lib/cql_ruby/cql_to_solr.rb

Instance Method Summary collapse

Constructor Details

#initializeCqlNode

Returns a new instance of CqlNode.



12
13
14
# File 'lib/cql_ruby/cql_nodes.rb', line 12

def initialize
  
end

Instance Method Details

#check_xml(xml) ⇒ Object



6
7
8
9
10
# File 'lib/cql_ruby/cql_nodes.rb', line 6

def check_xml( xml )
  xml = Builder::XmlMarkup.new(:indent => 1) unless xml
#    (0..1).each {|x| puts x}
  xml
end

#getResultSetNameObject



16
17
18
# File 'lib/cql_ruby/cql_nodes.rb', line 16

def getResultSetName
  nil
end

#render_prefixes(xml = nil, prefixes = nil) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cql_ruby/cql_nodes.rb', line 29

def render_prefixes( xml=nil, prefixes=nil )
  return unless prefixes and prefixes.length > 0 
  
  xml = check_xml( xml )
  xml.prefixes do
    prefixes.each do |prefix|
      xml.prefix do
        xml.name( prefix.name )
        xml.identifier( prefix.identifier )
      end
    end
  end
end

#render_sortkeys(xml = nil, sortkeys = nil) ⇒ Object



43
44
45
46
47
48
49
50
51
52
# File 'lib/cql_ruby/cql_nodes.rb', line 43

def render_sortkeys( xml=nil, sortkeys=nil )
  return "" unless sortkeys and sortkeys.any?
  
  xml = check_xml( xml )
  xml.sortKeys do
    sortkeys.each do |key|
      key.sortkey_to_xcql( xml )
    end
  end
end

#to_cqlObject



25
26
27
# File 'lib/cql_ruby/cql_nodes.rb', line 25

def to_cql
  nil
end

#to_solrObject

Default, raise not supported, will be implemented by specific classes where supported.

Raises:



72
73
74
# File 'lib/cql_ruby/cql_to_solr.rb', line 72

def to_solr    
  raise CqlException.new("#to_solr not supported for #{self.class}:  #{self.to_cql}")
end

#to_xcql(xml = nil, prefixes = nil, sortkeys = nil) ⇒ Object

arguments kept for symmetry



21
22
23
# File 'lib/cql_ruby/cql_nodes.rb', line 21

def to_xcql( xml=nil, prefixes=nil, sortkeys=nil )
  nil
end