/
format.rb
42 lines (39 loc) · 1.38 KB
/
format.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module RDF::N3
##
# RDFa format specification.
#
# @example Obtaining an Notation3 format class
# RDF::Format.for(:n3) #=> RDF::N3::Format
# RDF::Format.for("etc/foaf.n3")
# RDF::Format.for(:file_name => "etc/foaf.n3")
# RDF::Format.for(:file_extension => "n3")
# RDF::Format.for(:content_type => "text/n3")
#
# @example Obtaining serialization format MIME types
# RDF::Format.content_types #=> {"text/n3")" => [RDF::N3::Format]}
#
# @example Obtaining serialization format file extension mappings
# RDF::Format.file_extensions #=> {:n3 => "text/n3"}
#
# @see http://www.w3.org/TR/rdf-testcases/#ntriples
class Format < RDF::Format
content_type 'text/n3', :extension => :n3, :aliases => %w(text/rdf+n3 application/rdf+n3)
content_encoding 'utf-8'
reader { RDF::N3::Reader }
writer { RDF::N3::Writer }
end
# Alias for N3 format
#
# This allows the following:
#
# @example Obtaining an Notation3 format class
# RDF::Format.for(:ttl) #=> RDF::N3::Notation3
# RDF::Format.for(:ttl).reader #=> RDF::N3::Reader
# RDF::Format.for(:ttl).writer #=> RDF::N3::Writer
class Notation3 < RDF::Format
content_type 'text/n3', :extension => :n3
content_encoding 'utf-8'
reader { RDF::N3::Reader }
writer { RDF::N3::Writer }
end
end