% This LaTeX document was generated using the LaTeX backend of PlDoc, % The SWI-Prolog documentation system \section{library(uuid): Universally Unique Identifier (UUID) Library} \label{sec:uuid} \begin{tags} \mtag{See also}- \url{http://www.ossp.org/pkg/lib/uuid/} \\- \url{https://en.wikipedia.org/wiki/Universally_unique_identifier} \tag{To be done} Compare UUIDs, extract time and version from UUIDs \end{tags} 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: \begin{code} ?- uuid(X). X = 'ea6589fa-19dd-11e2-8a49-001d92e1879d'. ?- uuid(X, [url('http://www.swi-prolog.org')]). X = '73a07870-6a90-3f2e-ae2b-ffa538dc7c2c'. \end{code} \vspace{0.7cm} \begin{description} \predicate[det]{uuid}{1}{-UUID} \arg{UUID} is an atom representing a new \arg{UUID}. This is the same as calling \verb$uuid(UUID, [])$. See \predref{uuid}{2} for options. \predicate[det]{uuid}{2}{-UUID, +Options} Create a new \arg{UUID} according to \arg{Options}. The following options are defined: \begin{description} \termitem{version}{+Versions} Integer in the range 1..5, which specifies the \arg{UUID} version that is created. Default is 1. \termitem{dns}{DNS} \termitem{url}{URL} \termitem{oid}{OID} \termitem{x500}{X500} Provide additional context information for UUIDs using version 3 or 5. If there is no explicit version option, \arg{UUID} version 3 is used. \termitem{format}{+Format} Representation of the \arg{UUID}. Default is \const{atom}, yielding atoms such as \verb$8304efdd-bd6e-5b7c-a27f-83f3f05c64e0$. The alternative is \const{integer}, returning a large integer that represents the 128 bits of the \arg{UUID}. \end{description} If SWI-Prolog was not built with the OSSP \arg{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 \verb$version(4)$ and \verb$format(Format)$. \predicate{uuid_property}{2}{+UUID, ?Property} True when \arg{UUID} is a property of the given \arg{UUID}. Supported properties are: \begin{description} \termitem{version}{V} Return the version of the \arg{UUID} (1..5) \termitem{time}{-Stamp} Time using SWI-Prolog's time stamp (float with seconds since January 1, 1970, UTC). Only for version 1 and 2 UUIDs \end{description} \begin{tags} \tag{To be done} Implement more properties. \end{tags} \end{description}