Module: RDF

Defined in:
lib/rdf/threadsafe.rb,
lib/rdf/threadsafe/util/cache.rb

Defined Under Namespace

Modules: Util

Class Method Summary collapse

Class Method Details

.[](property) ⇒ #to_s, URI

Returns:

  • (#to_s)

    property

  • (URI)


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

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:

  • (RDF::Graph)


54
55
56
# File 'lib/rdf/threadsafe.rb', line 54

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

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

Alias for ‘RDF::Literal.new`.

Returns:

  • (RDF::Literal)


43
44
45
46
47
48
# File 'lib/rdf/threadsafe.rb', line 43

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)


92
93
94
95
96
97
98
# File 'lib/rdf/threadsafe.rb', line 92

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:

  • (RDF::Node)


15
16
17
# File 'lib/rdf/threadsafe.rb', line 15

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

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

Alias for ‘RDF::Resource.new`.

Returns:

  • (RDF::Resource)


7
8
9
# File 'lib/rdf/threadsafe.rb', line 7

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

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

Alias for ‘RDF::Statement.new`.

Returns:

  • (RDF::Statement)


62
63
64
# File 'lib/rdf/threadsafe.rb', line 62

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

.to_rdfURI

Returns:



102
103
104
# File 'lib/rdf/threadsafe.rb', line 102

def self.to_rdf
  to_uri
end

.to_uriURI

Returns:



108
109
110
# File 'lib/rdf/threadsafe.rb', line 108

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

.typeURI

Returns:



77
78
79
# File 'lib/rdf/threadsafe.rb', line 77

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:

  • (RDF::URI)


29
30
31
32
33
34
35
36
37
# File 'lib/rdf/threadsafe.rb', line 29

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)


71
72
73
# File 'lib/rdf/threadsafe.rb', line 71

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