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
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)
-
- (String) format_quad(subject, predicate, object, context)
Returns the N-Triples representation of a triple.
-
- (String) format_statement(statement)
Returns the N-Quads representation of a statement.
-
- write_quad(subject, predicate, object, context)
Outputs the N-Quads representation of a statement.
-
- write_statement(statement)
(also: #insert_statement)
self.
Methods inherited from RDF::NTriples::Writer
escape, escape_ascii, escape_unicode, escape_utf16, escape_utf32, #format_literal, #format_node, #format_triple, #format_uri, serialize, #write_comment, #write_triple
Methods inherited from Writer
#base_uri, buffer, dump, each, #escaped, #flush, for, format, #format_list, #format_literal, #format_node, #format_term, #format_uri, #initialize, #node_id, open, #prefix, #prefixes, #prefixes=, #puts, #quoted, #to_sym, to_sym, #uri_for, #write_comment, #write_epilogue, #write_graph, #write_prologue, #write_statements, #write_triple, #write_triples
Methods included from Util::Aliasing::LateBound
Methods included from Writable
#<<, #insert, #insert_graph, #insert_reader, #insert_statements, #writable?
Constructor Details
This class inherits a constructor from RDF::Writer
Instance Method Details
- (String) format_quad(subject, predicate, object, context)
Returns the N-Triples representation of a triple.
127 128 129 130 131 |
# File 'lib/rdf/nquads.rb', line 127 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 |
- (String) format_statement(statement)
Returns the N-Quads representation of a statement.
115 116 117 |
# File 'lib/rdf/nquads.rb', line 115 def format_statement(statement) format_quad(*statement.to_quad) end |
- write_quad(subject, predicate, object, context)
This method returns an undefined value.
Outputs the N-Quads representation of a statement.
105 106 107 |
# File 'lib/rdf/nquads.rb', line 105 def write_quad(subject, predicate, object, context) puts format_quad(subject, predicate, object, context) end |
- write_statement(statement) Also known as: insert_statement
This method returns an undefined value.
self
92 93 94 95 |
# File 'lib/rdf/nquads.rb', line 92 def write_statement(statement) write_quad(*statement.to_quad) self end |