Skip to content

Instantly share code, notes, and snippets.

@gtfierro
Created July 9, 2021 21:12
Show Gist options
  • Save gtfierro/096ccdec0594e3dd976a016f98a71c80 to your computer and use it in GitHub Desktop.
Save gtfierro/096ccdec0594e3dd976a016f98a71c80 to your computer and use it in GitHub Desktop.
import brickschema
from brickschema.namespaces import BRICK, RDFS
from rdflib import URIRef
g = brickschema.Graph(load_brick_nightly=True)
def get_superclass(cls):
return [x for x in g.objects(cls, RDFS.subClassOf) if isinstance(x, URIRef)]
assert get_superclass(BRICK.Air_Temperature_Sensor) == [BRICK.Temperature_Sensor]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment