• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

SWI-Prolog C-library
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog C-library
        • Introduction
        • library(process): Create processes and redirect I/O
        • library(filesex): Extended operations on files
        • library(uid): User and group management on Unix systems
        • library(syslog): Unix syslog interface
        • library(socket): Network socket (TCP and UDP) library
        • The stream_pool library
        • library(uri): Process URIs
        • CGI Support library
        • Password encryption library
        • library(uuid): Universally Unique Identifier (UUID) Library
          • uuid/1
          • uuid/2
          • uuid_property/2
          • is_uuid/1
        • SHA* Secure Hash Algorithms
        • library(md5): MD5 hashes
        • library(hash_stream): Maintain a hash on a stream
        • Memory files
        • library(time): Time and alarm library
        • library(unix): Unix specific operations
        • Limiting process resources
        • library(udp_broadcast): A UDP broadcast proxy
        • library(prolog_stream): A stream with Prolog callbacks

11 library(uuid): Universally Unique Identifier (UUID) Library

See also
- http://www.ossp.org/pkg/lib/uuid/
- https://en.wikipedia.org/wiki/Universally_unique_identifier
To be done
Compare UUIDs, extract time and version from UUIDs

The library provides operations on UUIDs. Please consult other sources for understanding UUIDs and the implications of the different UUID versions. Some typical calls are given below:

?- uuid(X).
X = 'ea6589fa-19dd-11e2-8a49-001d92e1879d'.

?- uuid(X, [url('http://www.swi-prolog.org')]).
X = '73a07870-6a90-3f2e-ae2b-ffa538dc7c2c'.
[det]uuid(-UUID)
UUID is an atom representing a new UUID. This is the same as calling uuid(UUID, []). See uuid/2 for options.
[det]uuid(-UUID, +Options)
Create a new UUID according to Options. The following options are defined:
version(+Versions)
Integer in the range 1..5, which specifies the UUID version that is created. Default is 1.
dns(DNS)
url(URL)
oid(OID)
x500(X500)
Provide additional context information for UUIDs using version 3 or 5. If there is no explicit version option, UUID version 3 is used.
format(+Format)
Representation of the UUID. Default is atom, yielding atoms such as 8304efdd-bd6e-5b7c-a27f-83f3f05c64e0. The alternative is integer, returning a large integer that represents the 128 bits of the UUID.

If SWI-Prolog was not built with the OSSP UUID dependency library a simple Prolog alternative that only implements version 4 random UUIDs is provided. In this case the default version is 4 and the only admissible options are version(4) and format(Format).

uuid_property(+UUID, ?Property)
True when UUID is a property of the given UUID. Supported properties are:
version(V)
Return the version of the UUID (1..5)
time(-Stamp)
Time using SWI-Prolog's time stamp (float with seconds since January 1, 1970, UTC). Only for version 1 and 2 UUIDs
To be done
Implement more properties.
[semidet]is_uuid(@UUID)
True when UUID is a UUID represented as an atom. It merely validates that the length is 36 characters, there are - at the right place and all other characters are hexadecimal.

ClioPatria (version V3.1.1-51-ga0b30a5)