Module: PrependedRdf::RdfGraph
- Defined in:
- app/prepends/prepended_rdf/rdf_graph.rb
Instance Method Summary collapse
-
#load(url, graph_name: nil, **options) ⇒ void
Loads RDF statements from the given file or URL into
self.
Instance Method Details
#load(url, graph_name: nil, **options) ⇒ void
This method returns an undefined value.
Loads RDF statements from the given file or URL into self.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'app/prepends/prepended_rdf/rdf_graph.rb', line 14 def load(url, graph_name: nil, **) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize return super if QaServer.config.suppress_performance_gathering? raise TypeError, "#{self} is immutable" if immutable? phid, real_url = parse_phid(url) performance_udpates = {} start_time_s = QaServer::TimeService.current_time_s reader = RDF::Reader.open(real_url, { base_uri: real_url }.merge()) end_time_s = QaServer::TimeService.current_time_s performance_udpates[:retrieve_time_ms] = (end_time_s - start_time_s) * 1000 QaServer.config.performance_tracker.write "#{format('%.6f', end_time_s - start_time_s)}, " # read data start_time_s = QaServer::TimeService.current_time_s if graph_name statements = [] reader.each_statement do |statement| statement.graph_name = graph_name statements << statement end insert_statements(statements) statements.size else insert_statements(reader) nil end end_time_s = QaServer::TimeService.current_time_s performance_udpates[:graph_load_time_ms] = (end_time_s - start_time_s) * 1000 QaServer.config.performance_cache.update(id: phid, updates: performance_udpates) QaServer.config.performance_tracker.write "#{format('%.6f', end_time_s - start_time_s)}, " # load graph end |