Class: RDF::NQuads::Writer
- Inherits:
-
RDF::NTriples::Writer
- Object
- Writer
- RDF::NTriples::Writer
- RDF::NQuads::Writer
- Defined in:
- lib/rdf/nquads.rb
Overview
Reader
Constant Summary
Constants inherited from RDF::NTriples::Writer
RDF::NTriples::Writer::ESCAPE_ASCII, RDF::NTriples::Writer::ESCAPE_PLAIN
Instance Attribute Summary
Attributes inherited from Writer
Instance Method Summary collapse
-
#format_quad(subject, predicate, object, context) ⇒ String
Returns the N-Triples representation of a triple.
-
#format_statement(statement) ⇒ String
Returns the N-Quads representation of a statement.
-
#write_quad(subject, predicate, object, context) ⇒ void
Outputs the N-Quads representation of a statement.
-
#write_statement(statement) ⇒ void
(also: #insert_statement)
‘self`.
Methods inherited from RDF::NTriples::Writer
escape, escape_ascii, escape_unicode, escape_utf16, escape_utf32, #escaped, #format_literal, #format_node, #format_triple, #format_uri, serialize, #write_comment, #write_triple
Methods inherited from Writer
#base_uri, buffer, dump, each, #flush, for, format, #format_list, #format_literal, #format_node, #format_term, #format_uri, #initialize, open, #prefix, #prefixes, #prefixes=, to_sym, #to_sym, #write_comment, #write_epilogue, #write_graph, #write_prologue, #write_statements, #write_triple, #write_triples
Methods included from Util::Aliasing::LateBound
Methods included from Writable
Constructor Details
This class inherits a constructor from RDF::Writer
Instance Method Details
#format_quad(subject, predicate, object, context) ⇒ String
Returns the N-Triples representation of a triple.
128 129 130 131 132 |
# File 'lib/rdf/nquads.rb', line 128 def format_quad(subject, predicate, object, context) s = "%s %s %s " % [subject, predicate, object].map { |value| format_term(value) } s += format_term(context) + " " if context s + "." end |
#format_statement(statement) ⇒ String
Returns the N-Quads representation of a statement.
116 117 118 |
# File 'lib/rdf/nquads.rb', line 116 def format_statement(statement) format_quad(*statement.to_quad) end |
#write_quad(subject, predicate, object, context) ⇒ void
This method returns an undefined value.
Outputs the N-Quads representation of a statement.
106 107 108 |
# File 'lib/rdf/nquads.rb', line 106 def write_quad(subject, predicate, object, context) puts format_quad(subject, predicate, object, context) end |
#write_statement(statement) ⇒ void Also known as: insert_statement
This method returns an undefined value.
Returns ‘self`.
93 94 95 96 |
# File 'lib/rdf/nquads.rb', line 93 def write_statement(statement) write_quad(*statement.to_quad) self end |