Skip to content

Commit

Permalink
Allow the IAutoIDGenerator to be null.
Browse files Browse the repository at this point in the history
Amend the AutoIDAllocator class to allow it to be used with a null
IAutoIDGenerator -- in which cases it obviously never allocates any ID.

This makes it easier to ensure that we can never let IDs in the auto-ID
namespace (https://w3id.org/kgcl/autoid/) pass into the target ontology
without being re-assigned, in the event we cannot obtain a suitable ID
generator -- all we have to do is check the return value of the
reallocate() method, which will return false if we have not been able to
reassign any ID.
  • Loading branch information
gouttegd committed Mar 24, 2024
1 parent 09f12b1 commit 31009b9
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ private boolean isAuto(String id) {
private String getAutoID(String id) {
String autoID = idMap.get(id);
if ( autoID == null ) {
autoID = idGenerator.nextID();
if ( idGenerator != null ) {
autoID = idGenerator.nextID();
}
if ( autoID == null ) {
unallocatedIDs.add(id);
autoID = id;
Expand Down

0 comments on commit 31009b9

Please sign in to comment.