25 template <
class StringIndexQueryAlgo,
class SymbolType,
template <
typename >
class StringIndex >
37 for (
const std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
38 rev [ occurrence.second ] = occurrence.first;
41 for (
const std::pair < unsigned, unsigned > & subOccurrence : subOcc ) {
42 if ( rev [ subOccurrence.first ] !=
static_cast < unsigned > ( -1 ) )
43 res.push_back (
std::make_pair ( rev [ subOccurrence.first ], subOccurrence.second ) );
46 for (
const std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
47 rev [ occurrence.second ] =
static_cast < unsigned > ( -1 );
66template <
class SymbolType,
template <
typename >
class StringIndex,
class StringIndexQueryAlgo >
76 treePatternParts.back ( ).push_back ( symbol );
79 treePatternParts.back ( ).push_back ( symbol );
85 for (
unsigned i = 1;
i < treePatternParts.size ( ); ++
i ) {
86 for ( std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
88 auto variableSettingIter = nonlinearVariablesMap.find (
std::make_pair ( occurrence.first, treePatternParts [
i ].back ( ) ) );
89 if ( variableSettingIter == nonlinearVariablesMap.
end ( ) )
91 else if ( variableSettingIter->second != fullAndLinearIndex.
getRepeats ( ) [ occurrence.second ] )
92 occurrence.first =
static_cast < unsigned > ( -1 );
94 occurrence.second = fullAndLinearIndex.
getJumps ( ) [ occurrence.second ];
99 if ( ! treePatternParts [
i ].empty ( ) )
100 prevOcc = MergeOccurrences ( prevOcc, NonlinearFullAndLinearIndexPatterns::FindOccurrences < StringIndexQueryAlgo > ( fullAndLinearIndex.
getStringIndex ( ), treePatternParts [
i ] ), rev );
104 for (
const std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
105 if ( occurrence.first !=
static_cast < unsigned > ( -1 ) )
106 res.insert ( occurrence.first );
112template <
class SymbolType,
template <
typename >
class StringIndex,
class StringIndexQueryAlgo >
125 treePatternParts.back ( ).push_back ( symbol );
128 treePatternParts.back ( ).push_back ( symbol );
134 for (
unsigned i = 1;
i < treePatternParts.size ( ); ++
i ) {
135 for ( std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
137 auto variableSettingIter = nonlinearVariablesMap.find (
std::make_pair ( occurrence.first, treePatternParts [
i ].back ( ) ) );
138 if ( variableSettingIter == nonlinearVariablesMap.
end ( ) )
140 else if ( variableSettingIter->second != fullAndLinearIndex.
getRepeats ( ) [ occurrence.second ] )
141 occurrence.first =
static_cast < unsigned > ( -1 );
143 occurrence.second = fullAndLinearIndex.
getJumps ( ) [ occurrence.second ];
148 if ( ! treePatternParts [
i ].empty ( ) )
149 prevOcc = MergeOccurrences ( prevOcc, NonlinearFullAndLinearIndexPatterns::FindOccurrences < StringIndexQueryAlgo > ( fullAndLinearIndex.
getStringIndex ( ), treePatternParts [
i ] ), rev );
153 for (
const std::pair < unsigned, unsigned > & occurrence : prevOcc ) {
154 if ( occurrence.first !=
static_cast < unsigned > ( -1 ) )
155 res.insert ( occurrence.first );
Definition: NonlinearFullAndLinearIndexPatterns.h:24
static ext::set< unsigned > query(const indexes::arbology::NonlinearFullAndLinearIndex< SymbolType, StringIndex > &fullAndLinearIndex, const tree::PrefixRankedNonlinearPattern< SymbolType > &pattern)
Definition: NonlinearFullAndLinearIndexPatterns.h:67
Definition: ranked_symbol.hpp:20
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
std::pair< iterator, bool > insert(const T &key, const R &value)
Insert variant with explicit key and value parameters.
Definition: map.hpp:118
auto end() &
Inherited behavior of end for non-const instance.
Definition: map.hpp:215
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Full and linear tree index. The index serves as a adaptor of string index so that searching for tree ...
Definition: NonlinearFullAndLinearIndex.h:50
const ext::vector< unsigned > & getRepeats() const &
Definition: NonlinearFullAndLinearIndex.h:220
const StringIndex< common::ranked_symbol< SymbolType > > & getStringIndex() const &
Definition: NonlinearFullAndLinearIndex.h:200
const ext::vector< int > & getJumps() const &
Definition: NonlinearFullAndLinearIndex.h:210
Linear string.
Definition: LinearString.h:57
Definition: PositionHeapFactors.h:24
Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional ...
Definition: PrefixRankedBarNonlinearPattern.h:91
const ext::set< common::ranked_symbol< SymbolType > > & getNonlinearVariables() const &
Definition: PrefixRankedBarNonlinearPattern.h:277
const common::ranked_symbol< SymbolType > & getSubtreeWildcard() const &
Definition: PrefixRankedBarNonlinearPattern.h:259
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedBarNonlinearPattern.h:434
const common::ranked_symbol< SymbolType > & getVariablesBar() const &
Definition: PrefixRankedBarNonlinearPattern.h:295
Nonlinear tree pattern represented as linear sequece as result of preorder traversal....
Definition: PrefixRankedNonlinearPattern.h:82
const ext::set< common::ranked_symbol< SymbolType > > & getNonlinearVariables() const &
Definition: PrefixRankedNonlinearPattern.h:208
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedNonlinearPattern.h:333
const common::ranked_symbol< SymbolType > & getSubtreeWildcard() const &
Definition: PrefixRankedNonlinearPattern.h:190
Definition: BoyerMooreHorspool.h:22
int i
Definition: AllEpsilonClosure.h:118
return res
Definition: MinimizeByPartitioning.h:145
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79