Class: RDFObject::Index

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf_objects/pho/index_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Index

Returns a new instance of Index.



4
5
6
7
8
9
10
11
12
# File 'lib/rdf_objects/pho/index_set.rb', line 4

def initialize(args={})
  unless args.empty?
    ["name","property","analyzer","weight"].each do |prop|
      if args[prop] || args[prop.to_s]
        self.send("set_prop".to_sym, (args[prop] || args[prop.to_s]))
      end
    end
  end
end

Instance Attribute Details

#analyzerObject (readonly)

Returns the value of attribute analyzer.



3
4
5
# File 'lib/rdf_objects/pho/index_set.rb', line 3

def analyzer
  @analyzer
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/rdf_objects/pho/index_set.rb', line 3

def name
  @name
end

#propertyObject (readonly)

Returns the value of attribute property.



3
4
5
# File 'lib/rdf_objects/pho/index_set.rb', line 3

def property
  @property
end

#weightObject (readonly)

Returns the value of attribute weight.



3
4
5
# File 'lib/rdf_objects/pho/index_set.rb', line 3

def weight
  @weight
end

Instance Method Details

#set_analyzer(analyzer) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/rdf_objects/pho/index_set.rb', line 26

def set_analyzer(analyzer)
  if analyzer.is_a?(RDFObject::Resource)
    @analyzer = analyzer
  else
    unless analyzer =~ /^http:\/\//
      analyzer = "http://schemas.talis.com/2007/bigfoot/analyzers#analyzer"
    end        
    @analyzer = RDFObject::Resource.new(analyzer)      
  end
end

#set_name(name) ⇒ Object



14
15
16
# File 'lib/rdf_objects/pho/index_set.rb', line 14

def set_name(name)
  @name = name
end

#set_property(property) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/rdf_objects/pho/index_set.rb', line 18

def set_property(property)
  if property.is_a?(RDFObject::Resource)
    @property = property
  else
    @property = RDFObject::Resource.new(property)
  end
end

#set_weight(boost) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/rdf_objects/pho/index_set.rb', line 37

def set_weight(boost)
  unless boost.nil?
    @weight = boost.to_f
  else
    @weight = nil
  end
end