Skip to content

Commit b8626b9

Browse files
committed
Add operations to increase counter of tripletype and rule during
reasoning
1 parent 43fb05b commit b8626b9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

mrj-0.1/src/cn/edu/neu/mitt/mrj/io/dbs/CassandraDB.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import com.datastax.driver.core.querybuilder.QueryBuilder;
6464

6565

66+
6667
//modified
6768
import org.apache.cassandra.thrift.CassandraServer;
6869

@@ -414,7 +415,7 @@ public void increaseTripletypeCounter(int field)
414415
args.add(ByteBufferUtil.bytes(field));
415416
CqlPreparedResult p_result = client.prepare_cql3_query(ByteBufferUtil.bytes(query), Compression.NONE);
416417
CqlResult result = client.execute_prepared_cql3_query(p_result.itemId, args, ConsistencyLevel.ONE);
417-
logger.info("Increase TripletypeCounter of " + field + ": " + result.getNum());
418+
// logger.info("Increase TripletypeCounter of " + field + ": " + result.getNum());
418419
}
419420

420421
public static Triple readJustificationFromMapReduceRow(Row row){
@@ -481,6 +482,19 @@ public static void writeJustificationToMapReduceContext(
481482
variables.add(ByteBufferUtil.bytes(source.getStep())); // It corresponds to COLUMN_INFERRED_STEPS where steps = 0 means an original triple
482483
context.write(keys, variables);
483484

485+
// Added by WuGang, 2015-06-03
486+
try{
487+
CassandraDB db = new CassandraDB();
488+
db.increaseTripletypeCounter(tripletype);
489+
db.increaseRuleCounter((int)triple.getType());
490+
db.close();
491+
}catch (TTransportException e) {
492+
e.printStackTrace();
493+
} catch (InvalidRequestException e) {
494+
e.printStackTrace();
495+
} catch (TException e) {
496+
e.printStackTrace();
497+
}
484498
}
485499

486500
public boolean loadSetIntoMemory(Set<Long> schemaTriples, Set<Integer> filters, int previousStep) throws IOException, InvalidRequestException, UnavailableException, TimedOutException, SchemaDisagreementException, TException {

0 commit comments

Comments
 (0)