spdx.identifiers
Identifier related functionality. This is mostly a convenience namespace that delegates to spdx.licenses or spdx.exceptions as needed, based on the ‘type’ of an identifier. This functionality is bespoke (it does not use any logic from Spdx-Java-Library
).
canonicalise-id
(canonicalise-id id)
Canonicalises id
(an SPDX identifier), by returning it in its canonical case. Returns nil
if id
is nil
or not a listed SPDX identifier.
Notes:
- This function does not canonicalise a deprecated identifier to its non-deprecated equivalent(s), since some of those conversions result in an SPDX expression rather than an individual identifier. spdx.expressions/canonicalise can be used for that.
deprecated-id?
(deprecated-id? id)
Is id
(a String
) deprecated? Also returns false
if id
is not an SPDX listed identifier (including for LicenseRefs and AdditionRefs).
See this SPDX FAQ item for details on what this means.
equivalent?
(equivalent? s1 s2)
Are s1
and s2
(String
s) equivalent SPDX identifiers, LicenseRefs or AdditionRefs (i.e. taking the SPDX case sensitivity rules in SPDX Annex B into account)?
Notes:
- Returns
false
ifs1
ors2
are not listed SPDX identifiers or valid LicenseRefs or AdditionRefs
id->info
(id->info id)
(id->info id {:keys [include-large-text-values?], :or {include-large-text-values? false}, :as opts})
Returns SPDX list information for id
as a map, or nil
if id
is not a valid SPDX identifier. Includes a :type
element that identifies whether the id is an SPDX license identifier or an SPDX exception identifier, as per id-type.
opts
are:
:include-large-text-values?
(defaultfalse
) - controls wheter large text values are included in the result or not
id-type
(id-type id)
The ‘type’ of id
; one of these values:
:license-id
- listed SPDX license identifier:exception-id
- listed SPDX exception identifier:license-ref
- LicenseRef:addition-ref
- AdditionRefnil
-id
is not a listed SPDX identifier, LicenseRef or AdditionRef
init!
(init!)
Initialises this namespace upon first call (and does nothing on subsequent calls), returning nil
. Consumers of this namespace are not required to call this fn, as initialisation will occur implicitly anyway; it is provided to allow explicit control of the cost of initialisation to callers who need it.
Note: this function may have a substantial performance cost.
listed-id?
(listed-id? id)
Is id
(a String
) one of the listed SPDX identifiers?
Notes:
- This fn supports any case of identifier, as per the SPDX case sensitivity rules in SPDX Annex B
non-deprecated-ids
(non-deprecated-ids)
(non-deprecated-ids ids)
Returns the set of SPDX identifiers that identify current (non-deprecated) licenses within the provided set of SPDX identifiers (or all of them, if ids
is not provided).
version
(version)
The version of the license list (a String
in major.minor(.patchlevel) format).