rdf-canonize/rdf_canonize/types.py

26 lines
595 B
Python

from dataclasses import dataclass, field
from typing import TypedDict
from rdflib import Dataset, BNode
from rdflib.graph import _QuadType as QuadType
class Hash(str):
"""Abstract representation for some hash digest"""
class BNodeID(str):
"""Blank node identifier local to the algo implementation"""
class CanonicalID(str):
"""Canonical ID given to a BNode"""
BNodeIDMapType = dict[BNodeID, BNode]
CanonicalIDMapType = dict[BNodeID, CanonicalID]
@dataclass
class CanonicalizedDataset:
init: Dataset
bnodeid_map: BNodeIDMapType
canonicalid_map: CanoncalIDMapType