Closed mucaho closed 3 years ago
Thank you, this seems to be a bug in the API. It works correctly when I change RulesEntailment as follows
Dataset newDataset = new DatasetWithDifferentDefaultModel(unionDataModel, dataset);
RuleEngine engine = new RuleEngine(newDataset, shapesGraphURI, shapesGraph, inferencesModel);
which means that the engine will actually see the previous inferences (from your first rule) when it executes the second rule.
I am changing this in our internal code base and the change will go live the next time I synch our code base with the open source repo. I am long overdue doing so, but I cannot promise when yet (I just returned from 3 weeks of vacation and have plenty of things to catch up on).
Could you meanwhile apply the change above in your local copy to confirm the suggested fix?
Thank you!
Putting the above example in a test.ttl
file, adapting the ValidationExample
test file to use the new example file, as well as adding the proposed changes into the RuleEntailment
class does indeed fix the issue for me:
java [...] org.topbraid.shacl.ValidationExample
@base <http://example.org/random> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix ex: <http://example.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@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 swa: <http://topbraid.org/swa#> .
@prefix tosh: <http://topbraid.org/tosh#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
[ rdf:type sh:ValidationReport ;
sh:conforms true
] .
Process finished with exit code 0
On current master efc9fcc8bf2047d2e6172301fd42a280629e725f
Thanks for the confirmation. I have now applied the same fix to the public repo. I believe this closes the ticket. Let me know otherwise.
For the following minimum reproducible example:
One would expect all rounds of SHACL rules to be executed prior to the run of SHACL validation, as described in the SHACL-AF W3C technical report on the sh:Rules Entailment Regime.
However, running
$ ./shaclvalidate.sh -datafile data_shapes_file.ttl
produces the following, (imo) erroneous validation report:For reference, the triples do get correctly inferred by
$ ./shaclinfer.sh -datafile data_shapes_file.ttl
:I am running the latest SHACL API v1.3.2 on x64 linux.