Skip to content

Commit

Permalink
Implemented RDF::Repository#update.
Browse files Browse the repository at this point in the history
  • Loading branch information
artob committed Jan 9, 2010
1 parent e0b93f1 commit f55cd38
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/rdf/repository.rb
Expand Up @@ -238,6 +238,22 @@ def <<(statement)
self
end

##
# Updates RDF statements in the repository.
#
# @param [Array<Statement>] statements
# @raise [TypeError] if the repository is immutable
# @return [Repository]
def update(*statements)
raise TypeError.new("repository is immutable") if immutable?
statements.each do |statement|
if (statement = create_statement(statement))
delete([statement.subject, statement.predicate, nil])
insert(statement) if statement.has_object?
end
end
end

##
# Inserts RDF statements into the repository.
#
Expand Down

0 comments on commit f55cd38

Please sign in to comment.