RDFLib / pySHACL

A Python validator for SHACL
Apache License 2.0
241 stars 63 forks source link

SHACL Compact syntax #115

Open mielvds opened 2 years ago

mielvds commented 2 years ago

Hi all!

Any existing plans to support SHACL Compact syntax? I see there is an ANTLR grammar, but not sure how well that ports to Python.

ashleysommer commented 2 years ago

Hi @mielvds I've looked at the possibility of adding SHACL compact syntax in the past, but its very low on the priority list.

Compact syntax is still a draft spec, and may not ever become official spec. I don't know of any other SHACL implementation that currently implements it besides TopBraid.

You are the first person to ask for this feature in PySHACL in the more than 3 years the project has existed, so from my point of view its not something many users are needing.

Having said that, I will ask around on the SHACL Discord Group to get a gauge of how others use SHACL Compact Syntax in the broader SHACL community.

mielvds commented 2 years ago

Hi @mielvds I've looked at the possibility of adding SHACL compact syntax in the past, but its very low on the priority list.

Hi @ashleysommer Thanks for responding

Compact syntax is still a draft spec, and may not ever become official spec. I don't know of any other SHACL implementation that currently implements it besides TopBraid.

Apache Jena does, but I also don't think it will ever be official (nor should it be; it is meant to transpile to SHACL)

You are the first person to ask for this feature in PySHACL in the more than 3 years the project has existed, so from my point of view its not something many users are needing.

A too bad. I find SHACL a lot of work to write manually, but it's probably not painful enough to make this worth the effort. But if the effort would be ok...I'd support it. An an alternative would pyshacl allowing stdin so I can pipe from Jena (but probably then I would simply not use pyshacl).

Having said that, I will ask around on the SHACL Discord Group to get a gauge of how others use SHACL Compact Syntax in the broader SHACL community.

Thanks! I'm in the hroup as well, will follow up.

ashleysommer commented 2 years ago

@mielvds I've just released a new version of PySHACL (v0.18.1) that supports reading from stdin for the SHACL shape file. Let me know if that works for your use-case with Jena.

use it on the command line like:

#> jena-covert-tool myshapes.shc | pyshacl -s /dev/stdin -i rdfs mydata.ttl

or by convention, you can use "-" in place of /dev/stdin

#> jena-covert-tool myshapes.shc | pyshacl -s - -i rdfs mydata.ttl
edmondchuc commented 6 months ago

If there's interest, we can integrate the python shaclc parser and serializer into PySHACL.

Repo: https://github.com/edmondchuc/shaclc