Closed fp-smartlogic closed 9 months ago
After upgrading to the more recent SHACL version, I've noticed a behavior change in SHACLPaths::getJenaPath method. I am attaching the simple code snippet to illustrate the issue.
import java.io.IOException; import org.apache.commons.io.IOUtils; import org.apache.jena.rdf.model.Model; import org.apache.jena.rdf.model.ModelFactory; import org.apache.jena.rdf.model.Resource; import org.topbraid.shacl.arq.SHACLPaths; import org.topbraid.shacl.vocabulary.SH; public class SHACLPathsExample { public static void main(String[] args) throws IOException { String modelStr = "" + "@prefix sh: <http://www.w3.org/ns/shacl#> ." + "@prefix skos: <http://www.w3.org/2004/02/skos/core#> ." + "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ." + "" + "[] sh:resultPath [" + " sh:alternativePath [" + " rdf:first skos:note;" + " rdf:rest [" + " rdf:first skos:editorialNote;" + " rdf:rest [" + " rdf:first skos:historyNote;" + " rdf:rest rdf:nil" + " ]" + " ]" + " ]" + "]"; Model model = ModelFactory.createDefaultModel().read(IOUtils.toInputStream(modelStr, "UTF-8"), null, "TTL"); Resource resultPath = model.getRequiredProperty(null, SH.resultPath).getObject().asResource(); // returns: (skos:note | skos:editorialNote | skos:historyNote) System.out.println(SHACLPaths.getPathString(resultPath)); // returns: // <http://www.w3.org/2004/02/skos/core#note>|(<http://www.w3.org/2004/02/skos/core#editorialNote>/<http://www.w3.org/2004/02/skos/core#historyNote>) System.out.println(SHACLPaths.getJenaPath(resultPath)); } }
Thank you, this was indeed wrong and must have been wrong for a few years. I hope the fix addresses this issue.
After upgrading to the more recent SHACL version, I've noticed a behavior change in SHACLPaths::getJenaPath method. I am attaching the simple code snippet to illustrate the issue.