Class SHACLPaths


  • public class SHACLPaths
    extends Object
    Utilties to manage the conversion between SHACL paths and SPARQL 1.1 property paths.
    Author:
    Holger Knublauch
    • Constructor Summary

      Constructors 
      Constructor Description
      SHACLPaths()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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)  
      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)  
      static void appendPath​(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.Resource clonePath​(org.apache.jena.rdf.model.Resource path, org.apache.jena.rdf.model.Model targetModel)  
      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).
      static Object getJenaPath​(String string, org.apache.jena.rdf.model.Model model)
      Attempts to parse a given string into a Jena Path.
      static Object getJenaPath​(org.apache.jena.rdf.model.Resource path)  
      static org.apache.jena.sparql.path.Path getPath​(org.apache.jena.rdf.model.Resource shaclPath)  
      static String getPathString​(org.apache.jena.rdf.model.Resource path)  
    • Constructor Detail

      • SHACLPaths

        public SHACLPaths()
    • Method Detail

      • 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

        public static void appendPath​(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.
        Parameters:
        sb - the StringBuffer to write into
        path - 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 Path
        model - 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 parse
        model - 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

        public static String getPathString​(org.apache.jena.rdf.model.Resource path)