Module: RDF

Defined in:
lib/rdf.rb,
lib/rdf/cli.rb,
lib/rdf/util.rb,
lib/rdf/query.rb,
lib/rdf/vocab.rb,
lib/rdf/format.rb,
lib/rdf/nquads.rb,
lib/rdf/reader.rb,
lib/rdf/writer.rb,
lib/rdf/version.rb,
lib/rdf/ntriples.rb,
lib/rdf/vocab/cc.rb,
lib/rdf/vocab/dc.rb,
lib/rdf/model/uri.rb,
lib/rdf/util/file.rb,
lib/rdf/util/uuid.rb,
lib/rdf/vocab/geo.rb,
lib/rdf/vocab/owl.rb,
lib/rdf/vocab/rsa.rb,
lib/rdf/vocab/rss.rb,
lib/rdf/vocab/wot.rb,
lib/rdf/vocab/xsd.rb,
lib/rdf/model/list.rb,
lib/rdf/model/node.rb,
lib/rdf/model/term.rb,
lib/rdf/repository.rb,
lib/rdf/util/cache.rb,
lib/rdf/vocab/cert.rb,
lib/rdf/vocab/dc11.rb,
lib/rdf/vocab/doap.rb,
lib/rdf/vocab/exif.rb,
lib/rdf/vocab/foaf.rb,
lib/rdf/vocab/http.rb,
lib/rdf/vocab/rdfs.rb,
lib/rdf/vocab/sioc.rb,
lib/rdf/vocab/skos.rb,
lib/rdf/model/graph.rb,
lib/rdf/model/value.rb,
lib/rdf/transaction.rb,
lib/rdf/vocab/xhtml.rb,
lib/rdf/mixin/durable.rb,
lib/rdf/mixin/mutable.rb,
lib/rdf/model/literal.rb,
lib/rdf/query/pattern.rb,
lib/rdf/util/aliasing.rb,
lib/rdf/mixin/readable.rb,
lib/rdf/mixin/writable.rb,
lib/rdf/model/resource.rb,
lib/rdf/mixin/countable.rb,
lib/rdf/mixin/indexable.rb,
lib/rdf/mixin/inferable.rb,
lib/rdf/mixin/queryable.rb,
lib/rdf/model/statement.rb,
lib/rdf/query/solutions.rb,
lib/rdf/mixin/enumerable.rb,
lib/rdf/mixin/type_check.rb,
lib/rdf/model/literal/xml.rb,
lib/rdf/model/literal/date.rb,
lib/rdf/model/literal/time.rb,
lib/rdf/model/literal/token.rb,
lib/rdf/model/literal/double.rb,
lib/rdf/model/literal/boolean.rb,
lib/rdf/model/literal/decimal.rb,
lib/rdf/model/literal/integer.rb,
lib/rdf/model/literal/numeric.rb,
lib/rdf/model/literal/datetime.rb

Defined Under Namespace

Modules: Countable, Durable, Enumerable, Indexable, Inferable, Mutable, NQuads, NTriples, Queryable, Readable, Resource, Term, TypeCheck, Util, VERSION, Value, Writable Classes: CC, CERT, CLI, DC, DC11, DOAP, EXIF, FOAF, Format, FormatError, GEO, Graph, HTTP, List, Literal, Node, OWL, Query, RDFS, RSA, RSS, Reader, ReaderError, Repository, SIOC, SKOS, Statement, Transaction, URI, Vocabulary, WOT, Writer, WriterError, XHTML, XSD

Constant Summary collapse

Enumerator =

For compatibility with both Ruby 1.8.x and Ruby 1.9.x:

defined?(::Enumerator) ? ::Enumerator : ::Enumerable::Enumerator
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)


160
161
162
# File 'lib/rdf.rb', line 160

def self.[](property)
  RDF::URI.intern([to_uri.to_s, property.to_s].join)
end

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

Alias for ‘RDF::Graph.new`.

Returns:



130
131
132
# File 'lib/rdf.rb', line 130

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

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

Alias for ‘RDF::Literal.new`.

Returns:



119
120
121
122
123
124
# File 'lib/rdf.rb', line 119

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) ⇒ URI

Parameters:

  • property (Symbol)

Returns:

Raises:

  • (NoMethodError)


168
169
170
171
172
173
174
# File 'lib/rdf.rb', line 168

def self.method_missing(property, *args, &block)
  if args.empty?
    self[property]
  else
    super
  end
end

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

Alias for ‘RDF::Node.new`.

Returns:



91
92
93
# File 'lib/rdf.rb', line 91

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

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

Alias for ‘RDF::Resource.new`.

Returns:



83
84
85
# File 'lib/rdf.rb', line 83

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

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

Alias for ‘RDF::Statement.new`.

Returns:



138
139
140
# File 'lib/rdf.rb', line 138

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

.to_rdfURI

Returns:



178
179
180
# File 'lib/rdf.rb', line 178

def self.to_rdf
  to_uri
end

.to_uriURI

Returns:



184
185
186
# File 'lib/rdf.rb', line 184

def self.to_uri
  RDF::URI.intern("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
end

.typeURI

Returns:



153
154
155
# File 'lib/rdf.rb', line 153

def self.type
  self[:type]
end

.URI(uri) ⇒ RDF::URI .URI(options = {}) ⇒ RDF::URI

Alias for ‘RDF::URI.new`.

Overloads:

  • .URI(uri) ⇒ RDF::URI

    Parameters:

    • uri (URI, String, #to_s)
  • .URI(options = {}) ⇒ RDF::URI

    Parameters:

    • Hash{Symbol (Hash{Symbol => Object} options)

      > Object} options

Returns:



105
106
107
108
109
110
111
112
113
# File 'lib/rdf.rb', line 105

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

.Vocabulary(uri) ⇒ Class

Alias for ‘RDF::Vocabulary.create`.

Parameters:

  • uri (String)

Returns:

  • (Class)


147
148
149
# File 'lib/rdf.rb', line 147

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