Class: RDF::URI

Inherits:
Object show all
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-reasoner-63fee6d2320c/lib/rdf/reasoner/extensions.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb,
vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-d4556f730a9b/lib/json/ld/extensions.rb

Constant Summary collapse

@@entailments =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_entailment(method, proc) ⇒ Object

Add an entailment method. The method accepts no arguments, and returns or yields an array of values associated with the particular entailment method

Parameters:



13
14
15
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-reasoner-63fee6d2320c/lib/rdf/reasoner/extensions.rb', line 13

def add_entailment(method, proc)
  @@entailments[method] = proc
end

Instance Method Details

#domain_compatible?(resource, queryable, options = {}) ⇒ Boolean

Determine if the domain of a property term is consistent with the specified resource in queryable.

Parameters:

Options Hash (options):

  • :types (Array<RDF::Vocabulary::Term>)

    Fully entailed types of resource, if not provided, they are queried

Returns:

  • (Boolean)


37
38
39
40
41
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-reasoner-63fee6d2320c/lib/rdf/reasoner/extensions.rb', line 37

def domain_compatible?(resource, queryable, options = {})
  %w(owl rdfs schema).map {|r| "domain_compatible_#{r}?".to_sym}.all? do |meth|
    !self.respond_to?(meth) || self.send(meth, resource, queryable, options)
  end
end

#entail(method) {|term| ... } ⇒ Array<Term>

Perform an entailment on this term.

Parameters:

  • method (Symbol)

    A registered entailment method

Yields:

  • term

Yield Parameters:

Returns:



25
26
27
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-reasoner-63fee6d2320c/lib/rdf/reasoner/extensions.rb', line 25

def entail(method, &block)
  self.send(@@entailments.fetch(method), &block)
end

#inspectObject



11
12
13
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-spec-ab2aa521dd46/lib/rdf/spec/inspects.rb', line 11

def inspect
  "RDF::URI(#{to_base})"
end

#range_compatible?(resource, queryable, options = {}) ⇒ Boolean

Determine if the range of a property term is consistent with the specified resource in queryable.

Specific entailment regimes should insert themselves before this to apply the appropriate semantic condition

Parameters:

Options Hash (options):

  • :types (Array<RDF::Vocabulary::Term>)

    Fully entailed types of resource, if not provided, they are queried

Returns:

  • (Boolean)


53
54
55
56
57
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/rdf-reasoner-63fee6d2320c/lib/rdf/reasoner/extensions.rb', line 53

def range_compatible?(resource, queryable, options = {})
  %w(owl rdfs schema).map {|r| "range_compatible_#{r}?".to_sym}.all? do |meth|
    !self.respond_to?(meth) || self.send(meth, resource, queryable, options)
  end
end

#valid_extended?Boolean

Validate extended RDF

Returns:

  • (Boolean)


23
24
25
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/json-ld-d4556f730a9b/lib/json/ld/extensions.rb', line 23

def valid_extended?
  self.valid?
end