Coverage for lode / __init__.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-11-22 15:54 +0000

1"""LODE: Live OWL Documentation Environment, maintained by OpenCitations. 

2 

3Typical use as a library: 

4 

5 import lode 

6 from lode import SkosVocabulary 

7 from lode.models import Concept 

8 

9 vocabulary = SkosVocabulary("vocabulary.ttl") 

10 for concept in vocabulary.get_entities(Concept): 

11 print(concept.get_has_identifier()) 

12 

13 lode.build_site(vocabulary, "site") 

14 

15The classes of the formats (OwlOntology, SkosVocabulary and those of installed plugins) are 

16found on first use, so importing `lode` does not import rdflib or the readers. 

17""" 

18from lode.core import build_site, read 

19 

20__all__ = ["read", "build_site", "OwlOntology", "SkosVocabulary"] 

21 

22 

23def __getattr__(name: str): 

24 """Return the Artefact class called `name`, found in the profile registry (PEP 562). 

25 

26 Lets `from lode import OwlOntology` work without the package root importing any profile. 

27 Private and dunder names are refused at once: tools probe them (`__path__`, `__wrapped__`) 

28 and must not trigger the import of every format. 

29 """ 

30 if not name.startswith("_"): 

31 from lode.profiles import artefact_class_named 

32 

33 cls = artefact_class_named(name) 

34 if cls is not None: 

35 return cls 

36 raise AttributeError(f"module 'lode' has no attribute {name!r}")