Module: RDF::Repository::Implementation

Defined in:
vendor/bundler/ruby/2.7.0/bundler/gems/rdf-3c0fc67183db/lib/rdf/repository.rb

Overview

A default Repository implementation supporting atomic writes and serializable transactions.

See Also:

Defined Under Namespace

Classes: SerializedTransaction

Constant Summary collapse

DEFAULT_GRAPH =
false

Instance Method Summary collapse

Instance Method Details

#apply_changeset(changeset) ⇒ Object



341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/rdf-3c0fc67183db/lib/rdf/repository.rb', line 341

def apply_changeset(changeset)
  data = @data
  changeset.deletes.each do |del|
    if del.constant?
      data = delete_from(data, del)
    else
      # we need this condition to handle wildcard statements
      query_pattern(del) { |stmt| data = delete_from(data, stmt) }
    end
  end
  changeset.inserts.each { |ins| data = insert_to(data, ins) }
  @data = data
end

#isolation_levelObject



357
358
359
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/rdf-3c0fc67183db/lib/rdf/repository.rb', line 357

def isolation_level
  :serializable
end

#snapshotDataset

A readable & queryable snapshot of the repository for isolated reads.

Returns:

  • (Dataset)

    an immutable Dataset containing a current snapshot of the Repository contents.

See Also:



368
369
370
# File 'vendor/bundler/ruby/2.7.0/bundler/gems/rdf-3c0fc67183db/lib/rdf/repository.rb', line 368

def snapshot
  self.class.new(data: @data).freeze
end