Module: ActiveFedora::RdfNode::ClassMethods
- Defined in:
- lib/active_fedora/rdf_node.rb
Instance Method Summary collapse
- #config ⇒ Object
- #config_for_predicate(predicate) ⇒ Object
- #map_predicates(&block) ⇒ Object
-
#rdf_subject {|ds| ... } ⇒ Object
Register a ruby block that evaluates to the subject of the graph By default, the block returns the current object’s pid.
- #rdf_type(uri_or_string = nil) ⇒ Object
Instance Method Details
#config ⇒ Object
180 181 182 |
# File 'lib/active_fedora/rdf_node.rb', line 180 def config @config ||= {} end |
#config_for_predicate(predicate) ⇒ Object
198 199 200 201 202 203 |
# File 'lib/active_fedora/rdf_node.rb', line 198 def config_for_predicate(predicate) config.each do |term, value| return term, value if value[:predicate] == predicate end return nil end |
#map_predicates(&block) ⇒ Object
184 185 186 187 |
# File 'lib/active_fedora/rdf_node.rb', line 184 def map_predicates(&block) builder = Builder.new(self) builder.build &block end |
#rdf_subject {|ds| ... } ⇒ Object
Register a ruby block that evaluates to the subject of the graph By default, the block returns the current object’s pid
209 210 211 212 213 214 215 216 |
# File 'lib/active_fedora/rdf_node.rb', line 209 def rdf_subject &block if block_given? return @subject_block = block end # Create a B-node if they don't supply the rdf_subject @subject_block ||= lambda { |ds| RDF::Node.new } end |
#rdf_type(uri_or_string = nil) ⇒ Object
189 190 191 192 193 194 195 196 |
# File 'lib/active_fedora/rdf_node.rb', line 189 def rdf_type(uri_or_string=nil) if uri_or_string uri = uri_or_string.kind_of?(RDF::URI) ? uri_or_string : RDF::URI.new(uri_or_string) self.config[:type] = {predicate: RDF.type} @rdf_type = uri end @rdf_type end |