java.lang.Object
org.aksw.jena_sparql_api_sparql_path2.playground.NfaDijkstra

public class NfaDijkstra extends Object
Just a scratch pad for my thoughts whether dijkstra could be applied to nfa matching. classic dijstra tracks cost(v) predecessor(v) - vertex from which the minimal cost originated we could track the minimum cost per each predecessor state vertex B was reached in state Y by predecessor A in this state X Essentially this is dijkstra on a graph that is dynamically generated. The vertices are (state, node) pairs, wherease for edges it is (transition, triple) pairs (transition is a triplet<S, PredicateClass>) %Note, that it is essential for the edge also to include the transition, because Given the RPQ:

/

/

- should a p a match? if not, we do not have to track the automaton transitions. An edge in the

Author:
raveni
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <V, E> org.aksw.commons.util.triplet.TripletPath<V,org.aksw.commons.util.Directed<E>>
    dijkstra(Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,org.aksw.commons.util.Directed<E>>>>> successors, Collection<V> sources, Predicate<V> isTarget)
     
    static <S, T, V, E> org.aksw.commons.util.triplet.TripletPath<V,E>
    dijkstra(Nfa<S,T> nfa, Predicate<T> isEpsilon, Function<T,Pair<ValueSet<V>>> transToVertexClass, Function<Pair<ValueSet<V>>,Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,E>>>>> createTripletLookupService, V source, V target)
    Finds the shortest path connecting the source and target nodes in accordance with an nfa
    static <S, T, V, E> Map<Map.Entry<S,V>,Set<org.aksw.commons.util.triplet.Triplet<Map.Entry<S,V>,org.aksw.commons.util.Directed<E>>>>
    getSuccessors(Nfa<S,T> nfa, Predicate<T> isEpsilon, Function<T,? extends Pair<ValueSet<V>>> transToVertexClass, Function<Pair<ValueSet<V>>,? extends Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,E>>>>> createTripletLookupService, Iterable<Map.Entry<S,V>> stateVertexPairs)
    Note: When when requesting successors of a vertex, the state component will be resolved to non-epsilon state, and the result will be accociated back with the requested state Note: we could require T to be T extends Pair<ValueSet>
    static <T, V, E> boolean
    isOrigin(Pair<ValueSet<V>> vertexClass, V vertex, org.aksw.commons.util.triplet.Triplet<V,E> triplet)
    Check whether a triplet originated from a certain transition

    Methods inherited from class java.lang.Object

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

    • NfaDijkstra

      public NfaDijkstra()
  • Method Details

    • isOrigin

      public static <T, V, E> boolean isOrigin(Pair<ValueSet<V>> vertexClass, V vertex, org.aksw.commons.util.triplet.Triplet<V,E> triplet)
      Check whether a triplet originated from a certain transition
      Parameters:
      transition -
      transToVertexClass -
      vertex -
      triplet -
      Returns:
    • dijkstra

      public static <V, E> org.aksw.commons.util.triplet.TripletPath<V,org.aksw.commons.util.Directed<E>> dijkstra(Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,org.aksw.commons.util.Directed<E>>>>> successors, Collection<V> sources, Predicate<V> isTarget)
    • dijkstra

      public static <S, T, V, E> org.aksw.commons.util.triplet.TripletPath<V,E> dijkstra(Nfa<S,T> nfa, Predicate<T> isEpsilon, Function<T,Pair<ValueSet<V>>> transToVertexClass, Function<Pair<ValueSet<V>>,Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,E>>>>> createTripletLookupService, V source, V target)
      Finds the shortest path connecting the source and target nodes in accordance with an nfa
      Parameters:
      nfa -
      isEpsilon -
      transToVertexClass -
      createTripletLookupService -
      source -
      target -
    • getSuccessors

      public static <S, T, V, E> Map<Map.Entry<S,V>,Set<org.aksw.commons.util.triplet.Triplet<Map.Entry<S,V>,org.aksw.commons.util.Directed<E>>>> getSuccessors(Nfa<S,T> nfa, Predicate<T> isEpsilon, Function<T,? extends Pair<ValueSet<V>>> transToVertexClass, Function<Pair<ValueSet<V>>,? extends Function<? super Iterable<V>,Map<V,Set<org.aksw.commons.util.triplet.Triplet<V,E>>>>> createTripletLookupService, Iterable<Map.Entry<S,V>> stateVertexPairs)
      Note: When when requesting successors of a vertex, the state component will be resolved to non-epsilon state, and the result will be accociated back with the requested state Note: we could require T to be T extends Pair<ValueSet>
      Parameters:
      nfa -
      isEpsilon -
      transToVertexClass - Mapping from nfa transitions to vertex classes
      createTripletLookupService -
      stateVertexPairs -
      Returns: