Method: RDF::Graph.load

Defined in:
lib/rdf/model/graph.rb

.load(url, graph_name: nil, **options) {|graph| ... } ⇒ Graph

Creates a new Graph instance populated by the RDF data returned by dereferencing the given graph_name Resource.

Parameters:

  • url (String, #to_s)
  • graph_name (RDF::Resource) (defaults to: nil)

    Set set graph name of each loaded statement

  • options (Hash{Symbol => Object})

    Options from Reader.open

Yields:

  • (graph)

Yield Parameters:

Returns:

Since:

  • 0.1.7



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/rdf/model/graph.rb', line 76

def self.load(url, graph_name: nil, **options, &block)
  self.new(graph_name: graph_name, **options) do |graph|
    graph.load(url, graph_name: graph_name, **options)

    if block_given?
      case block.arity
        when 1 then block.call(graph)
        else graph.instance_eval(&block)
      end
    end
  end
end