@@ -30,19 +30,28 @@ def self.cache
3030 ##
3131 # Returns a blank node with a random UUID-based identifier.
3232 #
33+ # (Depends on availability of either `uuid` or `uuidtools` gems).
34+ #
35+ # @param [:default, :compact] format (:default)
36+ # Formats supported by the UUID generator:
37+ # * `:default` Produces 36 characters, including hyphens separating the UUID value parts
38+ # * `:compact` Produces a 32 digits (hexadecimal) value with no hyphens
39+ # * `:urn` Adds the prefix urn:uuid: to the default format
3340 # @param [Regexp] grammar (nil)
3441 # a grammar specification that the generated UUID must match
42+ # The UUID is generated such that its initial part is guaranteed
43+ # to match the given `grammar`, e.g. `/^[A-Za-z][A-Za-z0-9]*/`.
44+ # Some RDF storage systems (e.g. AllegroGraph) require this.
45+ # Requires that the `uuid` gem be loadable to use `format`
3546 # @return [RDF::Node]
36- def self . uuid ( grammar : nil )
47+ def self . uuid ( format : :default , grammar : nil )
3748 case
3849 when grammar
39- # The UUID is generated such that its initial part is guaranteed
40- # to match the given `grammar`, e.g. `/^[A-Za-z][A-Za-z0-9]*/`.
41- # Some RDF storage systems (e.g. AllegroGraph) require this.
42- # @see http://github.com/bendiken/rdf/pull/43
43- uuid = RDF ::Util ::UUID . generate ( options ) until uuid =~ grammar
50+ warn "[DEPRECATION] The grammar parameter to RDF::Node#uri is deprecated.\n " +
51+ "Called from #{ Gem . location_of_caller . join ( ':' ) } "
52+ uuid = RDF ::Util ::UUID . generate ( format : format ) until uuid =~ grammar
4453 else
45- uuid = RDF ::Util ::UUID . generate ( options )
54+ uuid = RDF ::Util ::UUID . generate ( format : format )
4655 end
4756 self . new ( uuid )
4857 end
0 commit comments