Class: RDFObject::Resource

Inherits:
OpenStruct
  • Object
show all
Includes:
Node
Defined in:
lib/rdf_objects/rdf_resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Node

#==, #[], #assert, #assertion_exists?, #assertions, #describe, #empty_graph?, #object_to_json_hash, #prefix_for, #rdf_description_block, #register_vocabulary, #relate, #to_json, #to_json_hash, #to_ntriples, #to_xml

Constructor Details

#initialize(uri) ⇒ Resource

Returns a new instance of Resource.



254
255
256
257
258
259
# File 'lib/rdf_objects/rdf_resource.rb', line 254

def initialize(uri)        
  if uri.could_be_a_safe_curie?
    uri = Curie.parse uri
  end
  super(:uri=>uri)
end

Instance Attribute Details

#tableObject (readonly)

Returns the value of attribute table.



253
254
255
# File 'lib/rdf_objects/rdf_resource.rb', line 253

def table
  @table
end

Instance Method Details

#ntriples_formatObject



269
270
271
# File 'lib/rdf_objects/rdf_resource.rb', line 269

def ntriples_format
  "<#{uri}>" 
end

#xml_object_attributeObject



265
266
267
# File 'lib/rdf_objects/rdf_resource.rb', line 265

def xml_object_attribute
  "rdf:resource=\"#{CGI.escapeHTML(self.uri)}\""
end

#xml_subject_attributeObject



261
262
263
# File 'lib/rdf_objects/rdf_resource.rb', line 261

def xml_subject_attribute
  "rdf:about=\"#{CGI.escapeHTML(self.uri)}\""
end