Module: RDF

Included in:
SPARQL::Algebra
Defined in:
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-vocab-b3eb6a659d03/lib/rdf/vocab/extensions.rb,
lib/rdf/distiller.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-aggregate-repo-45fafd584c75/lib/rdf/aggregate_repo/merge_graph.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-aggregate-repo-45fafd584c75/lib/rdf/aggregate_repo.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-do-4159ad0e4bef/lib/rdf/do.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/changeset.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/cli.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/format.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/countable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/durable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/enumerable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/enumerator.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/indexable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/mutable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/queryable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/readable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/transactable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/type_check.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/mixin/writable.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/dataset.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/graph.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/list.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/boolean.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/date.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/datetime.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/decimal.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/double.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/integer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/numeric.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/time.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal/token.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/literal.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/node.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/resource.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/statement.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/term.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/uri.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/model/value.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/nquads.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/ntriples.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/query/hash_pattern_normalizer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/query/pattern.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/query/solutions.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/query.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/reader.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/repository.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/transaction.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util/aliasing.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util/cache.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util/file.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util/logger.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util/uuid.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/util.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/version.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocab/owl.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocab/rdfs.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocab/rdfv.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocab/writer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocab/xsd.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/vocabulary.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf/writer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-isomorphic-65fb6d31edac/lib/rdf/isomorphic.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-json-3f36e90af14f/lib/rdf/json/version.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-json-3f36e90af14f/lib/rdf/json.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-microdata-735ed0245b16/lib/rdf/microdata/vocab.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-microdata-735ed0245b16/lib/rdf/microdata.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-n3-8c8998830ecd/lib/rdf/n3/vocab.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-n3-8c8998830ecd/lib/rdf/n3.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-normalize-e113452533ce/lib/rdf/normalize.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa/vocab.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfa-477a5bc9b975/lib/rdf/rdfa.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml/vocab.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-rdfxml-5324e00a23df/lib/rdf/rdfxml.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-reasoner-17c965b5c3d4/lib/rdf/reasoner/extensions.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-reasoner-17c965b5c3d4/lib/rdf/reasoner.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-spec-7e186ad0cd77/lib/rdf/spec/matchers.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-spec-7e186ad0cd77/lib/rdf/spec/version.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-spec-7e186ad0cd77/lib/rdf/spec.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-tabular-49a60e0be3ee/lib/rdf/tabular.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-trig-d2d7b59405db/lib/rdf/trig.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-trix-a9b9857ad478/lib/rdf/trix.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-turtle-20c7892544a6/lib/rdf/turtle.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-vocab-b3eb6a659d03/lib/rdf/vocab.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/any_uri.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/binary.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/date.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/double.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/duration.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/integer.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/rdf-xsd-ec78ebe10f85/lib/rdf/xsd/xml.rb,
vendor/bundler/ruby/2.4.0/bundler/gems/json-ld-a1a01db875af/lib/json/ld/extensions.rb

Overview

Monkey-patch RDF::Vocab.each to load all vocabularies

Defined Under Namespace

Modules: Countable, DataObjects, Distiller, Durable, Enumerable, Indexable, Isomorphic, JSON, Microdata, Mutable, N3, NQuads, NTriples, Normalize, Queryable, RDFXML, RDFa, Readable, Reasoner, Resource, Spec, Tabular, Term, Transactable, TriG, TriX, Turtle, TypeCheck, Util, VERSION, Value, Vocab, Writable Classes: AggregateRepo, CLI, Changeset, Dataset, Format, FormatError, Graph, HCalendar, HCard, LOG, List, Literal, MD, MergeGraph, Node, OWL, Query, RDFA, RDFS, RDFV, REI, Reader, ReaderError, Repository, Statement, StrictVocabulary, Transaction, URI, Vocabulary, Writer, WriterError, XML, XSD, XSI

Constant Summary

IRI =

RDF::IRI is a synonym for RDF::URI

URI
VOCABS =
Dir.glob(File.join(File.dirname(__FILE__), 'rdf', 'vocab', '*.rb')).map { |f| File.basename(f)[0...-(File.extname(f).size)].to_sym } rescue []

Class Method Summary collapse

Class Method Details

.[](property) ⇒ #to_s, URI

