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?, #variable?

Methods included from Value

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

Class Method Details

+ (RDF::Resource) new(*args, &block)

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

- (Boolean) resource?

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