How to use the pyshacl.validate function in pyshacl

To help you get started, we’ve selected a few pyshacl 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 SwissDataScienceCenter / renku-python / renku / core / utils / shacl.py View on Github external
def validate_graph(graph, shacl_path=None, format='nquads'):
    """Validate the current graph with a SHACL schema.

    Uses default schema if not supplied.
    """
    if shacl_path:
        with open(shacl_path, 'r', encoding='utf-8') as f:
            shacl = f.read()
    else:
        shacl = resource_string('renku', 'data/shacl_shape.json')

    return validate(
        graph,
        shacl_graph=shacl,
        inference='rdfs',
        meta_shacl=True,
        debug=False,
        data_graph_format=format,
        shacl_graph_format='json-ld',
        advanced=True
    )

pyshacl

Python SHACL Validator

Apache-2.0
Latest version published 11 days ago

Package Health Score

81 / 100
Full package analysis

Popular pyshacl functions

Similar packages