Skip to content

Commit

Permalink
Merge pull request #156 from ontoportal-lirmm/fix/ttl-chunk-insert
Browse files Browse the repository at this point in the history
Fix: ttl  format insert by disabling the chunk insert for that format
  • Loading branch information
alexskr authored May 13, 2024
2 parents a55ef42 + 2db3f71 commit 70007fa
Showing 1 changed file with 12 additions and 11 deletions.
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

0 comments on commit 70007fa

Please sign in to comment.