Class: RDF::NQuads::Writer

Inherits:
RDF::NTriples::Writer show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-491e9bb5b443/lib/rdf/nquads.rb

Overview

Reader

Direct Known Subclasses

RDF::Normalize::Writer

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

#options

Instance Method Summary collapse

Methods inherited from RDF::NTriples::Writer

escape, escape_ascii, escape_unicode, escape_utf16, escape_utf32, #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, #escaped, #flush, for, format, #format_list, #format_literal, #format_node, #format_term, #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

#alias_method

Methods included from Writable

#<<, #insert, #insert_graph, #insert_reader, #insert_statement, #insert_statements, #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.

Parameters:

Returns:



122
123
124
125
126
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-491e9bb5b443/lib/rdf/nquads.rb', line 122

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) ⇒ String

Returns the N-Quads representation of a statement.

Parameters:

Returns:

Since:

  • 0.4.0



109
110
111
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-491e9bb5b443/lib/rdf/nquads.rb', line 109

def format_statement(statement, **options)
  format_quad(*statement.to_quad, options)
end

#write_quad(subject, predicate, object, graph_name)

This method returns an undefined value.

Outputs the N-Quads representation of a statement.

Parameters:



98
99
100
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-491e9bb5b443/lib/rdf/nquads.rb', line 98

def write_quad(subject, predicate, object, graph_name)
  puts format_quad(subject, predicate, object, graph_name, @options)
end