Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the RDF::Repository more symmetric on insert/delete and right with RDF::Statement usage. #12

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lib/rdf/sesame/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@ class Repository < RDF::Repository
# @return [String]
attr_reader :writeble

# @return [String,Array]
# @return [String]
attr_reader :context

# @return [RDF::URI]
attr_reader :context_uri

# Maximum length for GET query
MAX_LENGTH_GET_QUERY = 2500

Expand Down Expand Up @@ -358,7 +361,13 @@ def write_query(query, queryLn, options)
# @param context the context(s) to use
def set_context(*context)
options||={}
@context = serialize_context(context)
@context = Array(serialize_context(context)).first
@context_uri = if context
uri = context[1..-2]
uri && !uri.empty? ? RDF::URI.new(uri) : nil
else
nil
end
end

##
Expand Down Expand Up @@ -427,6 +436,7 @@ def insert_statements(statements)
# @see RDF::Mutable#delete
# @see http://www.openrdf.org/doc/sesame2/system/ch08.html#d0e304
def delete_statement(statement)
statement.context = context_uri if context_uri
response = server.delete(path(:statements, statement))
response.code == "204"
end
Expand Down