Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some DASH vocabulary features don't work in PySHACL #144

Open
miroli opened this issue May 19, 2022 · 5 comments
Open

Some DASH vocabulary features don't work in PySHACL #144

miroli opened this issue May 19, 2022 · 5 comments

Comments

@miroli
Copy link

miroli commented May 19, 2022

I realize there's a high probability that I've misunderstood something basic here, but I can't seem to make extensions work. Here's a toy example. I expected this to produce a validation result for the ex:author property since it's not declared in either shape, but the DASH rules aren't applied.

data.ttl

PREFIX ex: <http://example.org#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

ex:ElectronicBook
    rdfs:subClassOf ex:Book .

ex:MyElectronicBook a ex:ElectronicBook ;
    ex:numberOfPages 200 ;
    ex:fileSize 3300 ;
    ex:author ex:JohnSmith .

shape.ttl

PREFIX dash: <http://datashapes.org/dash#>
PREFIX ex: <http://example.org#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>

<http://example.org#>
     owl:imports <http://datashapes.org/dash#> .

ex:BookShape
    a sh:NodeShape ;
    sh:targetClass ex:Book ;
    sh:property [
        sh:path ex:numberOfPages ;
        sh:minCount 1
    ] .

ex:ElectronicBookShape
    a sh:NodeShape ;
    sh:targetClass ex:ElectronicBook ;
    dash:closedByTypes true ;
    sh:property
        [
            sh:minCount 1 ;
            sh:path ex:fileSize ;
        ] .

Command:

$ pyshacl -s shape.ttl -m -i rdfs -a -j -f human data.ttl
@miroli
Copy link
Author

miroli commented May 20, 2022

Oh, so I finally found issue #18 and learned that I had to add a owl:Ontology ; to the importing graph. However, I'm now faced with a new problem. I get this error message when running the same command above with the modified import triple.

Validator feature is not implemented:
SPARQL Constraint text has $shapesGraph in it, but Shapes Graph is not currently supported.
If your use-case requires this feature, open an Issue on the pyshacl github page.

@ashleysommer
Copy link
Collaborator

Hi @miroli
Thanks for your issue report.

PySHACL does not officially support the DASH Extensions. It is not part of the original W3C SHACL Standard Specification. It is published as a draft ontology and is subject to change.

Case in point; many DASH features used to work fine in PySHACL, but recently the addition of ClosedByTypesConstraintComponent, a SPARQLValidator definition that uses $shapesGraph querying, that is not supported by PySHACL.

It is possible that DASH will work with PySHACL again in the future (eg, if PySHACL gets the ability to query the $shapesGraph, or if DASH ontology validators change again).

@ashleysommer ashleysommer changed the title Extension doesn't load Some DASH vocabulary features don't work in PySHACL May 22, 2022
@miroli
Copy link
Author

miroli commented May 23, 2022

Thanks for taking the time to clear that up!

@KeironO
Copy link

KeironO commented Aug 1, 2022

I'm working on implementing DASH and SHACL. I'd be interested in writing an 'extension' of some sort for pySHACL to validate, but I have no idea whether the project can support that?

@ashleysommer
Copy link
Collaborator

ashleysommer commented Aug 8, 2022

Hi @KeironO
Can you please clarify what you are asking?
The DASH SHACL Extensions are already implemented in SHACL, that is how they work.
PySHACL does support some DASH SHACL Extensions, because they are simply custom SHACL Shapes, there is no need to add extra extension code to PySHACL in order to validate the DASH Extensions (aside from the missing feature for ClosedByTypesConstraintComponent as described above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants