Skip to content

Add support for sh:inversePath in SHACL coverage graphic #145

@dylan-sa

Description

@dylan-sa

When using onto_tool graphic to generate SHACL coverage diagrams, constraints using sh:inversePath are not highlighted in green to indicate coverage. We could tweak the shacl_query in ontograph.py to something like the following:

prefix sh: <http://www.w3.org/ns/shacl#>

select distinct ?class ?property where {
    {
        ?shape sh:targetClass ?class .

        { ?shape sh:property/sh:path ?property . }
        UNION
        { ?shape (sh:and|sh:or|sh:xone|sh:not|rdf:first|rdf:rest)+/sh:path ?property }

    }
    UNION
    # Additional possibility to handle constraints using sh:inversePath along with an sh:class assertion
    {

        ?shape sh:property/sh:class ?class .
        ?shape sh:property/sh:path/sh:inversePath ?property

    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions