def _resources_from_graph(graph, uris_and_graphs)
      repo = add_data_to_repository(graph)
      resources = []

      # TODO: ? if uris_and_graphs not passed in, we could get the
      # uris from the graph, and just not create the resoruces with a graph
      # (but they won't be persistable).

      uris_and_graphs.each do |(u,g)|

        # instantiate a new resource
        g ||= {}
        r = self.new(u, g)

        # make a graph of data for this resource's uri
        data_graph = RDF::Graph.new
        repo.query( [RDF::URI.new(u), :predicate, :object] ) do |statement|
          data_graph << statement

          if statement.object.is_a? RDF::Node
            repo.query( [statement.object, :predicate, :object] ) {|s| data_graph << s}
          end
        end

        # use it to hydrate this resource
        r.hydrate!(:graph => data_graph)
        r.new_record = false
        resources << r
      end

      resources
    end
def _resources_from_graph(graph, uris_and_graphs)
      repo = add_data_to_repository(graph)
      resources = []

      # TODO: ? if uris_and_graphs not passed in, we could get the
      # uris from the graph, and just not create the resoruces with a graph
      # (but they won't be persistable).

      uris_and_graphs.each do |(u,g)|

        # instantiate a new resource
        g ||= {}
        r = self.new(u, g)

        # make a graph of data for this resource's uri
        data_graph = RDF::Graph.new
        repo.query( [RDF::URI.new(u), :predicate, :object] ) do |statement|
          data_graph << statement

          if statement.object.is_a? RDF::Node
            repo.query( [statement.object, :predicate, :object] ) {|s| data_graph << s}
          end
        end

        # use it to hydrate this resource
        r.hydrate!(:graph => data_graph)
        r.new_record = false
        resources << r
      end

      resources
    end
given a graph of data, and a hash of uris=>graphs, create and hydrate some resources.
 Note: if any of the graphs are not set in the hash,
 those resources can still be constructed, but not persisted back to DB.