Module: RDF

Defined in:
lib/rubyrdf.rb,
lib/rdf/query.rb,
lib/rdf/triple.rb,
lib/rdf/version.rb,
lib/rdf/uri_node.rb,
lib/rdf/namespace.rb,
lib/rdf/blank_node.rb,
lib/rdf/exceptions.rb,
lib/rdf/graph/base.rb,
lib/rdf/graph/tests.rb,
lib/rdf/graph/memory.rb,
lib/rdf/query/result.rb,
lib/rdf/query/binding.rb,
lib/rdf/query/executer.rb,
lib/rdf/format/ntriples.rb,
lib/rdf/plain_literal_node.rb,
lib/rdf/typed_literal_node.rb

Defined Under Namespace

Modules: Format, Graph, Namespace, VERSION Classes: BlankNode, Error, InvalidPredicateError, InvalidSubjectError, PlainLiteralNode, Query, SyntaxError, Triple, TypedLiteralNode, UnassociatedBlankNodeError, UnsupportedFormatError, UriNode

Class Method Summary collapse

Class Method Details

.BlankNode?(node) ⇒ Boolean

Returns true if node is a BlankNode, or a duck type of BlankNode.

Returns:

  • (Boolean)


30
31
32
# File 'lib/rubyrdf.rb', line 30

def self.BlankNode?(node)
  node.respond_to?(:graph) && node.respond_to?(:name)
end

.LiteralNode?(node) ⇒ Boolean

Returns true if node is either a PlainLiteralNode or a TypedLiteralNode

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/rubyrdf.rb', line 9

def self.LiteralNode?(node)
  PlainLiteralNode?(node) ||
  TypedLiteralNode?(node)
end

.Node?(node) ⇒ Boolean

Returns true if node is a BlankNode, LiteralNode, or UriNode.

Returns:

  • (Boolean)


35
36
37
# File 'lib/rubyrdf.rb', line 35

def self.Node?(node)
  BlankNode?(node) || LiteralNode?(node) || UriNode?(node)
end

.PlainLiteralNode?(node) ⇒ Boolean

Returns true if node is a PlainLiteralNode, or a duck type of PlainLiteralNode.

Returns:

  • (Boolean)


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

def self.PlainLiteralNode?(node)
  node.respond_to?(:lexical_form) && node.respond_to?(:language_tag)
end

.Triple?(triple) ⇒ Boolean

Returns true if +triple? is a Triple, or a duck type of Triple.

Returns:

  • (Boolean)


40
41
42
# File 'lib/rubyrdf.rb', line 40

def self.Triple?(triple)
  triple.respond_to?(:subject) && triple.respond_to?(:predicate) && triple.respond_to?(:object)
end

.TypedLiteralNode?(node) ⇒ Boolean

Returns true if node is a TypedLiteralNode, or a duck type of TypedLiteralNode.

Returns:

  • (Boolean)


20
21
22
# File 'lib/rubyrdf.rb', line 20

def self.TypedLiteralNode?(node)
  node.respond_to?(:lexical_form) && node.respond_to?(:datatype_uri)
end

.UriNode?(node) ⇒ Boolean

Returns true if node is a UriNode, or a duck type of UriNode.

Returns:

  • (Boolean)


25
26
27
# File 'lib/rubyrdf.rb', line 25

def self.UriNode?(node)
  node.respond_to?(:uri)
end