Class PathUtils

java.lang.Object
org.aksw.jenax.arq.util.node.PathUtils

public class PathUtils extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.apache.jena.sparql.path.Path
    A pre-built path for the expression rdf:type/rdfs:subclassOf*.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.sparql.path.P_Path0
    asStep(org.apache.jena.sparql.path.Path path)
    Return null unless path can be casted to P_Path0
    static boolean
    canFlatten(org.apache.jena.sparql.core.PathBlock pathBlock)
    Returns true iff all paths in the path block are instances of P_Path0, i.e.
    static org.apache.jena.sparql.path.Path
    create(org.apache.jena.sparql.path.Path path, boolean isFwd)
     
    static org.apache.jena.sparql.path.P_Path0
    createStep(String predicate, boolean isFwd)
     
    static org.apache.jena.sparql.path.P_Path0
    createStep(org.apache.jena.graph.Node predicate, boolean isFwd)
     
    static org.apache.jena.sparql.core.BasicPattern
    flatten(org.apache.jena.sparql.core.PathBlock pathBlock)
    Flatten the path block w.r.t.
    static org.apache.jena.sparql.core.BasicPattern
    flattenOrNull(org.apache.jena.sparql.core.TriplePath triplePath)
    Flatten the given triple path into a basic pattern if possible.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • typeSubclassOf

      public static final org.apache.jena.sparql.path.Path typeSubclassOf
      A pre-built path for the expression rdf:type/rdfs:subclassOf*.
  • Constructor Details

    • PathUtils

      public PathUtils()
  • Method Details

    • createStep

      public static org.apache.jena.sparql.path.P_Path0 createStep(String predicate, boolean isFwd)
    • createStep

      public static org.apache.jena.sparql.path.P_Path0 createStep(org.apache.jena.graph.Node predicate, boolean isFwd)
    • create

      public static org.apache.jena.sparql.path.Path create(org.apache.jena.sparql.path.Path path, boolean isFwd)
    • asStep

      public static org.apache.jena.sparql.path.P_Path0 asStep(org.apache.jena.sparql.path.Path path)
      Return null unless path can be casted to P_Path0
    • flattenOrNull

      public static org.apache.jena.sparql.core.BasicPattern flattenOrNull(org.apache.jena.sparql.core.TriplePath triplePath)
      Flatten the given triple path into a basic pattern if possible. Returns null if the path cannot be flattened.
    • canFlatten

      public static boolean canFlatten(org.apache.jena.sparql.core.PathBlock pathBlock)
      Returns true iff all paths in the path block are instances of P_Path0, i.e. merely forward or reverse links.
    • flatten

      public static org.apache.jena.sparql.core.BasicPattern flatten(org.apache.jena.sparql.core.PathBlock pathBlock)
      Flatten the path block w.r.t. canFlatten(PathBlock). Raises a RuntimeException on failure.

      The caller will most likely wish to rename the variables, such as using:

       NodeTransformLib.transform(ReverseRenameUtils::effectiveNode, bgp);
       
      Parameters:
      pathBlock -
      Returns: