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
Constants included from Util::Logger
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)
Outputs the N-Quads representation of a statement.
Methods inherited from RDF::NTriples::Writer
escape, escape_ascii, escape_unicode, escape_utf16, escape_utf32, #format_literal, #format_node, #format_quotedTriple, #format_triple, #format_tripleTerm, #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
accept?, #base_uri, buffer, #canonicalize?, dump, each, #encoding, #escaped, #flush, for, format, #format_list, #format_literal, #format_node, #format_quotedTriple, #format_term, #format_tripleTerm, #format_uri, #initialize, #node_id, open, options, #prefix, #prefixes, #prefixes=, #puts, #quoted, to_sym, #to_sym, #uri_for, #validate?, #write_comment, #write_epilogue, #write_prologue, #write_statement, #write_triple, #write_triples
Methods included from Util::Aliasing::LateBound
Methods included from Writable
#<<, #insert, #insert_graph, #insert_reader, #insert_statement, #insert_statements, #writable?
Methods included from Util::Coercions
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.
125 126 127 128 129 |
# File 'lib/rdf/nquads.rb', line 125 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.
112 113 114 |
# File 'lib/rdf/nquads.rb', line 112 def format_statement(statement, **) format_quad(*statement.to_quad, **) end |
#write_quad(subject, predicate, object, graph_name)
This method returns an undefined value.
Outputs the N-Quads representation of a statement.
101 102 103 |
# File 'lib/rdf/nquads.rb', line 101 def write_quad(subject, predicate, object, graph_name) puts format_quad(subject, predicate, object, graph_name, **@options) end |