Skip to content

Commit

Permalink
added queries + moved directory
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanolande committed Jul 3, 2017
1 parent 322b1db commit 99bb78a
Show file tree
Hide file tree
Showing 53 changed files with 4,884 additions and 665 deletions.
28 changes: 14 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
BlockchainDLib/.idea/libraries/*
BlockchainDLib/.idea/misc.xml
BlockchainDLib/.idea/modules.xml
BlockchainDLib/.idea/modules/blockchaindlib-build.iml
BlockchainDLib/.idea/modules/blockchaindlib.iml
BlockchainDLib/.idea/sbt.xml
BlockchainDLib/.idea/scala_compiler.xml
BlockchainDLib/.idea/workspace.xml
BlockchainDLib/org/bitcoinj/core/annotations.xml
BlockchainDLib/project/target/**/*.class
.idea/libraries/*
.idea/misc.xml
.idea/modules.xml
.idea/modules/blockchaindlib-build.iml
.idea/modules/blockchaindlib.iml
.idea/sbt.xml
.idea/scala_compiler.xml
.idea/workspace.xml
org/bitcoinj/core/annotations.xml
project/target/**/*.class
.idea/blockchain-api.iml
.idea/misc.xml
.idea/modules.xml
.idea/vcs.xml
.idea/workspace.xml
BlockchainDLib/.idea/uiDesigner.xml
BlockchainDLib/.idea/vcs.xml
BlockchainDLib/project/target/**
BlockchainDLib/target/**
.idea/uiDesigner.xml
.idea/vcs.xml
project/target/**
target/**
20 changes: 0 additions & 20 deletions BlockchainDLib/src/main/scala/tcs/examples/Main.scala

This file was deleted.

File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions queries/details.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Case study, Size (GB), Creation time (h), Query time (s), Updated to
Basic view of the blockchain, 300, 9, 2860, 2017-06-27
\opreturn metadata, 0.5, 2, 0.5, 2017-06-27
Exchange rates, 30, 15, 477, 2017-06-27
Transaction fees, 23, 35, 448, 2017-06-27
Address tags, 0.8, 10, 1.8, 2017-06-27
7 changes: 7 additions & 0 deletions queries/exchange.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
0-300,32.8493401875896
300-600,15.279544797252
600-900,9.64042220938312
900-1200,9.19924984277733
1200-1500,7.75422467828595
1500-1800,9.2913426492978
1800-2100,10.4874137955854
36 changes: 36 additions & 0 deletions queries/exchange.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
db.txWithRates.aggregate([
{
$project: {
"outputSum" : 1,
"range": {
$concat: [
{ $cond: [{$and:[ {$gte:["$rate", 0 ]}, {$lt: ["$rate", 300]}]}, "0-300", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 300 ]}, {$lt: ["$rate", 600]}]}, "300-600", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 600 ]}, {$lt: ["$rate", 900]}]}, "600-900", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 900 ]}, {$lt: ["$rate", 1200]}]}, "900-1200", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 1200 ]}, {$lt: ["$rate", 1500]}]}, "1200-1500", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 1500 ]}, {$lt: ["$rate", 1800]}]}, "1500-1800", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 1800 ]}, {$lt: ["$rate", 2100]}]}, "1800-2100", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 2100 ]}, {$lt: ["$rate", 2400]}]}, "2100-2400", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 2400 ]}, {$lt: ["$rate", 2700]}]}, "2400-2700", ""] },
{ $cond: [{$and:[ {$gte:["$rate", 2700 ]}, {$lt: ["$rate", 3000]}]}, "2700-3000", ""] }
]
}
}
},
{
$group: {
"_id" : "$range",
count: {
$sum: 1
},
sumOut: { $sum: "$outputSum" },
}
},
{
$project : {
_id: 1,
avgOut: { $divide: [ "$sumOut", "$count" ] }
}
}
]);
9 changes: 9 additions & 0 deletions queries/generateQuery2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
n_ranges = 10
max_value = 3000

for i in xrange(n_ranges):
min = max_value/n_ranges * i
max = max_value/n_ranges * (i+1)
print '{ $cond: [{$and:[ {$gte:["$rate", ' + str(min) + ' ]}, {$lt: ["$rate", ' + str(max) + ']}]}, "' + str(min) + "-" + str(max) + '", ""] },'


Loading

0 comments on commit 99bb78a

Please sign in to comment.