Coverage for heritrace/utils/uri_utils.py: 100%

6 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-18 11:10 +0000

1from flask import current_app 

2from rdflib import URIRef 

3 

4 

5def generate_unique_uri(entity_type: URIRef | str = None) -> URIRef: 

6 """ 

7 Generate a unique URI for a given entity type using the application's URI generator. 

8 The counter increment is handled internally by the URI generator. 

9  

10 Args: 

11 entity_type: The type of entity to generate a URI for 

12  

13 Returns: 

14 URIRef: The generated unique URI 

15 """ 

16 entity_type = str(entity_type) 

17 uri = current_app.config["URI_GENERATOR"].generate_uri(entity_type) 

18 return URIRef(uri)