Skip to content
Snippets Groups Projects
Commit 8ce3e300 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

expose and test tree pattern automaton on bar notation

parent dd8165bd
No related branches found
No related tags found
No related merge requests found
...@@ -60,6 +60,9 @@ int main ( int argc, char * argv[] ) { ...@@ -60,6 +60,9 @@ int main ( int argc, char * argv[] ) {
TCLAP::ValueArg < std::string > nonlinearVariablesInput ( "n", "nonlinear_variables", "Set of nonlinear variables to be used in algorithms needing it", false, "-", "file" ); TCLAP::ValueArg < std::string > nonlinearVariablesInput ( "n", "nonlinear_variables", "Set of nonlinear variables to be used in algorithms needing it", false, "-", "file" );
cmd.add ( nonlinearVariablesInput ); cmd.add ( nonlinearVariablesInput );
   
TCLAP::ValueArg < std::string > variablesBarInput ( "b", "variables_bar", "Variables bar symbol of subtree wildcard and nonlinear variables", false, "-", "file" );
cmd.add ( variablesBarInput );
TCLAP::SwitchArg ends ( "e", "ends", "Return occurrences as end indexes when applicable", false ); TCLAP::SwitchArg ends ( "e", "ends", "Return occurrences as end indexes when applicable", false );
cmd.add ( ends ); cmd.add ( ends );
   
...@@ -158,6 +161,26 @@ int main ( int argc, char * argv[] ) { ...@@ -158,6 +161,26 @@ int main ( int argc, char * argv[] ) {
parser.parse ( )->run ( environment ); parser.parse ( )->run ( environment );
} }
   
bool isBarNotation = false;
if ( algorithm.getValue ( ) == "exactTreePatternAutomaton"
|| algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) {
std::string inputType = environment.getVariable ( "subject" )->getReturnType ( );
isBarNotation = inputType.find ( "Bar" ) != std::string::npos;
if ( isBarNotation ) {
std::string input;
if ( ! variablesBarInput.isSet ( ) )
input = "-";
else
input = variablesBarInput.getValue ( );
environment.setBinding ( "inputVariablesBar", input );
cli::Parser parser ( cli::Lexer ( "execute <:ranked_symbol #inputVariablesBar > $variablesBar" ) );
parser.parse ( )->run ( environment );
}
}
measurements::end ( ); measurements::end ( );
measurements::start ( "Algorithm", measurements::Type::MAIN ); measurements::start ( "Algorithm", measurements::Type::MAIN );
   
...@@ -181,9 +204,15 @@ int main ( int argc, char * argv[] ) { ...@@ -181,9 +204,15 @@ int main ( int argc, char * argv[] ) {
} else if ( algorithm.getValue ( ) == "exactSubtreeAutomaton" ) { } else if ( algorithm.getValue ( ) == "exactSubtreeAutomaton" ) {
cliCommand = "execute arbology::exact::ExactSubtreeAutomaton $subject > $output"; cliCommand = "execute arbology::exact::ExactSubtreeAutomaton $subject > $output";
} else if ( algorithm.getValue ( ) == "exactTreePatternAutomaton" ) { } else if ( algorithm.getValue ( ) == "exactTreePatternAutomaton" ) {
cliCommand = "execute arbology::exact::ExactTreePatternAutomaton $subject $subtreeWildcard > $output"; if ( isBarNotation )
cliCommand = "execute arbology::exact::ExactTreePatternAutomaton $subject $subtreeWildcard $variablesBar > $output";
else
cliCommand = "execute arbology::exact::ExactTreePatternAutomaton $subject $subtreeWildcard > $output";
} else if ( algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) { } else if ( algorithm.getValue ( ) == "exactNonlinearTreePatternAutomaton" ) {
cliCommand = "execute arbology::exact::ExactNonlinearTreePatternAutomaton $subject $subtreeWildcard $nonlinearVariables > $output"; if ( isBarNotation )
cliCommand = "execute arbology::exact::ExactNonlinearTreePatternAutomaton $subject $subtreeWildcard $nonlinearVariables $variablesBar > $output";
else
cliCommand = "execute arbology::exact::ExactNonlinearTreePatternAutomaton $subject $subtreeWildcard $nonlinearVariables > $output";
} else if ( algorithm.getValue ( ) == "exactSubtreeRepeatsNaive" ) { } else if ( algorithm.getValue ( ) == "exactSubtreeRepeatsNaive" ) {
cliCommand = "execute tree::properties::ExactSubtreeRepeatsNaive $subject > $output"; cliCommand = "execute tree::properties::ExactSubtreeRepeatsNaive $subject > $output";
} else if ( algorithm.getValue ( ) == "normalizeTreeLabels" ) { } else if ( algorithm.getValue ( ) == "normalizeTreeLabels" ) {
......
...@@ -428,9 +428,11 @@ runTestPatternEnds "Exact Pattern Matching Automaton (PrefixRanked)" "./aarbolog ...@@ -428,9 +428,11 @@ runTestPatternEnds "Exact Pattern Matching Automaton (PrefixRanked)" "./aarbolog
   
RAND_SIZE_SUBJECT=120 RAND_SIZE_SUBJECT=120
runTestPatternEnds "Exact Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -o get -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) | ./astat2 -p size" runTestPatternEnds "Exact Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -o get -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) | ./astat2 -p size"
RAND_SIZE_SUBJECT=80 RAND_SIZE_SUBJECT=80
runTestNonlinearPatternEnds "Exact Nonlinear Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactNonlinearTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -o get -i \"\$PATTERN_FILE\" ) -n <( ./aaccess2 --tree nonlinear_variables -o get -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedNonlinearPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) -f <(echo '<Set />') | ./aql2 -q 'execute < :pair_set #stdin | dataAccess::PairSetFirst - >#stdout' | ./astat2 -p size" runTestNonlinearPatternEnds "Exact Nonlinear Tree Pattern Automaton (PrefixRanked)" "./aarbology2 -a exactNonlinearTreePatternAutomaton -s <( ./acast2 -t PrefixRankedTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -o get -i \"\$PATTERN_FILE\" ) -n <( ./aaccess2 --tree nonlinear_variables -o get -i \"\$PATTERN_FILE\" ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedNonlinearPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) -f <(echo '<Set />') | ./aql2 -q 'execute < :pair_set #stdin | dataAccess::PairSetFirst - >#stdout' | ./astat2 -p size"
   
runTestNonlinearPattern "Exact Nonlinear Tree Pattern Automaton (PrefixRankedBar)" "./aarbology2 -a exactNonlinearTreePatternAutomaton -s <( ./acast2 -t PrefixRankedBarTree -i \"\$SUBJECT_FILE\" ) -w <( ./aaccess2 --tree subtree_wildcard -o get -i \"\$PATTERN_FILE\" ) -n <( ./aaccess2 --tree nonlinear_variables -o get -i \"\$PATTERN_FILE\" ) -b <( ./aaccess2 --tree variables_bar -o get -i <(./acast2 -t PrefixRankedBarNonlinearPattern -i \"\$PATTERN_FILE\" ) ) | ./adeterminize2 | ./arun2 -t result -i <(./acast2 -t PrefixRankedBarNonlinearPattern -i \"\$PATTERN_FILE\" | ./acast2 -t LinearString ) -f <(echo '<Set />') | ./aql2 -q 'execute < :pair_set #stdin | dataAccess::PairSetFirst - >#stdout' | ./astat2 -p size"
   
RAND_SIZE_SUBJECT=1000 RAND_SIZE_SUBJECT=1000
runTestSubtree "Exact Boyer Moore Horspool (Subtree PrefixRankedBar)" "./aarbology2 -a boyerMooreHorspool -s <( ./acast2 -t PrefixRankedBarTree -i \"\$SUBJECT_FILE\" ) -p <( ./acast2 -t PrefixRankedBarTree -i <(./aaccess2 --tree alphabet -o add -i \"\$PATTERN_FILE\" -c <(./aaccess2 --tree alphabet -o get -i \"\$SUBJECT_FILE\"))) | ./astat2 -p size" runTestSubtree "Exact Boyer Moore Horspool (Subtree PrefixRankedBar)" "./aarbology2 -a boyerMooreHorspool -s <( ./acast2 -t PrefixRankedBarTree -i \"\$SUBJECT_FILE\" ) -p <( ./acast2 -t PrefixRankedBarTree -i <(./aaccess2 --tree alphabet -o add -i \"\$PATTERN_FILE\" -c <(./aaccess2 --tree alphabet -o get -i \"\$SUBJECT_FILE\"))) | ./astat2 -p size"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment