Sha256: bf63fdab8fca8144634418e0c4efbd2fd586835eaa22be217518183034f86ea8

Contents?: true

Size: 784 Bytes

Versions: 4

Compression:

Stored size: 784 Bytes

Contents

module Spread2RDF
  module Schema
    module ResourceCreation

      def resource_creation_mode
        attr = self.resource_creation_attributes
        case
          when ( attr.try(:fetch, :uri, nil) || attr ) == :bnode
            :bnode
          when !( attr.try(:fetch, :uri, nil).try(:fetch, :namespace, nil) ).nil?
            :from_column_with_suffix
          else
            :from_column
        end
      end

      def resource_creation_namespace
        namespace_name =
            self.resource_creation_attributes.try(:fetch, :uri, nil).try(:fetch, :namespace, nil)
        return warn("No namespace for resource creation found") if namespace_name.nil?
        Namespace.resolve_to_namespace(namespace_name)
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spread2rdf-0.1.7 lib/spread2rdf/schema/resource_creation_schema.rb
spread2rdf-0.1.6 lib/spread2rdf/schema/resource_creation_schema.rb
spread2rdf-0.1.5 lib/spread2rdf/schema/resource_creation_schema.rb
spread2rdf-0.1.4 lib/spread2rdf/schema/resource_creation_schema.rb