Class EdgeReducer
java.lang.Object
org.aksw.jena_sparql_api_sparql_path2.playground.EdgeReducer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S,T> int determineRequiredPredicateDirectionsForRetrieval(org.jgrapht.Graph<S, T> graph, S state, Function<T, PredicateClass> toPredicateClass) 0: no predicates (occurrs e.g.static <S,T> NfaAnalysisResult<S> estimateFrontierCost(Nfa<S, T> nfa, Predicate<T> isEpsilon, Function<T, PredicateClass> transToPredicateClass, Pair<Map<org.apache.jena.graph.Node, Number>> initPredFreqs, JoinSummaryService joinSummaryService) - Vertices: are mapped to the estimated set of predicates with their estimated (maximum) frequency - Edge: Their property classes are resolved to explicit sets of predicates.static <S,T, P> Set<P> getReferencedPredicates(Nfa<S, T> nfa, Predicate<Map.Entry<P, P>> joins, Predicate<T> isEpsilon, Function<Set<T>, Set<P>> transitionsToPredicates) Based on the nfa, a list of all predicates and a predicate join summary, determine the set of predicates referenced by the nfa The set of all predicates is implicitly used by transitionsToPredicates, as this function must resolve negated predicate sets BiHashMultimap<P, P> joinSummarystatic org.aksw.commons.collections.multimaps.BiHashMultimap<org.apache.jena.graph.Node,org.apache.jena.graph.Node> loadJoinSummary(org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory qef) loadPredicateSummary(org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory qef) trimPredicates(Nfa<S, T> nfa, Predicate<T> isEpsilon, Function<T, PredicateClass> transitionToPredicateClass, Pair<Map<org.apache.jena.graph.Node, Number>> initDiPredToCost, Map<S, Pair<Map<org.apache.jena.graph.Node, Number>>> stateToDiPredToCost, JoinSummaryService joinSummaryService) This method takes as input an nfa where edges are labeled with the predicates according to the join summary.
-
Constructor Details
-
EdgeReducer
public EdgeReducer()
-
-
Method Details
-
estimateFrontierCost
public static <S,T> NfaAnalysisResult<S> estimateFrontierCost(Nfa<S, T> nfa, Predicate<T> isEpsilon, Function<T, PredicateClass> transToPredicateClass, Pair<Map<org.apache.jena.graph.Node, Number>> initPredFreqs, JoinSummaryService joinSummaryService) - Vertices: are mapped to the estimated set of predicates with their estimated (maximum) frequency - Edge: Their property classes are resolved to explicit sets of predicates. Based on the predicates present on their start vertex, an estimate is made The problem is, how to sum up the statistics reaching a vertex from different paths? Duplicates: What if the frontiers reaching a vertex overlap because of duplicates? For example: (a|b)|(a|c)d Maybe this is a problem of rephrasing the automaton TODO We only need to resolve newly added predicates from the join summary- Parameters:
nfa-isEpsilon-- Returns:
-
trimPredicates
public static <S,T> Map<T,Double> trimPredicates(Nfa<S, T> nfa, Predicate<T> isEpsilon, Function<T, PredicateClass> transitionToPredicateClass, Pair<Map<org.apache.jena.graph.Node, Number>> initDiPredToCost, Map<S, Pair<Map<org.apache.jena.graph.Node, Number>>> stateToDiPredToCost, JoinSummaryService joinSummaryService) This method takes as input an nfa where edges are labeled with the predicates according to the join summary. This method then starts from the target states, and checks which properties join with it. However, predicates that do not join with the predicates are removed. This process is carried out recursively. -
determineRequiredPredicateDirectionsForRetrieval
public static <S,T> int determineRequiredPredicateDirectionsForRetrieval(org.jgrapht.Graph<S, T> graph, S state, Function<T, PredicateClass> toPredicateClass) 0: no predicates (occurrs e.g. on accepting states that do not lie on cyclic paths) 1: outbound 2: inbound 3: both- Parameters:
graph-state-toPredicateClass-- Returns:
-
loadJoinSummary
public static org.aksw.commons.collections.multimaps.BiHashMultimap<org.apache.jena.graph.Node,org.apache.jena.graph.Node> loadJoinSummary(org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory qef) -
loadPredicateSummary
-
getReferencedPredicates
public static <S,T, Set<P> getReferencedPredicatesP> (Nfa<S, T> nfa, Predicate<Map.Entry<P, P>> joins, Predicate<T> isEpsilon, Function<Set<T>, Set<P>> transitionsToPredicates) Based on the nfa, a list of all predicates and a predicate join summary, determine the set of predicates referenced by the nfa The set of all predicates is implicitly used by transitionsToPredicates, as this function must resolve negated predicate sets BiHashMultimap<P, P> joinSummary- Parameters:
nfa-predicates-joinSummary-
-