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

Fix: ttl format insert by disabling the chunk insert for that format #156

Merged
merged 2 commits into from
May 13, 2024
Merged
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
23 changes: 12 additions & 11 deletions lib/goo/sparql/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,27 @@ def delete_data_graph(graph)
end

def append_triples_no_bnodes(graph,file_path,mime_type_in)
bnodes_filter = nil
dir = nil
response = nil
if file_path.end_with?('ttl')
bnodes_filter = file_path
file = File.read(bnodes_filter)
response = execute_append_request graph, file, mime_type_in
else
bnodes_filter, dir = bnodes_filter_file(file_path, mime_type_in)
end
chunk_lines = 500_000 # number of line
file = File.foreach(bnodes_filter)
lines = []
file.each_entry do |line|
lines << line
if lines.size == chunk_lines
response = execute_append_request graph, lines.join, mime_type_in
lines.clear
chunk_lines = 500_000 # number of line
file = File.foreach(bnodes_filter)
lines = []
file.each_entry do |line|
lines << line
if lines.size == chunk_lines
response = execute_append_request graph, lines.join, mime_type_in
lines.clear
end
end
response = execute_append_request graph, lines.join, mime_type_in unless lines.empty?
end

response = execute_append_request graph, lines.join, mime_type_in unless lines.empty?


unless dir.nil?
Expand Down