Module: RDF::Value
- 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
-
#graph? ⇒ Boolean
Returns ‘true` if `self` is a graph.
-
#inspect ⇒ String
Returns a developer-friendly representation of ‘self`.
-
#inspect! ⇒ void
Outputs a developer-friendly representation of ‘self` to `stderr`.
-
#iri? ⇒ Boolean
Returns ‘true` if `self` is an IRI reference.
-
#literal? ⇒ Boolean
Returns ‘true` if `self` is a literal.
-
#node? ⇒ Boolean
Returns ‘true` if `self` is a blank node.
-
#resource? ⇒ Boolean
Returns ‘true` if `self` is a resource.
-
#statement? ⇒ Boolean
Returns ‘true` if `self` is a statement.
-
#to_ntriples ⇒ String
Returns the N-Triples representation of this value.
-
#to_quad ⇒ String
Returns the N-Triples representation of this value.
-
#to_rdf ⇒ RDF::Value
Returns an ‘RDF::Value` representation of `self`.
-
#type_error(message) ⇒ false
Default implementation of raise_error, which returns false.
-
#uri? ⇒ Boolean
Returns ‘true` if `self` is a URI reference.
-
#variable? ⇒ Boolean
Returns ‘true` if `self` is a query variable.
Instance Method Details
#graph? ⇒ Boolean
Returns ‘true` if `self` is a graph.
33 34 35 |
# File 'lib/rdf/model/value.rb', line 33 def graph? false end |
#inspect ⇒ String
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! ⇒ void
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 |
#iri? ⇒ Boolean
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 |
#literal? ⇒ Boolean
Returns ‘true` if `self` is a literal.
41 42 43 |
# File 'lib/rdf/model/value.rb', line 41 def literal? false end |
#node? ⇒ Boolean
Returns ‘true` if `self` is a blank node.
49 50 51 |
# File 'lib/rdf/model/value.rb', line 49 def node? false end |
#resource? ⇒ Boolean
Returns ‘true` if `self` is a resource.
57 58 59 |
# File 'lib/rdf/model/value.rb', line 57 def resource? false end |
#statement? ⇒ Boolean
Returns ‘true` if `self` is a statement.
65 66 67 |
# File 'lib/rdf/model/value.rb', line 65 def statement? false end |
#to_ntriples ⇒ String
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 |
#to_quad ⇒ String
Returns the N-Triples representation of this value.
This method is only available when the ‘rdf/ntriples’ serializer has been explicitly required.
148 149 150 |
# File 'lib/rdf/nquads.rb', line 148 def to_quad RDF::NQuads.serialize(self) end |
#to_rdf ⇒ RDF::Value
Returns an ‘RDF::Value` representation of `self`.
100 101 102 |
# File 'lib/rdf/model/value.rb', line 100 def to_rdf self end |
#type_error(message) ⇒ false
Default implementation of raise_error, which returns false. Classes including RDF::TypeCheck will raise TypeError instead.
129 130 131 |
# File 'lib/rdf/model/value.rb', line 129 def type_error() false end |
#uri? ⇒ Boolean
Returns ‘true` if `self` is a URI reference.
83 84 85 |
# File 'lib/rdf/model/value.rb', line 83 def uri? false end |
#variable? ⇒ Boolean
Returns ‘true` if `self` is a query variable.
92 93 94 |
# File 'lib/rdf/model/value.rb', line 92 def variable? false end |