Open egonw opened 6 years ago
For the current version (1.0) just use the code for RDF4J and replace the class fr.inria.lille.shexjava.graph.RDF4JGraph by fr.inria.lille.shexjava.graph.JenaGraph. It should work.
A new release should happen in 2-3 week and instead of using RDF4J, it will be using CommonsRDF. The advice of using RDF4J will be remove at this moment. It will come with a fair deal of change in the API. I will advice for either wait for the release or use the code you find in the dev branch.
I have just released on maven the version 1.1a with better support for jena.
@egonw I've used the current version of this lib with Jena without much trouble. e.g.
public static Typing validateShex(ShexSchema schema, Model jena_model, String focus_node_iri, String shape_id) throws Exception {
Typing result = null;
RDF rdfFactory = new SimpleRDF();
JenaRDF jr = new JenaRDF();
//this shex implementation likes to use the commons JenaRDF interface, nothing exciting here
JenaGraph shexy_graph = jr.asGraph(jena_model);
if(focus_node_iri!=null) {
Label shape_label = new Label(rdfFactory.createIRI(shape_id));
RDFTerm focus_node = rdfFactory.createIRI(focus_node_iri);
//recursive only checks the focus node against the chosen shape.
RecursiveValidation shex_recursive_validator = new RecursiveValidation(schema, shexy_graph);
shex_recursive_validator.validate(focus_node, shape_label);
result = shex_recursive_validator.getTyping();
}else {
RefineValidation shex_refine_validator = new RefineValidation(schema, shexy_graph);
//refine checks all nodes in the graph against all shapes in schema
shex_refine_validator.validate();
result = shex_refine_validator.getTyping();
}
return result;
}
I know you prefer and recommend the other toolkit, but a pointer to a Jena example would make me happy.