Class TripleUtils

java.lang.Object
org.aksw.jenax.arq.util.triple.TripleUtils

public class TripleUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.graph.Triple
    bindingToTriple(org.apache.jena.sparql.engine.binding.Binding b)
     
    static org.apache.jena.graph.Triple
    bindingToTriple(org.apache.jena.sparql.engine.binding.Binding b, org.apache.jena.sparql.core.Var vs, org.apache.jena.sparql.core.Var vp, org.apache.jena.sparql.core.Var vo)
     
    static int
    compare(org.apache.jena.graph.Triple o1, org.apache.jena.graph.Triple o2, Comparator<org.apache.jena.graph.Node> nc)
    Compare two triples by their nodes.
    static int
    compareRDFTerms(org.apache.jena.graph.Triple o1, org.apache.jena.graph.Triple o2)
     
    static org.apache.jena.graph.Triple
    create(org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o, boolean isForward)
     
    static org.apache.jena.graph.Triple
    create(org.apache.jena.graph.Node s, org.apache.jena.sparql.path.P_Path0 p, org.apache.jena.graph.Node o)
     
    static org.apache.jena.graph.Triple
    createMatch(org.apache.jena.graph.Node source, org.apache.jena.graph.Node predicate, boolean isForward)
    Create a matcher for triples having a certain predicate and a source node.
    static org.apache.jena.graph.Triple
    createMatch(org.apache.jena.graph.Node source, org.apache.jena.sparql.path.P_Path0 predicate)
    Create a matcher for triples having a certain predicate and a source node.
    static org.apache.jena.graph.Triple
    createMatch(org.apache.jena.graph.Triple triple, boolean isForward)
     
    static org.apache.jena.graph.Triple
    fromArray(org.apache.jena.graph.Node[] nodes)
     
    static org.apache.jena.graph.Node
    getNode(org.apache.jena.graph.Triple triple, int idx)
    Access a triple's component by a zero-based index in order s, p, o.
    static org.apache.jena.graph.Node
    getNode(org.apache.jena.graph.Triple triple, org.apache.jena.sparql.core.mem.TupleSlot slot)
     
    static org.apache.jena.graph.Node
    getSource(org.apache.jena.graph.Triple triple, boolean isForward)
    If isForward is true then return the triple's subject otherwise its object.
    static org.apache.jena.graph.Node
    getTarget(org.apache.jena.graph.Triple triple, boolean isForward)
    If isForward is true then return the triple's object otherwise its subject.
    static org.apache.jena.sparql.core.mem.TupleSlot
    idxToSlot(int idx)
     
    static boolean
    isValid(org.apache.jena.graph.Triple t)
    Returns true if the triple survives a serialization/deserialization round trip
    static boolean
    isValidAsStatement(org.apache.jena.graph.Triple t)
     
    static Iterator<org.apache.jena.graph.Node>
    iterateNodes(org.apache.jena.graph.Triple t)
     
    static org.apache.jena.graph.Triple
    listToTriple(List<org.apache.jena.graph.Node> nodes)
     
    static org.apache.jena.graph.Triple
    logicalAnd(org.apache.jena.graph.Triple a, org.apache.jena.graph.Triple b)
    Create a logical conjunction from two triple pattern.
    static String
    md5sum(org.apache.jena.graph.Triple triple)
     
    static int
    slotToIdx(org.apache.jena.sparql.core.mem.TupleSlot slot)
     
    static Stream<org.apache.jena.graph.Node>
    streamNodes(org.apache.jena.graph.Triple t)
     
    static Set<org.apache.jena.graph.Triple>
    swap(Iterable<org.apache.jena.graph.Triple> triples)
     
    static org.apache.jena.graph.Triple
    swap(org.apache.jena.graph.Triple t)
     
    static org.apache.jena.graph.Node[]
    toArray(org.apache.jena.graph.Triple t)
     
    static org.apache.jena.sparql.engine.binding.Binding
    tripleToBinding(org.apache.jena.graph.Triple triple)
     
    static org.apache.jena.sparql.engine.binding.Binding
    tripleToBinding(org.apache.jena.graph.Triple pattern, org.apache.jena.graph.Triple assignment)
     
    static org.apache.jena.sparql.engine.binding.Binding
    tripleToBinding(org.apache.jena.graph.Triple triple, org.apache.jena.sparql.engine.binding.Binding parent)
     
    static List<org.apache.jena.graph.Node>
    tripleToList(org.apache.jena.graph.Triple triple)
     

    Methods inherited from class java.lang.Object

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

    • TripleUtils

      public TripleUtils()
  • Method Details

    • streamNodes

      public static Stream<org.apache.jena.graph.Node> streamNodes(org.apache.jena.graph.Triple t)
    • iterateNodes

      public static Iterator<org.apache.jena.graph.Node> iterateNodes(org.apache.jena.graph.Triple t)
    • isValidAsStatement

      public static boolean isValidAsStatement(org.apache.jena.graph.Triple t)
    • getNode

      public static org.apache.jena.graph.Node getNode(org.apache.jena.graph.Triple triple, int idx)
      Access a triple's component by a zero-based index in order s, p, o. Raises IndexOutOfBoundsException for any index outside of the range [0, 2]
    • idxToSlot

      public static org.apache.jena.sparql.core.mem.TupleSlot idxToSlot(int idx)
    • slotToIdx

      public static int slotToIdx(org.apache.jena.sparql.core.mem.TupleSlot slot)
    • getNode

      public static org.apache.jena.graph.Node getNode(org.apache.jena.graph.Triple triple, org.apache.jena.sparql.core.mem.TupleSlot slot)
    • logicalAnd

      public static org.apache.jena.graph.Triple logicalAnd(org.apache.jena.graph.Triple a, org.apache.jena.graph.Triple b)
      Create a logical conjunction from two triple pattern.
      Parameters:
      a -
      b -
      Returns:
    • getSource

      public static org.apache.jena.graph.Node getSource(org.apache.jena.graph.Triple triple, boolean isForward)
      If isForward is true then return the triple's subject otherwise its object.
    • getTarget

      public static org.apache.jena.graph.Node getTarget(org.apache.jena.graph.Triple triple, boolean isForward)
      If isForward is true then return the triple's object otherwise its subject.
    • createMatch

      public static org.apache.jena.graph.Triple createMatch(org.apache.jena.graph.Node source, org.apache.jena.sparql.path.P_Path0 predicate)
      Create a matcher for triples having a certain predicate and a source node. If 'isForward' is true then the subject acts as the source otherwise its the object.
    • createMatch

      public static org.apache.jena.graph.Triple createMatch(org.apache.jena.graph.Triple triple, boolean isForward)
    • createMatch

      public static org.apache.jena.graph.Triple createMatch(org.apache.jena.graph.Node source, org.apache.jena.graph.Node predicate, boolean isForward)
      Create a matcher for triples having a certain predicate and a source node. If 'isForward' is true then the subject acts as the source otherwise its the object.
    • create

      public static org.apache.jena.graph.Triple create(org.apache.jena.graph.Node s, org.apache.jena.sparql.path.P_Path0 p, org.apache.jena.graph.Node o)
    • create

      public static org.apache.jena.graph.Triple create(org.apache.jena.graph.Node s, org.apache.jena.graph.Node p, org.apache.jena.graph.Node o, boolean isForward)
    • toArray

      public static org.apache.jena.graph.Node[] toArray(org.apache.jena.graph.Triple t)
    • fromArray

      public static org.apache.jena.graph.Triple fromArray(org.apache.jena.graph.Node[] nodes)
    • tripleToBinding

      public static org.apache.jena.sparql.engine.binding.Binding tripleToBinding(org.apache.jena.graph.Triple triple)
    • tripleToBinding

      public static org.apache.jena.sparql.engine.binding.Binding tripleToBinding(org.apache.jena.graph.Triple triple, org.apache.jena.sparql.engine.binding.Binding parent)
    • bindingToTriple

      public static org.apache.jena.graph.Triple bindingToTriple(org.apache.jena.sparql.engine.binding.Binding b)
    • bindingToTriple

      public static org.apache.jena.graph.Triple bindingToTriple(org.apache.jena.sparql.engine.binding.Binding b, org.apache.jena.sparql.core.Var vs, org.apache.jena.sparql.core.Var vp, org.apache.jena.sparql.core.Var vo)
    • tripleToBinding

      public static org.apache.jena.sparql.engine.binding.Binding tripleToBinding(org.apache.jena.graph.Triple pattern, org.apache.jena.graph.Triple assignment)
    • swap

      public static org.apache.jena.graph.Triple swap(org.apache.jena.graph.Triple t)
    • swap

      public static Set<org.apache.jena.graph.Triple> swap(Iterable<org.apache.jena.graph.Triple> triples)
    • listToTriple

      public static org.apache.jena.graph.Triple listToTriple(List<org.apache.jena.graph.Node> nodes)
    • tripleToList

      public static List<org.apache.jena.graph.Node> tripleToList(org.apache.jena.graph.Triple triple)
    • isValid

      public static boolean isValid(org.apache.jena.graph.Triple t)
      Returns true if the triple survives a serialization/deserialization round trip
    • md5sum

      public static String md5sum(org.apache.jena.graph.Triple triple)
    • compareRDFTerms

      public static int compareRDFTerms(org.apache.jena.graph.Triple o1, org.apache.jena.graph.Triple o2)
    • compare

      public static int compare(org.apache.jena.graph.Triple o1, org.apache.jena.graph.Triple o2, Comparator<org.apache.jena.graph.Node> nc)
      Compare two triples by their nodes.