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_PLAIN, RDF::NTriples::Writer::ESCAPE_PLAIN_U
Instance Attribute Summary
Attributes inherited from Writer
Instance Method Summary collapse
-
#format_quad(subject, predicate, object, graph_name, options = {}) ⇒ String
Returns the N-Triples representation of a triple.
-
#format_statement(statement, options = {}) ⇒ String
Returns the N-Quads representation of a statement.
-
#write_quad(subject, predicate, object, graph_name) ⇒ void
Outputs the N-Quads representation of a statement.
Methods inherited from RDF::NTriples::Writer
escape, escape_ascii, escape_unicode, escape_utf16, escape_utf32, #escaped, #format_literal, #format_node, #format_triple, #format_uri, #initialize, serialize, #write_comment, #write_triple
Methods included from Util::Logger
#log_debug, #log_depth, #log_error, #log_fatal, #log_info, #log_recover, #log_recovering?, #log_statistics, #log_warn, #logger
Methods inherited from Writer
#base_uri, buffer, #canonicalize?, dump, each, #encoding, #flush, for, format, #format_list, #format_literal, #format_node, #format_term, #format_uri, #initialize, open, options, #prefix, #prefixes, #prefixes=, to_sym, #to_sym, #validate?, #write_comment, #write_epilogue, #write_prologue, #write_statement, #write_triple, #write_triples
Methods included from Util::Aliasing::LateBound
Methods included from Writable
Constructor Details
This class inherits a constructor from RDF::NTriples::Writer
Instance Method Details
#format_quad(subject, predicate, object, graph_name, options = {}) ⇒ String
Returns the N-Triples representation of a triple.
122 123 124 125 126 |
# File 'lib/rdf/nquads.rb', line 122 def format_quad(subject, predicate, object, graph_name, = {}) s = "%s %s %s " % [subject, predicate, object].map { |value| format_term(value, ) } s += format_term(graph_name, ) + " " if graph_name s + "." end |
#format_statement(statement, options = {}) ⇒ String
Returns the N-Quads representation of a statement.
109 110 111 |
# File 'lib/rdf/nquads.rb', line 109 def format_statement(statement, = {}) format_quad(*statement.to_quad, ) end |
#write_quad(subject, predicate, object, graph_name) ⇒ void
This method returns an undefined value.
Outputs the N-Quads representation of a statement.
98 99 100 |
# File 'lib/rdf/nquads.rb', line 98 def write_quad(subject, predicate, object, graph_name) puts format_quad(subject, predicate, object, graph_name, ) end |