lib/spread2rdf/schema/column.rb in spread2rdf-0.1.3 vs lib/spread2rdf/schema/column.rb in spread2rdf-0.1.4
- old
+ new
@@ -1,9 +1,10 @@
module Spread2RDF
module Schema
class Column < Element
include StatementMapping
+ include ResourceCreation
self.attributes = {
predicate: nil,
object: nil,
statement: nil
@@ -29,11 +30,11 @@
end
values
end
def self.resolve_data_sources(data_sources)
- return [data_sources] unless data_sources.is_a? Array
+ data_sources = [data_sources] unless data_sources.is_a? Array
data_sources.map do |data_source|
case
when (uri = data_source).is_a?(RDF::URI) || (uri = RDF::URI.new(data_source)).valid?
raise NotImplementedError, "resolving of uris is not implemented yet"
when data_source.is_a?(String) && !(file = File.in_path(data_source)).nil?
@@ -59,9 +60,13 @@
when !object[:from].nil? then :resource_ref
when !object[:language].nil? then :to_string
else
raise "mapping specification error: don't know how to map #{self}"
end
+ end
+
+ def resource_creation_attributes
+ object
end
def cell_mapping
object if object.is_a?(Proc)
end