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 graph names of statements.
Instance Method Summary collapse
-
#<=>(other) ⇒ Integer
abstract
Compares ‘self` to `other` for sorting purposes.
-
#==(other) ⇒ Integer
abstract
Compares ‘self` to `other` to implement RDFterm-equal.
-
#compatible?(other) ⇒ Boolean
Term compatibility according to SPARQL.
-
#eql?(other) ⇒ Integer
abstract
Determins if ‘self` is the same term as `other`.
-
#term? ⇒ Boolean
Returns ‘true` if `self` is a Term.
-
#to_base ⇒ Sring
Returns the base representation of this term.
-
#to_term ⇒ RDF::Value
Returns itself.
Methods included from Value
#anonymous?, #canonicalize, #canonicalize!, #constant?, #graph?, #inspect, #inspect!, #invalid?, #iri?, #list?, #literal?, #node?, #resource?, #statement?, #to_nquads, #to_ntriples, #to_rdf, #type_error, #uri?, #valid?, #validate!, #variable?
Instance Method Details
#<=>(other) ⇒ Integer
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`.
23 24 25 |
# File 'lib/rdf/model/term.rb', line 23 def <=>(other) self.to_s <=> other.to_s end |
#==(other) ⇒ Integer
Compares ‘self` to `other` to implement RDFterm-equal.
Subclasses should override this to provide a more meaningful implementation than the default which simply performs a string comparison based on ‘#to_s`.
39 40 41 |
# File 'lib/rdf/model/term.rb', line 39 def ==(other) super end |
#compatible?(other) ⇒ Boolean
Term compatibility according to SPARQL
88 89 90 |
# File 'lib/rdf/model/term.rb', line 88 def compatible?(other) false end |
#eql?(other) ⇒ Integer
Determins if ‘self` is the same term as `other`.
Subclasses should override this to provide a more meaningful implementation than the default which simply performs a string comparison based on ‘#to_s`.
55 56 57 |
# File 'lib/rdf/model/term.rb', line 55 def eql?(other) super end |
#term? ⇒ Boolean
Returns ‘true` if `self` is a RDF::Term.
63 64 65 |
# File 'lib/rdf/model/term.rb', line 63 def term? true end |
#to_base ⇒ Sring
Returns the base representation of this term.
79 80 81 |
# File 'lib/rdf/model/term.rb', line 79 def to_base RDF::NTriples.serialize(self).freeze end |
#to_term ⇒ RDF::Value
Returns itself.
71 72 73 |
# File 'lib/rdf/model/term.rb', line 71 def to_term self end |