class RDF::N3::Algebra::Log::Content

This connects a document and a string that represents it.

(Cwm knows how to go get a document in order to evaluate this.)

Note that the content-type of the information is not given and so must be known or guessed.

Constants

NAME
URI

Public Instance Methods

resolve(resource, position: :subject) click to toggle source

Reads the subject into the object.

Returns nil if resource does not validate, given its position

@param [RDF::N3::List] resource @return [RDF::Term]

# File lib/rdf/n3/algebra/log/content.rb, line 19
def resolve(resource, position: :subject)
  case position
  when :subject
    return nil unless resource.literal? || resource.uri?
    content = begin
      as_literal(RDF::Util::File.open_file(resource) {|f| f.read})
    rescue IOError
      nil
    end
  when :object
    return nil unless resource.literal? || resource.variable?
    resource
  end
end