Skip to content

Allow safe checking of entity presence - #24

Open
OliverWoolland wants to merge 3 commits into
array-contextfrom
entity-return-safe
Open

OliverWoolland wants to merge 3 commits into
array-contextfrom
entity-return-safe

Conversation

@OliverWoolland

@OliverWoolland OliverWoolland commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

So you don't have to try getEntity to check if an entity already exists - introduce a method which returns a bool specifying if the entity is findable

closes #17


This pull request adds a new utility method to the ROCrate class for checking if an entity exists by its ID, and includes corresponding unit tests to ensure correct behavior. The main changes are grouped into API enhancements and testing improvements:

API Enhancements:

  • Added a hasEntity(const std::string& id) method to the ROCrate class, which allows callers to check if an entity with a given ID exists in the crate.
  • Implemented the hasEntity method to perform a lookup in the internal entity registry.

Testing Improvements:

  • Added a unit test to verify that hasEntity returns true for existing entities and false for non-existent ones.

@OliverWoolland
OliverWoolland added this pull request to stack #25 November 23, 2026 12:49
@OliverWoolland

Copy link
Copy Markdown
Contributor Author

closes #17

@OliverWoolland OliverWoolland self-assigned this Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GetEntity should probably return null rather than throw

1 participant