Returns:

  • (#to_s)

    property

  • (URI)


199
200
201
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 199

def self.[](property)
  property.to_s =~ %r{_\d+} ? RDF::URI("#{to_uri}#{property}") : RDF::RDFV[property]
end

.const_missing(constant) ⇒ Object

Use const_missing instead of autoload to load most vocabularies so we can provide deprecation messages



61
62
63
64
65
66
67
68
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 61

def self.const_missing(constant)
  if VOCABS.include?(constant.to_s.downcase.to_sym)
    require "rdf/vocab/#{constant.to_s.downcase}"
    const_get(constant)
  else
    super
  end
end

.enum_for(method = :each_statement, *args) ⇒ RDF::Enumerable::Enumerator Also known as: to_enum

Return an enumerator over Statement defined for this vocabulary.

Returns:

See Also:

  • Object#enum_for


207
208
209
210
211
212
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 207

def self.enum_for(method = :each_statement, *args)
  # Ensure that enumerators are, themselves, queryable
  Enumerable::Enumerator.new do |yielder|
    RDF::RDFV.send(method, *args) {|*y| yielder << (y.length > 1 ? y : y.first)}
  end
end

.Graph(**options, &block) ⇒ RDF::Graph

Alias for RDF::Graph.new.

Parameters:

  • graph_name (RDF::Resource)

    The graph_name from the associated Queryable associated with this graph as provided with the :data option (only for Queryable instances supporting named graphs).

  • data (RDF::Queryable)

    (RDF::Repository.new) Storage behind this graph.

Returns:



117
118
119
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 117

def self.Graph(**options, &block)
  Graph.new(options, &block)
end

.ListRDF::URI .List(*args) ⇒ RDF::List .List(array) ⇒ RDF::List .List(list) ⇒ RDF::List

Overloads:



136
137
138
139
140
141
142
143
144
145
146
147
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 136

def self.List(*args)
  case
  when args.empty?
    RDF[:List]
  when args.length == 1 && args.first.is_a?(RDF::List)
    args.first
  when args.length == 1 && args.first.is_a?(Array)
    List[*args.first]
  else
    List[*args]
  end
end

.Literal(*args, &block) ⇒ RDF::Literal

Alias for RDF::Literal.new.

Parameters:

  • value (Object)
  • language (Symbol)

    (nil) Language is downcased to ensure proper matching

  • lexical (String)

    (nil) Supplied lexical representation of this literal, otherwise it comes from transforming value to a string form..

  • datatype (URI)

    (nil)

  • validate (Boolean)

    (false)

  • canonicalize (Boolean)

    (false)

Returns:



105
106
107
108
109
110
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 105

def self.Literal(*args, &block)
  case literal = args.first
    when RDF::Literal then literal
    else Literal.new(*args, &block)
  end
end

.method_missing(property, *args, &block) ⇒ Object

Delegate other methods to RDF::RDFV



225
226
227
228
229
230
231
232
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 225

def self.method_missing(property, *args, &block)
  if args.empty?
    # Special-case rdf:_n for all integers
    property.to_s =~ %r{_\d+} ? RDF::URI("#{to_uri}#{property}") : RDF::RDFV.send(property)
  else
    super
  end
end

.Node(*args, &block) ⇒ RDF::Node

Alias for RDF::Node.new.

Parameters:

  • id (#to_s)

Returns:



87
88
89
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 87

def self.Node(*args, &block)
  Node.new(*args, &block)
end

.Resource(*args, &block) ⇒ RDF::Resource

Alias for RDF::Resource.new.

Returns:



78
79
80
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 78

def self.Resource(*args, &block)
  Resource.new(*args, &block)
end

.respond_to?(method, include_all = false) ⇒ Boolean

respond to module or RDFV

Returns:

  • (Boolean)


219
220
221
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 219

def self.respond_to?(method, include_all = false)
  super || RDF::RDFV.respond_to?(method, include_all)
end

.StatementRDF::URI .Statement(**options) ⇒ RDF::Statement .Statement(subject, predicate, object, **options) ⇒ RDF::Statement

Overloads:



170
171
172
173
174
175
176
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 170

def self.Statement(*args)
  if args.empty?
    RDF[:Statement]
  else
    Statement.new(*args)
  end
end

.StrictVocabulary(prefix) ⇒ Class

Alias for RDF::StrictVocabulary.create.

Parameters:

Returns:

  • (Class)


192
193
194
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 192

def self.StrictVocabulary(prefix)
  StrictVocabulary.create(prefix)
end

.URI(*args, &block) ⇒ RDF::URI

Cast to a URI. If already a URI, return the passed argument.

Returns:



96
97
98
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 96

def self.URI(*args, &block)
  (uri = args.first).respond_to?(:to_uri) ? uri.to_uri : URI.new(*args, &block)
end

.Vocabulary(uri) ⇒ Class

Alias for RDF::Vocabulary.create.

Parameters:

Returns:

  • (Class)


183
184
185
# File 'vendor/bundler/ruby/2.4.0/bundler/gems/rdf-e7b328907124/lib/rdf.rb', line 183

def self.Vocabulary(uri)
  Vocabulary.create(uri)
end