## Not run:
# --------------------------------------------------------------------------------------------------
#
# These examples require Essentia to be installed:
#
# queryfile <- file("examplequery.sh","w")
# cat("ess exec \"echo -e '11,12,13\n4,5,6\n7,8,9'\" #-notitle \n",file=queryfile)
# cat("ess exec \"echo -e '11,12,13\n4,5,6\n7,8,9'\" \n", file=queryfile)
# cat("ess exec \"echo -e '11,12,13\n4,5,6\n7,8,9'\" #Rignore \n", file=queryfile)
# capture.essentia("examplequery.sh")
# print(command1)
# print(command2)
# print("The last statement is ignored by R and just executed on the command line.")
#
# --------------------------------------------------------------------------------------------------
#
# This example requires Essentia to have selected a datastore containing purchase log data:
#
# Store these lines as querypurchase.sh:
#
# ess query "select count(refID) from purchase:2014-09-01:2014-09-15 \
# where articleID>=46 group by price" #Rinclude
# ess query "select count(distinct userID) from purchase:2014-09-01:2014-09-15 \
# where articleID>=46" #Rinclude
# ess query "select count(refID) from purchase:2014-09-01:2014-09-15 \
# where articleID>=46 group by userID" #Rinclude
# ess query "select * from purchase:*:* where articleID <= 20" #Rinclude #R#querystream#R# #-notitle
#
# -----------------------------------------------
#
# Then run these commands in R:
#
# library(RESS)
# capture.essentia("querypurchase.sh")
# print(command1)
# print(command2)
# print(command3)
# print(querystream)
#
# --------------------------------------------------------------------------------------------------
#
# The following example requires Essentia to be installed with apache log data stored in it.
#
# Store the following lines as queryapache.sh:
#
# # Query the Essentia database logsapache3 and save the contents of vector3 in R as command1.
# ess exec "aq_udb -exp logsapache3:vector3" --debug
#
# # Query the Essentia database logsapache1 and save the sorted contents of vector1 in R as command2.
# ess exec "aq_udb -exp logsapache1:vector1 -sort pagecount -dec" --debug
#
# # Stream the last five lines of the file in category 125accesslogs between dates 2014-12-07 and
# # 2014-12-07, convert them to csv, return them to R, and store them into an R dataframe singlefile.
# ess stream 125accesslogs '2014-12-07' '2014-12-07' "tail -5 \
# | logcnv -f,eok - -d ip:ip sep:' ' s:rlog sep:' ' s:rusr sep:' [' i,tim:time sep:'] \"' \
# s,clf:req_line1 sep:' ' s,clf:req_line2 sep:' ' s,clf:req_line3 sep:'\" ' i:res_status sep:' ' \
# i:res_size sep:' \"' s,clf:referrer sep:'\" \"' \
# s,clf:user_agent sep:'\"' X | cat -" #Rinclude #R#singlefile#R#
#
# # Stream the last five lines of the files in category 125accesslogs between dates 2014-11-30 and
# # 2014-12-07, convert them to csv, and save them into R dataframes apachefiles1 and apachefiles2.
# ess stream 125accesslogs '2014-11-30' '2014-12-07' "tail -5 \
# | logcnv -f,eok - -d ip:ip sep:' ' s:rlog sep:' ' s:rusr sep:' [' i,tim:time sep:'] \"' \
# s,clf:req_line1 sep:' ' s,clf:req_line2 sep:' ' s,clf:req_line3 sep:'\" ' i:res_status sep:' ' \
# i:res_size sep:' \"' s,clf:referrer sep:'\" \"' s,clf:user_agent sep:'\"' X -notitle | cat -" \
# #Rinclude #R#apachefiles#R# #Rseparate
#
# -----------------------------------------------
#
# Then run these commands in R:
#
# library(RESS)
# capture.essentia("queryapache.sh")
#
# print(command1)
# print(command2)
# print(singlefile)
# print(apachefiles1)
# print(apachefiles2)
#
# The references contain more extensive examples that
# fully walkthrough how to load and query the Essentia Database.
#
# ## End(Not run)
Run the code above in your browser using DataLab