Class: RDF::RDFXML::Format

Inherits:
Format show all
Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml/format.rb

Overview

RDFXML format specification.

Examples:

Obtaining an RDFXML format class

RDF::Format.for(:rdf)         # RDF::RDFXML::Format
RDF::Format.for(:rdfxml)      # RDF::RDFXML::Format
RDF::Format.for("etc/foaf.xml")
RDF::Format.for(file_name: "etc/foaf.xml")
RDF::Format.for(file_extension: "xml")
RDF::Format.for(file_extension: "rdf")
RDF::Format.for(content_type: "application/xml")
RDF::Format.for(content_type: "application/rdf+xml")

Obtaining serialization format MIME types

RDF::Format.content_types      #=> {"application/rdf+xml" => [RDF::RDFXML::Format]}

Obtaining serialization format file extension mappings

RDF::Format.file_extensions    #=> {rdf: "application/rdf+xml"}

See Also:

Class Method Summary collapse

Methods inherited from Format

accept_type, accept_types, cli_commands, content_encoding, content_type, content_types, each, file_extension, file_extensions, for, reader, reader_symbols, reader_types, require, to_sym, writer, writer_symbols, writer_types

Class Method Details

.detect(sample) ⇒ Boolean

Sample detection to see if it matches RDF/XML (not Microdata or RDFa)

Use a text sample to detect the format of an input file. Sub-classes implement a matcher sufficient to detect probably format matches, including disambiguating between other similar formats.

Parameters:

  • sample (String)

    Beginning several bytes (~ 1K) of input.

Returns:

  • (Boolean)


38
39
40
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml/format.rb', line 38

def self.detect(sample)
  sample.match(/<(\w+:)?(RDF)/)
end

.nameObject

Override name of format



43
44
45
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml/format.rb', line 43

def self.name
  "RDF/XML"
end

.symbolsObject



47
48
49
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml/format.rb', line 47

def self.symbols
  [:rdfxml, :rdf, :owl]
end