module Spread2RDF::Mapping::ResourceCreation

Public Instance Methods

create_resource() click to toggle source
# File lib/spread2rdf/mapping/resource_creation.rb, line 5
def create_resource
  case schema.resource_creation_mode
    when :bnode                   then RDF::Node.new
    when :from_column_with_suffix then resource_from_suffix
    when :from_column             then resource_from_full_uri
    else raise 'unknown resource creation mode'
  end
end

Private Instance Methods

resource_from_full_uri() click to toggle source
# File lib/spread2rdf/mapping/resource_creation.rb, line 14
def resource_from_full_uri
  RDF::URI.new(resource_creation_value, validate: true)
end
resource_from_suffix() click to toggle source
# File lib/spread2rdf/mapping/resource_creation.rb, line 19
def resource_from_suffix
  namespace = schema.resource_creation_namespace
  suffix = Mapping::Cell::Default.uri_normalization(resource_creation_value)
  #puts "creating resource " + RDF::URI.new("#{namespace}#{suffix}" )
  RDF::URI.new("#{namespace}#{suffix}")
end