-
Notifications
You must be signed in to change notification settings - Fork 95
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
SHACL processor #236
SHACL processor #236
Conversation
Adds bespoke test suite. Wrapper node implements all nodes.
It now returns a focus node from the data graph instead of the shapes graph.
It now instances of subclasses as well. It now returns focus nodes from the data graph instead of the shapes graph.
Removes unnecessary result messages from validation report.
Also proper failure assertions in test suite. Also recursively binds focus node in sparql constraints BGPs.
@kal, @tpluscode: Before I submit this for your review, there are several issues I'd appreciate assistance with.
|
Some styling. Hides wrapper constructors from debugger.
Adds test for wrapper node specialisations.
@langsamu - I think that the best course of action with the datatypes issue would be to exclude those tests from testing the .NETStandard 1.4 build and we should document that datatype constraint checking is not supported on that platform. You can use a file with the extension .NetCore.cs to add code that is only compiled under .NETStandard 1.4 (or use the preprocessor flag NETCORE) |
Adds conformance only example.
@kal, ready for review with thanks. |
This is awesome work, thanks @langsamu and apologies for taking so long to merge the PR! |
Overview
This is an implementation of a fully compliant SHACL Core and SHACL-SPARQL processor.
Both data to be validated and validation rules reside in
IGraph
s.I've created a web application that exposes the processor (OpenAPI).
Compliance
The processor is successfully tested against the SHACL Test Suite.
Compliance caveats
sh:datatype
The datatype constraint component relies on
System.Xml.Schema
for illformedness testing of literal nodes. Since this is not available for .NET Core 1.1, the feature is not supported for that target.The following tests are excluded from NETCORE:
dotnetrdf/Testing/unittest/Shacl/TestSuiteData.NetCore.cs
Lines 37 to 43 in aca4668
<a:b>
Two tests (core/node/maxLength-001 and core/node/minLength-001) include the URI node
<a:b>
, which is illegal in .NET and therefore also in dotNetRDF.GraphMatcher
Two tests (core/path/path-complex-002 and core/property/nodeKind-001) produce validation reports with a topology such that assessing their equality resorts to brute force matching and is thus not feasible in a unit test.
Implementation report
ImplementationReport.Generate
creates an EARL implementation report in the format required by the SHACL Test Suite and Implementation Report.Cases that fail automated testing (as per the caveats above) have been tested manually and are reported as such.
The latest report is available alongside the console application that generates it.
I'll submit the implementation report if this PR is merged and released.
Usage
Conformance checking usage
ShapesGraph
with an existingIGraph
containing a shapes graph.Conforms
with an existingIGraph
containing a data graph.bool
representing whether the data graph conforms to the shapes graph.dotnetrdf/Testing/unittest/Shacl/Examples.cs
Lines 82 to 107 in aca4668
Validation usage
ShapesGraph
with an existingIGraph
containing a shapes graph.Validate
with an existingIGraph
containing a data graph.Report
representing the validation report.dotnetrdf/Testing/unittest/Shacl/Examples.cs
Lines 33 to 80 in aca4668
API
The rest of the code is internal. It is an extensive implementation of the SHACL information model and validation logic. It could be made public in the future with additional guards and tests to facilitate programmatic construction and inspection of SHACL shapes graphs.