Method: RDF::Repository#initialize

Defined in:
lib/rdf/repository.rb

#initialize(uri: nil, title: nil, **options) {|repository| ... } ⇒ Repository

Initializes this repository instance.

Parameters:

  • uri (URI, #to_s) (defaults to: nil)

    (nil)

  • title (String, #to_s) (defaults to: nil)

    (nil)

  • options (Hash{Symbol => Object})

Options Hash (**options):

  • :with_graph_name (Boolean) — default: true

    Indicates that the repository supports named graphs, otherwise, only the default graph is supported.

  • :with_validity (Boolean) — default: true

    Indicates that the repository supports named validation.

  • :transaction_class (Boolean) — default: DEFAULT_TX_CLASS

    Specifies the RDF::Transaction implementation to use in this Repository.

Yields:

  • (repository)

Yield Parameters:

[View source] [View on GitHub]

151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/rdf/repository.rb', line 151

def initialize(uri: nil, title: nil, **options, &block)
  @options = {with_graph_name: true, with_validity: true}.merge(options)
  @uri     = uri
  @title   = title

  # Provide a default in-memory implementation:
  send(:extend, Implementation) if self.class.equal?(RDF::Repository)

  @tx_class ||= @options.delete(:transaction_class) { DEFAULT_TX_CLASS }

  if block_given?
    case block.arity
      when 1 then block.call(self)
      else instance_eval(&block)
    end
  end
end