How to use the brickschema.brickschema.namespaces.RDF function in brickschema

To help you get started, we’ve selected a few brickschema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrickSchema / Brick / brickschema / brickschema / graph.py View on Github external
def __init__(self, load_brick=False):
        """
        Wrapper class and convenience methods for handling Brick models
        and graphs.

        Keyword Args:
            load_brick (bool): if True, loads Brick ontology into graph

        Returns:
            graph (Graph): Graph object
        """
        self.g = rdflib.Graph()
        self.g.bind('rdf', ns.RDF)
        self.g.bind('owl', ns.OWL)
        self.g.bind('rdfs', ns.RDFS)
        self.g.bind('skos', ns.SKOS)
        self.g.bind('brick', ns.BRICK)
        self.g.bind('tag', ns.TAG)

        if load_brick:
            # get ontology data from package
            data = pkgutil.get_data(__name__, "ontologies/Brick.ttl").decode()
            # wrap in StringIO to make it file-like
            self.g.parse(source=io.StringIO(data), format='turtle')