Module: RDF::Resource

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

Overview

An RDF resource.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Term

#<=>, #==, #compatible?, #eql?, #escape, #term?, #terms, #to_base, #to_term

Methods included from Value

#anonymous?, #canonicalize, #canonicalize!, #constant?, #graph?, #inspect, #inspect!, #invalid?, #iri?, #list?, #literal?, #node?, #start_with?, #statement?, #term?, #to_nquads, #to_ntriples, #to_rdf, #to_term, #type_error, #uri?, #valid?, #validate!, #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