Class: SPARQL::Algebra::Operator::UUID

Inherits:
Nullary show all
Includes:
Evaluatable
Defined in:
vendor/bundler/ruby/2.5.0/bundler/gems/sparql-bb59900f675b/lib/sparql/algebra/operator/uuid.rb

Overview

The SPARQL uuid function.

Examples:

(prefix ((: <http://example.org/>)
         (xsd: <http://www.w3.org/2001/XMLSchema#>))
  (project (?length)
    (extend ((?length (strlen (str ?uuid))))
      (filter (&& (isIRI ?uuid) (regex (str ?uuid) "^urn:uuid:[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$" "i"))
        (extend ((?uuid (uuid)))
          (bgp))))))

See Also:

Constant Summary

NAME =
:uuid

Constants inherited from Nullary

Nullary::ARITY

Constants inherited from SPARQL::Algebra::Operator

ARITY, IsURI, URI

Instance Attribute Summary

Attributes inherited from SPARQL::Algebra::Operator

#operands

Instance Method Summary collapse

Methods included from Evaluatable

#evaluate, #memoize, #replace_aggregate!, #replace_vars!

Methods inherited from Nullary

#initialize

Methods inherited from SPARQL::Algebra::Operator

#aggregate?, arity, #base_uri, base_uri, base_uri=, #boolean, #constant?, #each_descendant, #eql?, #evaluatable?, evaluate, #executable?, #first_ancestor, for, #initialize, #inspect, #ndvars, #node?, #operand, #optimize, #parent, #parent=, prefixes, #prefixes, prefixes=, #rewrite, #to_binary, #to_sxp, #to_sxp_bin, #validate!, #variable?, #vars

Methods included from Expression

cast, #constant?, #evaluate, extension, extensions, for, #invalid?, new, #node?, open, #optimize, parse, register_extension, #to_sxp_bin, #valid?, #validate!, #variable?

Constructor Details

This class inherits a constructor from SPARQL::Algebra::Operator::Nullary

Instance Method Details

#applyRDF::URI

Return a fresh IRI from the UUID URN scheme. Each call of UUID() returns a different UUID. It must not be the "nil" UUID (all zeroes). The variant and version of the UUID is implementation dependent.

Returns:



27
28
29
# File 'vendor/bundler/ruby/2.5.0/bundler/gems/sparql-bb59900f675b/lib/sparql/algebra/operator/uuid.rb', line 27

def apply
  RDF::URI("urn:uuid:#{SecureRandom.uuid}")
end