view src/light9/namespaces.py @ 2376:4556eebe5d73

topdir reorgs; let pdm have its src/ dir; separate vite area from light9/
author drewp@bigasterisk.com
date Sun, 12 May 2024 19:02:10 -0700
parents light9/namespaces.py@63aad60fb070
children
line wrap: on
line source

from rdflib import URIRef, Namespace, RDF, RDFS  # noqa
from typing import Dict


# Namespace was showing up in profiles
class FastNs:

    def __init__(self, base):
        self.ns = Namespace(base)
        self.cache: Dict[str, URIRef] = {}

    def __getitem__(self, term) -> URIRef:
        if term not in self.cache:
            self.cache[term] = self.ns[term]
        return self.cache[term]

    __getattr__ = __getitem__


L9 = FastNs("http://light9.bigasterisk.com/")
FUNC = FastNs("http://light9.bigasterisk.com/effectFunction/")
MUS = Namespace("http://light9.bigasterisk.com/music/")
XSD = Namespace("http://www.w3.org/2001/XMLSchema#")
DCTERMS = Namespace("http://purl.org/dc/terms/")
DEV = Namespace("http://light9.bigasterisk.com/device/")