spdx.matching

License matching functionality, primarily provided by org.spdx.utility.compare.LicenseCompareHelper.

differences

(differences text license-or-exception-id)

Returns a map representing the differences found when attempting to match text against the SPDX matching template for license-or-exception-id. Returns nil if text or license-or-exception-id are nil, when license-or-exception-id is invalid (does not refer to a listed SPDX license or license exception), or when no differences were found (note that this last part is unlike the underlying Java library, which returns a non-nil ‘no differences found’ object in this case).

exceptions-within-text

(exceptions-within-text text)(exceptions-within-text text exception-ids)

Returns the set of ids for all exceptions found in text (optionally limited to just the provided set of exception-ids), or nil if none were found.

Note: this function has a substantial performance cost. Callers are encouraged to break their ids into batches and call the 2-arg version with each batch in parallel (e.g. using clojure.core/pmap), then merge the results.

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.

licenses-within-text

(licenses-within-text text)(licenses-within-text text license-ids)

Returns the set of ids for all licenses found in text (optionally limited to just the provided set of license-ids), or nil if none were found.

Note: this function has a substantial performance cost. Callers are encouraged to break their ids into batches and call the 2-arg version with each batch in parallel (e.g. using clojure.core/pmap), then merge the results.

text-contains-exception?

(text-contains-exception? text exception-id)

Does the text contain the exception identified by exception-id somewhere within it?

text-contains-license?

(text-contains-license? text license-id)

Does the text contain the license identified by license-id somewhere within it?

text-is-exception?

(text-is-exception? text exception-id)

Does the entire text match the exception identified by exception-id?

text-is-license?

(text-is-license? text license-id)

Does the entire text match the license identified by license-id?

texts-equivalent-exceptions?

(texts-equivalent-exceptions? text1 text2)

Does text1 and text2 represent an equivalent exception?

texts-equivalent-licenses?

(texts-equivalent-licenses? text1 text2)

Does text1 and text2 represent an equivalent license?