Class: RDF::Repository
- Inherits:
-
Object
- Object
- RDF::Repository
- Defined in:
- lib/spira/utils.rb
Instance Method Summary collapse
-
#rename!(old_subject, new_subject) ⇒ self
Rename a resource in the Repository to the new given subject.
Instance Method Details
#rename!(old_subject, new_subject) ⇒ self
Rename a resource in the Repository to the new given subject.
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/spira/utils.rb', line 24 def rename!(old_subject, new_subject) transaction(mutable: true) do |tx| query({subject: old_subject}) do |statement| tx.insert RDF::Statement.new(new_subject, statement.predicate, statement.object) tx.delete(statement) end query({object: old_subject}) do |statement| tx.insert RDF::Statement.new(statement.subject, statement.predicate, new_subject) tx.delete(statement) end end end |