Module: RDF::Term

Includes:
Comparable, Value
Included in:
Literal, Query::Variable, Resource
Defined in:
lib/rdf/model/term.rb

Overview

An RDF term.

Terms can be used as subjects, predicates, objects, and contexts of statements.

Since:

Instance Method Summary (collapse)

Methods included from Value

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

Instance Method Details

- (Integer) <=>(other)

This method is abstract.

Compares self to other for sorting purposes.

Subclasses should override this to provide a more meaningful implementation than the default which simply performs a string comparison based on #to_s.

Parameters:

  • (Object) other

Returns:

  • (Integer)

    -1, 0, or 1

Since:

  • 0.3.0



23
24
25
# File 'lib/rdf/model/term.rb', line 23

def <=>(other)
  self.to_s <=> other.to_s
end

- (Boolean) constant?

Returns true if this term is constant.

Returns:

  • (Boolean)

    true or false

See Also:

Since:

  • 0.3.0



32
33
34
# File 'lib/rdf/model/term.rb', line 32

def constant?
  !(variable?)
end

- (Boolean) variable?

Returns true if this term is variable.

Returns:

  • (Boolean)

    true or false

See Also:

Since:

  • 0.3.0



41
42
43
# File 'lib/rdf/model/term.rb', line 41

def variable?
  false
end