package swhid_core

  1. Overview
  2. Docs

This module contains the various types used to represent a Software Heritage persistent identifier (swhid). These identifiers are documented on Software Heritage.

In short, a swhid is made of a mandatory core identifier (a scheme version, a kind and a hash) and an optional list of qualifiers.

module Scheme_version : sig ... end

Module to work with the scheme version of a swhid.

module Kind : sig ... end

Module to work with the different kinds of software artifacts a swhid can points to. They're documented here.

module Hash : sig ... end

Module to work with the hash component of a swhid.

module Core_identifier : sig ... end

Module to work with the core identifier of a swhid. The core identifier of a swhid is made of its scheme version, its kind and its hash. They're documented here.

module Qualifier : sig ... end

Module to work with qualifiers. They are documented here.

type t

The type of swhids.

val of_string : string -> (t, string) Stdlib.result

of_string s is Ok v if s is a valid swhid, otherwise it is Error e.

val mk : Core_identifier.t -> Qualifier.t list -> t

mk c q is the swhid made of the core identifier c and the list of qualifiers q.

val get_core : t -> Core_identifier.t

get_core v is the core identifier of v.

val get_scheme : t -> Scheme_version.t

get_scheme v is the scheme of v.

val get_kind : t -> Kind.t

get_kind v is the kind of v.

val get_hash : t -> Hash.t

get_hash v is the hash of v.

val get_qualifiers : t -> Qualifier.t list

get_qualifiers v is the list of qualifiers of v

val pp : Stdlib.Format.formatter -> t -> unit

pp fmt v prints v on formatter fmt.

val to_string : t -> string

to_string v is the representation of v as a string.