Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
8c406d31
There was a problem fetching the pipeline summary.
Commit
8c406d31
authored
7 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
use cli in aquery binary
parent
a7abfcaa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#
Changes
22
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aquery2/makefile.conf
+3
-3
3 additions, 3 deletions
aquery2/makefile.conf
aquery2/src/aquery.cpp
+52
-121
52 additions, 121 deletions
aquery2/src/aquery.cpp
with
55 additions
and
124 deletions
aquery2/makefile.conf
+
3
−
3
View file @
8c406d31
EXECUTABLE:=aquery2
LINK_PATHS=../alib2elgo/ ../alib2algo/ ../alib2data/ ../alib2common/ ../alib2std/
LINK_LIBRARIES=alib2elgo alib2algo alib2data alib2common alib2std xml2
INCLUDE_PATHS=\$$(SOURCES_BASE_DIR)/../../alib2
elgo/src/ \$$(SOURCES_BASE_DIR)/../../alib2algo/src/ \$$(SOURCES_BASE_DIR)/../../alib2data
/src/ \$$(SOURCES_BASE_DIR)/../../alib2common/src/ \$$(SOURCES_BASE_DIR)/../../alib2std/src/ /usr/include/libxml2/
LINK_PATHS=
../alib2cli/
../alib2elgo/ ../alib2algo/ ../alib2data/ ../alib2common/ ../alib2std/
LINK_LIBRARIES=
alib2cli
alib2elgo alib2algo alib2data alib2common alib2std xml2
INCLUDE_PATHS=\$$(SOURCES_BASE_DIR)/../../alib2
cli
/src/ \$$(SOURCES_BASE_DIR)/../../alib2common/src/ \$$(SOURCES_BASE_DIR)/../../alib2std/src/ /usr/include/libxml2/
This diff is collapsed.
Click to expand it.
aquery2/src/aquery.cpp
+
52
−
121
View file @
8c406d31
...
...
@@ -8,22 +8,10 @@
#include
<tclap/CmdLine.h>
#include
<global/GlobalData.h>
#include
<measure>
#include
<vector>
#include
<sax/FromXMLParserHelper.h>
#include
<factory/XmlDataFactory.hpp>
#include
<exception/CommonException.h>
#include
<string/String.h>
#include
<stringology/query/SuffixTrieFactors.h>
#include
<stringology/query/SuffixArrayFactors.h>
#include
<stringology/query/PositionHeapFactors.h>
#include
<stringology/query/BitParallelismFactors.h>
#include
<stringology/query/CompressedBitParallelismFactors.h>
#include
<arbology/query/CompressedBitParallelismPatterns.h>
#include
<arbology/query/NonlinearCompressedBitParallelismPatterns.h>
#include
<arbology/query/FullAndLinearIndexPatterns.h>
#include
<arbology/query/NonlinearFullAndLinearIndexPatterns.h>
#include
<lexer/Lexer.h>
#include
<parser/Parser.h>
int
main
(
int
argc
,
char
*
argv
[]
)
{
try
{
...
...
@@ -66,130 +54,73 @@ int main ( int argc, char * argv[] ) {
if
(
measure
.
isSet
())
common
::
GlobalData
::
measure
=
true
;
cli
::
Environment
environment
;
environment
.
setBinding
(
"indexData"
,
indexInput
.
getValue
(
)
);
environment
.
setBinding
(
"stdout"
,
"-"
);
measurements
::
start
(
"Overal"
,
measurements
::
Type
::
OVERALL
);
measurements
::
start
(
"Input read"
,
measurements
::
Type
::
AUXILIARY
);
if
(
query
.
getValue
(
)
==
"suffixTrieFactors"
)
{
indexes
::
stringology
::
SuffixTrie
<
DefaultSymbolType
>
suffixTrie
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
string
::
String
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
stringology
::
query
::
SuffixTrieFactors
::
query
(
suffixTrie
,
pattern
);
cli
::
Parser
parser
(
cli
::
Lexer
(
"execute <#indexData > $index"
)
);
parser
.
parse
(
)
->
run
(
environment
);
if
(
query
.
getValue
(
)
==
"suffixTrieFactors"
||
query
.
getValue
(
)
==
"suffixArrayFactors"
||
query
.
getValue
(
)
==
"positionHeapFactors"
||
query
.
getValue
(
)
==
"bitParallelismFactors"
||
query
.
getValue
(
)
==
"compressedBitParallelismFactors"
||
query
.
getValue
(
)
==
"compressedBitParallelismPatterns"
||
query
.
getValue
(
)
==
"nonlinearCompressedBitParallelismPatterns"
||
query
.
getValue
(
)
==
"fullAndLinearIndexPatterns"
||
query
.
getValue
(
)
==
"nonlinearFullAndLinearIndexPatterns"
)
{
std
::
string
input
;
if
(
patternInput
.
getValue
(
).
size
(
)
==
0
)
input
=
"-"
;
else
if
(
patternInput
.
getValue
(
).
size
(
)
==
1
)
input
=
*
patternInput
.
getValue
(
).
begin
(
);
else
throw
exception
::
CommonException
(
"Multiple parameters when single required."
);
environment
.
setBinding
(
"patternData"
,
input
);
parser
=
cli
::
Parser
(
cli
::
Lexer
(
"execute <#patternData > $pattern"
)
);
parser
.
parse
(
)
->
run
(
environment
);
}
measurements
::
end
(
);
measurements
::
start
(
"
Output w
rit
e
"
,
measurements
::
Type
::
AUXILIARY
);
measurements
::
end
(
);
measurements
::
start
(
"
Algo
rit
hm
"
,
measurements
::
Type
::
MAIN
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
std
::
string
cliCommand
;
if
(
query
.
getValue
(
)
==
"suffixTrieFactors"
)
{
cliCommand
=
"execute stringology::query::SuffixTrieFactors $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"suffixArrayFactors"
)
{
indexes
::
stringology
::
SuffixArray
<
>
suffixArray
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
string
::
String
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
stringology
::
query
::
SuffixArrayFactors
::
query
(
suffixArray
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute stringology::query::SuffixArrayFactors $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"positionHeapFactors"
)
{
indexes
::
stringology
::
PositionHeap
<
>
positionHeap
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
string
::
String
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
stringology
::
query
::
PositionHeapFactors
::
query
(
positionHeap
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute stringology::query::PositionHeapFactors $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"bitParallelismFactors"
)
{
indexes
::
stringology
::
BitParallelIndex
<
>
bitParallelIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
string
::
String
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
stringology
::
query
::
BitParallelismFactors
::
query
(
bitParallelIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute stringology::query::BitParallelismFactors $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"compressedBitParallelismFactors"
)
{
indexes
::
stringology
::
CompressedBitParallelIndex
<
>
compressedBitParallelIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
string
::
String
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
stringology
::
query
::
CompressedBitParallelismFactors
::
query
(
compressedBitParallelIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute stringology::query::CompressedBitParallelismFactors $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"compressedBitParallelismPatterns"
)
{
indexes
::
arbology
::
CompressedBitParallelTreeIndex
<
>
compressedBitParallelTreeIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
tree
::
RankedTreeWrapper
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
arbology
::
query
::
CompressedBitParallelismPatterns
::
query
(
compressedBitParallelTreeIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute arbology::query::CompressedBitParallelismPatterns $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"nonlinearCompressedBitParallelismPatterns"
)
{
indexes
::
arbology
::
NonlinearCompressedBitParallelTreeIndex
<
>
nonlinearCompressedBitParallelTreeIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
tree
::
RankedTreeWrapper
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
arbology
::
query
::
NonlinearCompressedBitParallelismPatterns
::
query
(
nonlinearCompressedBitParallelTreeIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute arbology::query::NonlinearCompressedBitParallelismPatterns $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"fullAndLinearIndexPatterns"
)
{
indexes
::
arbology
::
FullAndLinearIndex
<
>
fullAndLinearIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
tree
::
RankedTreeWrapper
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
arbology
::
query
::
FullAndLinearIndexPatterns
::
query
(
fullAndLinearIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute arbology::query::FullAndLinearIndexPatterns $index $pattern > $output"
;
}
else
if
(
query
.
getValue
(
)
==
"nonlinearFullAndLinearIndexPatterns"
)
{
indexes
::
arbology
::
NonlinearFullAndLinearIndex
<
>
nonlinearFullAndLinearIndex
=
alib
::
XmlDataFactory
::
fromTokens
(
sax
::
FromXMLParserHelper
::
parseInput
(
indexInput
)
);
tree
::
RankedTreeWrapper
pattern
=
alib
::
XmlDataFactory
::
fromTokens
(
std
::
move
(
sax
::
FromXMLParserHelper
::
parseInput
(
true
,
patternInput
).
front
(
)
)
);
measurements
::
end
(
);
measurements
::
start
(
"Algorithm"
,
measurements
::
Type
::
MAIN
);
ext
::
set
<
unsigned
>
res
=
arbology
::
query
::
NonlinearFullAndLinearIndexPatterns
::
query
(
nonlinearFullAndLinearIndex
,
pattern
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
alib
::
XmlDataFactory
::
toStdout
(
res
);
cliCommand
=
"execute arbology::query::NonlinearFullAndLinearIndexPatterns $index $pattern > $output"
;
}
else
{
throw
exception
::
CommonException
(
"Invalid algorithm"
);
}
parser
=
cli
::
Parser
(
cli
::
Lexer
(
cliCommand
)
);
parser
.
parse
(
)
->
run
(
environment
);
measurements
::
end
(
);
measurements
::
start
(
"Output write"
,
measurements
::
Type
::
AUXILIARY
);
parser
=
cli
::
Parser
(
cli
::
Lexer
(
"execute $output >#stdout"
)
);
parser
.
parse
(
)
->
run
(
environment
);
measurements
::
end
(
);
measurements
::
end
(
);
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment