I have looked at and run the ValidationExample from the github archive and
have looked carefully at the SHACL archive ModelConstraintValidator. These
are very helpful and I encourage anyone playing with SHACL to look at them.
This said, I have run into a bit of a problem trying to extend the example.
Here is a code fragment from a modified version of the Validation Example
in the archive:
// Load the main data model
Model dataModel = JenaUtil.createMemoryModel();
dataModel.read(EDDLValidation.class.getResourceAsStream("/sh/project/vocab/Data.ttl"),
"urn:dummy", FileUtils.langTurtle);
Model schemaModel = JenaUtil.createMemoryModel();
schemaModel.read(ValidationExample.class.getResourceAsStream("/sh/project/schema/Schema.ttl"),
"urn:dummy", FileUtils.langTurtle);
// Load the shapes Model (here, includes the dataModel because that has
shape definitions too)
Model shaclModel = SHACLSystemModel.getSHACLModel();
MultiUnion unionGraph = new MultiUnion(new Graph[] {
shaclModel.getGraph(),
schemaModel.getGraph()
});
Model shapesModel = ModelFactory.createModelForGraph(unionGraph);
// Make sure all sh:Functions are registered
SHACLFunctions.registerFunctions(shapesModel);
// Create Dataset that contains both the main query model and the shapes
model
// (here, using a temporary URI for the shapes graph)
URI shapesGraphURI = URI.create("uri_path_to_schema_graph");
Dataset dataset = ARQFactory.get().getDataset(dataModel);
dataset.addNamedModel(shapesGraphURI.toString(), shapesModel);
So the questions here are as follows:
(1) does the schemaModel graph need to be a combined graph that includes
any imports (such as separate SPIN graphs) within it or is it ok to be just
the graph that has SHACL validation functions defined within it? I suspect
that it must include the SPIN graph, and would that be done with a jena
export from TBC of the related graphs?
(2) in the ValidationExample a MultiUnion graph was used because there were
some SHACL definitions in the dataset. This would generally not be the case
so this extra layer wouldn't be necessary, right?
(3) In my current case I am getting a result: @base <
http://example.org/random> .
Is this the kind of result to expect if there are no constraint violations
or have I done something wrong in the code fragment?
Thanks to anyone for any pointers.
Jack Hodges
--
You received this message because you are subscribed to the Google Group
"TopBraid Suite Users", the topics of which include the TopBraid Suite family
of products and its base technologies such as SPARQLMotion, SPARQL Web Pages
and SPIN.
To post to this group, send email to [email protected]
---
You received this message because you are subscribed to the Google Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.