class RDF::NQuads::Writer
Public Instance Methods
format_quad(subject, predicate, object, graph_name, options = {})
click to toggle source
Returns the N-Triples representation of a triple.
@param [RDF::Resource] subject @param [RDF::URI] predicate @param [RDF::Term] object @param [RDF::Term] graph_name @param [Hash{Symbol => Object}] options = ({}) @return [String]
# File lib/rdf/nquads.rb, line 121 def format_quad(subject, predicate, object, graph_name, options = {}) s = "%s %s %s " % [subject, predicate, object].map { |value| format_term(value, options) } s += format_term(graph_name, options) + " " if graph_name s + "." end
format_statement(statement, options = {})
click to toggle source
Returns the N-Quads representation of a statement.
@param [RDF::Statement] statement @param [Hash{Symbol => Object}] options = ({}) @return [String] @since 0.4.0
# File lib/rdf/nquads.rb, line 108 def format_statement(statement, options = {}) format_quad(*statement.to_quad, options) end
write_quad(subject, predicate, object, graph_name)
click to toggle source
Outputs the N-Quads representation of a statement.
@param [RDF::Resource] subject @param [RDF::URI] predicate @param [RDF::Term] object @return [void]
# File lib/rdf/nquads.rb, line 97 def write_quad(subject, predicate, object, graph_name) puts format_quad(subject, predicate, object, graph_name, @options) end