Skip to content

Commit

Permalink
Updated user agent in RDF.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-aravind committed Oct 16, 2024
1 parent 165f621 commit c9af324
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode
5 changes: 4 additions & 1 deletion src/lib/rdf_processor.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'linkeddata'
require 'sparql'
require_relative 'sparql_processor'
require 'rubygems'
module RDFProcessor
def self.process_rdf(entity_urls, base_url)
graph = RDF::Graph.new
Expand All @@ -10,7 +11,9 @@ def self.process_rdf(entity_urls, base_url)
begin
puts "Processing #{entity_url} in non-headless mode"
entity_url = entity_url.gsub(' ', '+')
loaded_graph = RDF::Graph.load(entity_url)
linkeddata_version = Gem::Specification.find_by_name('linkeddata').version.to_s
options = { headers: { 'User-Agent' => "artsdata-crawler/#{linkeddata_version}" } }
loaded_graph = RDF::Graph.load(entity_url, **options)
sparql_file_with_url = add_url_sparql_file.gsub("subject_url", entity_url)
loaded_graph.query(SPARQL.parse(sparql_file_with_url, update: true))
graph << loaded_graph
Expand Down

0 comments on commit c9af324

Please sign in to comment.