Class: RDF::Reasoner::Format

Inherits:
Format show all
Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-reasoner-17c965b5c3d4/lib/rdf/reasoner/format.rb

Overview

LD::Patch format specification. Note that this format does not define any readers or writers.

Examples:

Obtaining an LD Patch format class

RDF::Format.for(:reasoner)           #=> RDF::Reasoner::Format

See Also:

Class Method Summary collapse

Methods inherited from Format

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

Class Method Details

.cli_commandsHash{Symbol => Lambda(Array, Hash)}

Hash of CLI commands appropriate for this format

Returns:



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
43
44
45
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-reasoner-17c965b5c3d4/lib/rdf/reasoner/format.rb', line 14

def self.cli_commands
  {
    entail: {
      description: "Add entailed triples to repository",
      help: "entail\nPerform RDFS, OWL and schema.org entailment to expand the repository based on referenced built-in vocabuaries",
      control: :button, # Treats this like a separate control in the HTML UI
      parse: true,
      lambda: ->(argv, opts) do
        RDF::Reasoner.apply(:rdfs, :owl, :schema)
        start, stmt_cnt = Time.now, RDF::CLI.repository.count
        RDF::CLI.repository.entail!
        secs, new_cnt = (Time.new - start), (RDF::CLI.repository.count - stmt_cnt)
        opts[:logger].info "\nEntailed #{new_cnt} new statements in #{secs} seconds."
      end
    },
    lint: {
      description: "Lint the repository",
      help: "lint\nLint the repository using built-in vocabularies",
      parse: true,
      option_use: {output_format: :disabled},
      lambda: ->(argv, opts) do
        RDF::Reasoner.apply(:rdfs, :owl, :schema)
        start = Time.now
        # Messages added to opts for appropriate display
        opts[:messages].merge!(RDF::CLI.repository.lint)
        opts[:output].puts "Linter responded with #{opts[:messages].empty? ? 'no' : ''} messages."
        secs = Time.new - start
        opts[:logger].info "\nLinted in #{secs} seconds."
      end
    }
  }
end