Coverage for oc_ocdm / _types.py: 100%

24 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-07-06 20:05 +0000

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

2# 

3# SPDX-License-Identifier: ISC 

4 

5from __future__ import annotations 

6 

7from typing import TypeAlias, TypedDict 

8 

9from rdflib import Literal, URIRef 

10from rdflib.term import Node 

11from triplelite import Triple 

12 

13JsonScalar: TypeAlias = str | int | float | bool | None 

14JsonValue: TypeAlias = JsonScalar | list["JsonValue"] | dict[str, "JsonValue"] 

15JsonObject: TypeAlias = dict[str, JsonValue] 

16JsonLdDocument: TypeAlias = list[JsonObject] 

17ContextMap: TypeAlias = dict[str, str | JsonObject] 

18RdfLibObject: TypeAlias = URIRef | Literal 

19RdfLibTriple: TypeAlias = tuple[Node, Node, Node] 

20RdfLibQuad: TypeAlias = tuple[URIRef, URIRef, RdfLibObject, URIRef | None] 

21SparqlBinding: TypeAlias = dict[str, str] 

22SparqlResultRow: TypeAlias = dict[str, SparqlBinding] 

23SparqlResultRows: TypeAlias = list[SparqlResultRow] 

24TripleSet: TypeAlias = set[Triple] 

25FrozenTripleSet: TypeAlias = frozenset[Triple] 

26 

27 

28class SparqlResults(TypedDict): 

29 bindings: SparqlResultRows 

30 

31 

32class SparqlAskResult(TypedDict): 

33 boolean: bool 

34 

35 

36class SparqlQueryResult(TypedDict): 

37 results: SparqlResults