Class ResourceTreeUtils

java.lang.Object
org.aksw.jena_sparql_api.conjure.algebra.common.ResourceTreeUtils

public class ResourceTreeUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    clearSubTree(org.apache.jena.rdf.model.Resource root)
    Recursively delete all properties of all resources reachable from the root resource (inclusive) in outgoing direction.
    static <T extends org.apache.jena.rdf.model.Resource>
    void
    clearSubTree(T rootOp, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
     
    static com.google.common.hash.HashCode
    createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode)
     
    static com.google.common.hash.HashCode
    createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris)
    Create a hash for a resource based on transitively following its outgoing properties For each of a reosurce's statement, first a hash for its object is recursively computed.
    static com.google.common.hash.HashCode
    createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris, BiPredicate<? super org.apache.jena.rdf.model.RDFNode,? super Integer> filterKeep, int depth, Set<org.apache.jena.rdf.model.RDFNode> seen, com.google.common.hash.HashFunction hashFn, Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode> priorHash)
    Computes hashes for nodes of an tree structured RDF graph rooted in a given node.
    static Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode>
    createGenericHashMap(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris)
     
    static Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode>
    createGenericHashMap(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris, BiPredicate<? super org.apache.jena.rdf.model.RDFNode,? super Integer> filterKeep)
     
    static com.google.common.hash.HashCode
    generateModelHash(org.apache.jena.graph.Graph graph, com.google.common.hash.HashFunction hashFunction)
     
    static com.google.common.hash.HashCode
    generateModelHash(org.apache.jena.rdf.model.Model model, com.google.common.hash.HashFunction hashFunction)
     
    static <T> int
    getNumOps(T op, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
     
    static <T> Iterable<? extends T>
    peekingSubOps(T op, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
     

    Methods inherited from class java.lang.Object

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

    • ResourceTreeUtils

      public ResourceTreeUtils()
  • Method Details

    • peekingSubOps

      public static <T> Iterable<? extends T> peekingSubOps(T op, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
    • getNumOps

      public static <T> int getNumOps(T op, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
    • clearSubTree

      public static void clearSubTree(org.apache.jena.rdf.model.Resource root)
      Recursively delete all properties of all resources reachable from the root resource (inclusive) in outgoing direction. The resource itself is not deleted.
      Parameters:
      root -
    • clearSubTree

      public static <T extends org.apache.jena.rdf.model.Resource> void clearSubTree(T rootOp, com.google.common.graph.SuccessorsFunction<T> successorsFunction)
    • generateModelHash

      public static com.google.common.hash.HashCode generateModelHash(org.apache.jena.rdf.model.Model model, com.google.common.hash.HashFunction hashFunction)
    • generateModelHash

      public static com.google.common.hash.HashCode generateModelHash(org.apache.jena.graph.Graph graph, com.google.common.hash.HashFunction hashFunction)
    • createGenericHash

      public static com.google.common.hash.HashCode createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris)
      Create a hash for a resource based on transitively following its outgoing properties For each of a reosurce's statement, first a hash for its object is recursively computed. Afterwards, the so obtained (property, hash) pairs are then combined into an overall hash using Hashing.combineUnordered. Note, that URIs of nodes are NOT considered unless they are leaf nodes. ISSUE We need to be able to 'skip' nodes
      Parameters:
      rdfNode -
      Returns:
    • createGenericHash

      public static com.google.common.hash.HashCode createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode)
    • createGenericHashMap

      public static Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode> createGenericHashMap(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris, BiPredicate<? super org.apache.jena.rdf.model.RDFNode,? super Integer> filterKeep)
    • createGenericHashMap

      public static Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode> createGenericHashMap(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris)
    • createGenericHash

      public static com.google.common.hash.HashCode createGenericHash(org.apache.jena.rdf.model.RDFNode rdfNode, boolean useInnerIris, BiPredicate<? super org.apache.jena.rdf.model.RDFNode,? super Integer> filterKeep, int depth, Set<org.apache.jena.rdf.model.RDFNode> seen, com.google.common.hash.HashFunction hashFn, Map<org.apache.jena.rdf.model.RDFNode,com.google.common.hash.HashCode> priorHash)
      Computes hashes for nodes of an tree structured RDF graph rooted in a given node. This method performs a depth first post order traversal. If ignoreInnerIris is active, an IRI node's hash depends on that of its children. Otherewise, the IRI itself will be hashed. The method does not traverse over literals (as they do not have properties).
      Parameters:
      rdfNode -
      useInnerIris -
      filterKeep - (node, depth) whether to consider the node for id computation
      seen -
      hashFn -
      priorHash -
      Returns: