module RDF::Term
An RDF term.
Terms can be used as subjects, predicates, objects, and graph names of statements.
@since 0.3.0
Public Instance Methods
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`.
@abstract @param [Object] other @return [Integer] `-1`, `0`, or `1`
# File lib/rdf/model/term.rb, line 23 def <=>(other) self.to_s <=> other.to_s end
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`.
@abstract @param [Object] other @return [Integer] `-1`, `0`, or `1`
@see www.w3.org/TR/rdf-sparql-query/#func-RDFterm-equal
# File lib/rdf/model/term.rb, line 39 def ==(other) super end
Term compatibility according to SPARQL
@see www.w3.org/TR/sparql11-query/#func-arg-compatibility @since 2.0
# File lib/rdf/model/term.rb, line 88 def compatible?(other) false end
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`.
@abstract @param [Object] other @return [Integer] `-1`, `0`, or `1`
@see www.w3.org/TR/rdf-sparql-query/#func-sameTerm
# File lib/rdf/model/term.rb, line 55 def eql?(other) super end
Returns `true` if `self` is a {RDF::Term}.
@return [Boolean]
# File lib/rdf/model/term.rb, line 63 def term? true end
Returns the base representation of this term.
@return [Sring]
# File lib/rdf/model/term.rb, line 79 def to_base RDF::NTriples.serialize(self).freeze end
Returns itself.
@return [RDF::Value]
# File lib/rdf/model/term.rb, line 71 def to_term self end
Protected Instance Methods
Escape a term using escapes. This should be implemented as appropriate for the given type of term.
@param [String] string @return [String]
# File lib/rdf/model/term.rb, line 98 def escape(string) raise NotImplementedError, "#{self.class}#escape" end