Class: RDF::Query::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf/n3/refinements.rb,
lib/rdf/n3/extensions.rb

Overview

Refinements on RDF::Query::Variable

Instance Method Summary collapse

Instance Method Details

#as_numberRDF::Literal::Numeric

Parse the value as a numeric literal, or return 0.

Returns:

  • (RDF::Literal::Numeric)


194
195
196
# File 'lib/rdf/n3/extensions.rb', line 194

def as_number
  RDF::Literal(0)
end

#evaluate(bindings, formulae:, **options) ⇒ RDF::Term

If variable is bound, replace with the bound value, otherwise, returns itself

Parameters:

  • bindings (Hash{Symbol => RDF::Term})

    a query solution containing zero or more variable bindings

  • options (Hash{Symbol => Object})

    ({}) options passed from query

Returns:

See Also:

  • SPARQL::Algebra::Expression.evaluate


12
# File 'lib/rdf/n3/refinements.rb', line 12

def evaluate(bindings, formulae:, **options); end

#sameTerm?(other) ⇒ Boolean

True if the other is the same variable

Returns:

  • (Boolean)


186
187
188
# File 'lib/rdf/n3/extensions.rb', line 186

def sameTerm?(other)
  other.is_a?(::RDF::Query::Variable) && name.eql?(other.name)
end