Skip to content

Commit

Permalink
fix append_triples_no_bnodes in the case of ttl to not chunk it.
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed May 10, 2024
1 parent f2751fe commit 0929621
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions lib/goo/sparql/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,27 +80,28 @@ def delete_data_graph(graph)
Goo.sparql_update_client.update(DropGraph.new(graph))
end

def append_triples_no_bnodes(graph,file_path,mime_type_in)
bnodes_filter = nil
def append_triples_no_bnodes(graph,file_path,mime_type_in) l
dir = nil
response = nil
if file_path.end_with?('ttl')
bnodes_filter = file_path
file = File.foreach(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 0929621

Please sign in to comment.