class SPARQL::Algebra::Operator::StrDT

The SPARQL `strdt` operator.

@example

(project (?s ?str1)
  (extend ((?str1 (strdt ?str xsd:string)))
    (filter (langMatches (lang ?str) "en")
      (bgp (triple ?s :str ?str))))))

@see www.w3.org/TR/sparql11-query/#func-strdt

Constants

NAME

Public Instance Methods

apply(value, datatypeIRI, **options) click to toggle source

Constructs a literal with lexical form and type as specified by the arguments.

@param [RDF::Literal] value

a literal

@param [RDF::URI] datatypeIRI

datatype

@return [RDF::Literal] a datatyped literal @see www.w3.org/TR/sparql11-query/#func-strdt

# File lib/sparql/algebra/operator/strdt.rb, line 27
def apply(value, datatypeIRI, **options)
  raise TypeError, "Literal #{value.inspect} is not simple" unless value.simple?
  RDF::Literal.new(value.to_s, datatype: datatypeIRI)
end