Coverage for heritrace / utils / virtuoso_utils.py: 90%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-07-02 10:16 +0000

1# SPDX-FileCopyrightText: 2024-2025 Arcangelo Massari <arcangelo.massari@unibo.it> 

2# 

3# SPDX-License-Identifier: ISC 

4 

5from __future__ import annotations 

6 

7from typing import TYPE_CHECKING 

8 

9from flask import current_app 

10 

11if TYPE_CHECKING: 

12 from flask import Flask 

13 

14 

15VIRTUOSO_EXCLUDED_GRAPHS = [ 

16 "http://localhost:8890/DAV/", 

17 "http://www.openlinksw.com/schemas/virtrdf#", 

18 "http://www.w3.org/2002/07/owl#", 

19 "http://www.w3.org/ns/ldp#", 

20 "urn:activitystreams-owl:map", 

21 "urn:core:services:sparql", 

22] 

23 

24 

25def is_virtuoso(app: Flask | None = None) -> bool: 

26 """ 

27 Check if the triplestore is Virtuoso. 

28 

29 Args: 

30 app: Flask application object (optional) 

31 

32 Returns: 

33 bool: True if triplestore is Virtuoso, False otherwise 

34 """ 

35 if app is None: 

36 app = current_app 

37 return app.config["DATASET_DB_TRIPLESTORE"].lower() == "virtuoso"