SPDXv2 has SpdxListedLicense::getId (or SpdxListedLicense::getLicenseId), but there is no equivalent for ListedLicense in SPDXv3. Actually, ListedLicense::toString returns exactly the id, I think, but it's not good to rely on toString for something like that.