Module: RDF::Resource

Includes:
Term
Included in:
Graph, List, Node, URI
Defined in:
lib/rdf/model/resource.rb

Overview

An RDF resource.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Term

#<=>, #==, #constant?, #eql?, #variable?

Methods included from Value

#graph?, #inspect, #inspect!, #iri?, #literal?, #node?, #statement?, #to_ntriples, #to_quad, #to_rdf, #type_error, #uri?, #variable?

Class Method Details

.new(*args, &block) ⇒ RDF::Resource

Instantiates an Node or an URI, depending on the given argument.

Returns:



12
13
14
15
16
17
18
# File 'lib/rdf/model/resource.rb', line 12

def self.new(*args, &block)
  case arg = args.shift
    when Symbol     then Node.intern(arg, *args, &block)
    when /^_:(.*)$/ then Node.new($1, *args, &block)
    else URI.new(arg, *args, &block)
  end
end

Instance Method Details

#resource?Boolean

Returns ‘true` to indicate that this value is a resource.

Returns:

  • (Boolean)


24
25
26
# File 'lib/rdf/model/resource.rb', line 24

def resource?
  true
end