module RDF::NTriples
**‘RDF::NTriples`** provides support for the N-Triples serialization format.
N-Triples is a line-based plain-text format for encoding an RDF
graph. It is a very restricted, explicit and well-defined subset of both [Turtle](www.w3.org/TeamSubmission/turtle/) and [Notation3](www.w3.org/TeamSubmission/n3/) (N3).
The MIME content type for N-Triples files is ‘application/n-triples` and the recommended file extension is `.nt`.
An example of an RDF
statement in N-Triples format:
<https://rubygems.org/gems/rdf> <http://purl.org/dc/terms/title> "rdf" .
## Triple terms
Supports statements as resources in the object postion using ‘<<(s p o)>>`.
## Installation
This is the only RDF
serialization format that is directly supported by RDF.rb. Support for other formats is available in the form of add-on gems, e.g. ‘rdf-xml’ or ‘rdf-json’.
## Documentation
-
{RDF::NTriples::Format}
-
{RDF::NTriples::Reader}
-
{RDF::NTriples::Writer}
@example Requiring the ‘RDF::NTriples` module explicitly
require 'rdf/ntriples'
@see www.w3.org/TR/n-triples/ @see en.wikipedia.org/wiki/N-Triples
@author [Arto Bendiken](ar.to/)
Public Class Methods
Source
# File lib/rdf/ntriples.rb, line 84 def self.escape(string) Writer.escape(string) end
@param [String] string @return [String] @see RDF::NTriples::Writer.escape
@since 0.2.2
Source
# File lib/rdf/ntriples.rb, line 66 def self.serialize(value) Writer.for(:ntriples).serialize(value) end
Returns the serialized N-Triples representation of the given RDF
value.
@param [RDF::Value] value @return [String] @see RDF::NTriples::Writer.serialize
@since 0.1.5
Source
# File lib/rdf/ntriples.rb, line 75 def self.unescape(string) Reader.unescape(string) end
@param [String] string @return [String] @see RDF::NTriples::Reader.unescape
@since 0.2.2
Source
# File lib/rdf/ntriples.rb, line 54 def self.unserialize(data) Reader.unserialize(data) end
Reconstructs an RDF
value from its serialized N-Triples representation.
@param [String] data @return [RDF::Value] @see RDF::NTriples::Reader.unserialize
@since 0.1.5