Package org.topbraid.shacl.arq
Class SHACLPaths
java.lang.Object
org.topbraid.shacl.arq.SHACLPaths
Utilties to manage the conversion between SHACL paths and SPARQL 1.1 property paths.
- Author:
- Holger Knublauch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddValueNodes(org.apache.jena.rdf.model.RDFNode focusNode, org.apache.jena.rdf.model.Property predicate, Collection<org.apache.jena.rdf.model.RDFNode> results) static voidaddValueNodes(org.apache.jena.rdf.model.RDFNode focusNode, org.apache.jena.sparql.path.Path path, Collection<org.apache.jena.rdf.model.RDFNode> results) static voidappendPath(StringBuffer sb, org.apache.jena.rdf.model.Resource path) Renders a given path into a given StringBuffer, using the prefixes supplied by the Path's Model.static org.apache.jena.rdf.model.ResourceclonePath(org.apache.jena.rdf.model.Resource path, org.apache.jena.rdf.model.Model targetModel) static org.apache.jena.rdf.model.ResourcecreatePath(org.apache.jena.sparql.path.Path path, org.apache.jena.rdf.model.Model model) Creates SHACL RDF triples for a given Jena Path (which may have been created using getJenaPath).static ObjectgetJenaPath(String string, org.apache.jena.rdf.model.Model model) Attempts to parse a given string into a Jena Path.static ObjectgetJenaPath(org.apache.jena.rdf.model.Resource path) static org.apache.jena.sparql.path.PathgetPath(org.apache.jena.rdf.model.Resource shaclPath) static StringgetPathString(org.apache.jena.rdf.model.Resource path)
-
Constructor Details
-
SHACLPaths
public SHACLPaths()
-
-
Method Details
-
addValueNodes
public static void addValueNodes(org.apache.jena.rdf.model.RDFNode focusNode, org.apache.jena.sparql.path.Path path, Collection<org.apache.jena.rdf.model.RDFNode> results) -
addValueNodes
public static void addValueNodes(org.apache.jena.rdf.model.RDFNode focusNode, org.apache.jena.rdf.model.Property predicate, Collection<org.apache.jena.rdf.model.RDFNode> results) -
appendPath
Renders a given path into a given StringBuffer, using the prefixes supplied by the Path's Model.- Parameters:
sb- the StringBuffer to write intopath- the path resource
-
clonePath
public static org.apache.jena.rdf.model.Resource clonePath(org.apache.jena.rdf.model.Resource path, org.apache.jena.rdf.model.Model targetModel) -
createPath
public static org.apache.jena.rdf.model.Resource createPath(org.apache.jena.sparql.path.Path path, org.apache.jena.rdf.model.Model model) Creates SHACL RDF triples for a given Jena Path (which may have been created using getJenaPath).- Parameters:
path- the Jena Pathmodel- the Model to create the triples in- Returns:
- the (root) Resource of the SHACL path
-
getJenaPath
public static Object getJenaPath(org.apache.jena.rdf.model.Resource path) throws org.apache.jena.query.QueryParseException - Throws:
org.apache.jena.query.QueryParseException
-
getJenaPath
public static Object getJenaPath(String string, org.apache.jena.rdf.model.Model model) throws org.apache.jena.query.QueryParseException Attempts to parse a given string into a Jena Path. Throws an Exception if the string cannot be parsed.- Parameters:
string- the string to parsemodel- the Model to operate on (for prefixes)- Returns:
- a Path or a Resource if this is a URI
- Throws:
org.apache.jena.query.QueryParseException
-
getPath
public static org.apache.jena.sparql.path.Path getPath(org.apache.jena.rdf.model.Resource shaclPath) -
getPathString
-