Module: RDF::Value
- Included in:
- Statement, Term
- Defined in:
- lib/rdf/nquads.rb,
lib/rdf/ntriples.rb,
lib/rdf/model/value.rb
Overview
An RDF value.
This is the basis for the RDF.rb class hierarchy. Anything that can be a term of RDF statements should directly or indirectly include this module.
Instance Method Summary (collapse)
-
- (Boolean) graph?
Returns
trueifselfis a graph. -
- (String) inspect
Returns a developer-friendly representation of
self. -
- inspect!
Outputs a developer-friendly representation of
selftostderr. -
- (Boolean) iri?
Returns
trueifselfis an IRI reference. -
- (Boolean) literal?
Returns
trueifselfis a literal. -
- (Boolean) node?
Returns
trueifselfis a blank node. -
- (Boolean) resource?
Returns
trueifselfis a resource. -
- (Boolean) statement?
Returns
trueifselfis a statement. -
- (String) to_ntriples
Returns the N-Triples representation of this value.
-
- (String) to_quad
Returns the N-Triples representation of this value.
-
- (RDF::Value) to_rdf
Returns an
RDF::Valuerepresentation ofself. -
- (false) type_error(message)
Default implementation of raise_error, which returns false.
-
- (Boolean) uri?
Returns
trueifselfis a URI reference. -
- (Boolean) variable?
Returns
trueifselfis a query variable.
Instance Method Details
- (Boolean) graph?
Returns true if self is a graph.
33 34 35 |
# File 'lib/rdf/model/value.rb', line 33 def graph? false end |
- (String) inspect
Returns a developer-friendly representation of self.
The result will be of the format #<RDF::Value::0x12345678(...)>,
where ... is the string returned by #to_s.
111 112 113 |
# File 'lib/rdf/model/value.rb', line 111 def inspect sprintf("#<%s:%#0x(%s)>", self.class.name, __id__, to_s) end |
- inspect!
This method returns an undefined value.
Outputs a developer-friendly representation of self to stderr.
119 120 121 |
# File 'lib/rdf/model/value.rb', line 119 def inspect! warn(inspect) end |
- (Boolean) iri?
Returns true if self is an IRI reference.
By default this is simply an alias for #uri?.
75 76 77 |
# File 'lib/rdf/model/value.rb', line 75 def iri? uri? end |
- (Boolean) literal?
Returns true if self is a literal.
41 42 43 |
# File 'lib/rdf/model/value.rb', line 41 def literal? false end |
- (Boolean) node?
Returns true if self is a blank node.
49 50 51 |
# File 'lib/rdf/model/value.rb', line 49 def node? false end |
- (Boolean) resource?
Returns true if self is a resource.
57 58 59 |
# File 'lib/rdf/model/value.rb', line 57 def resource? false end |
- (Boolean) statement?
Returns true if self is a statement.
65 66 67 |
# File 'lib/rdf/model/value.rb', line 65 def statement? false end |
- (String) to_ntriples
Returns the N-Triples representation of this value.
This method is only available when the 'rdf/ntriples' serializer has been explicitly required.
100 101 102 |
# File 'lib/rdf/ntriples.rb', line 100 def to_ntriples RDF::NTriples.serialize(self) end |
- (String) to_quad
Returns the N-Triples representation of this value.
This method is only available when the 'rdf/ntriples' serializer has been explicitly required.
147 148 149 |
# File 'lib/rdf/nquads.rb', line 147 def to_quad RDF::NQuads.serialize(self) end |
- (RDF::Value) to_rdf
Returns an RDF::Value representation of self.
100 101 102 |
# File 'lib/rdf/model/value.rb', line 100 def to_rdf self end |
- (false) type_error(message)
Default implementation of raise_error, which returns false. Classes including RDF::TypeCheck will raise RDF::TypeError instead.
129 130 131 |
# File 'lib/rdf/model/value.rb', line 129 def type_error() false end |
- (Boolean) uri?
Returns true if self is a URI reference.
83 84 85 |
# File 'lib/rdf/model/value.rb', line 83 def uri? false end |
- (Boolean) variable?
Returns true if self is a query variable.
92 93 94 |
# File 'lib/rdf/model/value.rb', line 92 def variable? false end |