本文整理汇总了Java中nl.vu.cs.ajira.actions.support.Query类的典型用法代码示例。如果您正苦于以下问题:Java Query类的具体用法?Java Query怎么用?Java Query使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Query类属于nl.vu.cs.ajira.actions.support包,在下文中一共展示了Query类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResultsQuery
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
public static ActionSequence getResultsQuery(ActionSequence chain,
Tuple tuple, boolean converge) throws ActionNotConfiguredException {
// Get the pattern
Query q = new Query(tuple);
ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
c.setParamWritable(QueryInputLayer.W_QUERY, q);
c.setParamString(QueryInputLayer.S_INPUTLAYER,
QueryInputLayer.DEFAULT_LAYER);
chain.add(c);
if (converge) {
c = ActionFactory.getActionConf(CollectToNode.class);
c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
RDFTerm.class.getName(), RDFTerm.class.getName(),
RDFTerm.class.getName());
c.setParamBoolean(CollectToNode.B_SORT, true);
chain.add(c);
chain.add(ActionFactory.getActionConf(RemoveDuplicates.class));
}
return chain;
}
示例2: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context)
throws Exception {
query.setInputLayer(RandomGeneratorInputLayer.class);
String[] attributes = ((TStringArray) params[SA_ATTRIBUTES])
.getArray();
SimpleData[] data = new SimpleData[6 + attributes.length];
data[0] = new TInt((Integer) params[I_ID]);
data[1] = new TInt((Integer) params[I_NUM_THREADS]);
data[2] = new TInt((Integer) params[I_NUM_TUPLES]);
data[3] = new TInt((Integer) params[I_ATTR_MIN_VAL]);
data[4] = new TInt((Integer) params[I_ATTR_MAX_VAL]);
data[5] = new TInt((Integer) params[I_RANDOM_SEED]);
for (int i = 0; i < attributes.length; i++) {
data[6 + i] = new TString(attributes[i]);
}
Query q = new Query(data);
query.setQuery(q);
controller.doNotAddCurrentAction();
}
示例3: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context) {
int[] nodeIds = null;
if (params[IA_NODE_IDS] == null) {
nodeIds = new int[1];
nodeIds[0] = -1;
params[IA_NODE_IDS] = nodeIds;
} else {
nodeIds = ((TIntArray) params[IA_NODE_IDS]).getArray();
}
int[] bucketIds = ((TIntArray) params[IA_BUCKET_IDS]).getArray();
if (nodeIds.length == 1) {
query.setInputLayer(BucketsLayer.class);
query.setQuery(new Query(new TInt(bucketIds[0]), new TInt(
nodeIds[0])));
controller.doNotAddCurrentAction();
} else {
// In this case, I need to fire more chains with a branch
query.setInputLayer(DummyLayer.class);
query.setQuery(new Query(new TInt(0)));
}
}
示例4: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context)
throws Exception {
query.setInputLayer(RandomGeneratorInputLayer.class);
SimpleData[] data = new SimpleData[5];
data[0] = new TInt((Integer) params[I_NUM_TUPLES]);
data[1] = new TInt((Integer) params[I_NUM_DISTINCT_PHRASES]);
data[2] = new TInt((Integer) params[I_NUM_WORDS_PER_PHRASE]);
data[3] = new TInt((Integer) params[I_NUM_DISTINCT_WORDS]);
data[4] = new TInt((Integer) params[I_RANDOM_SEED]);
Query q = new Query(data);
query.setQuery(q);
controller.doNotAddCurrentAction();
}
示例5: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context)
throws Exception {
query.setInputLayer(RandomGeneratorInputLayer.class);
SimpleData[] data = new SimpleData[3];
data[0] = new TInt((Integer) params[I_NUM_TUPLES]);
data[1] = new TInt((Integer) params[I_NUM_DISTINCT_WORDS]);
data[2] = new TInt((Integer) params[I_RANDOM_SEED]);
Query q = new Query(data);
query.setQuery(q);
controller.doNotAddCurrentAction();
}
示例6: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context)
throws Exception {
query.setInputLayer(RandomGeneratorInputLayer.class);
Query q = new Query(new TInt((Integer) params[I_ID]), new TInt(
(Integer) params[I_THREAD_ID]));
query.setQuery(q);
controller.doNotAddCurrentAction();
}
示例7: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context)
throws Exception {
query.setInputLayer(RandomInputLayer.class);
int num = (Integer) params[NUM];
Query q = new Query(new TInt(num));
query.setQuery(q);
controller.doNotAddCurrentAction();
}
示例8: setupAction
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setupAction(InputQuery query, Object[] params,
ActionController controller, ActionContext context) {
if (params[S_PATH] != null) {
query.setInputLayer(FileLayer.class);
query.setQuery(new Query(new TInt(FileLayer.OP_LS),
new TString((String) params[S_PATH]), new TString(
(String) params[S_FILE_FILTER])));
}
}
示例9: processSplit
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
private void processSplit(ActionContext context, ActionOutput output)
throws Exception {
if (baseSplit == null) {
synchronized(this.getClass()) {
baseSplit = "split" + splitCounter++ + "-";
}
}
String key = baseSplit + splitId++;
context.putObjectInCache(key, currentFileSplit);
Tuple tuple = TupleFactory.newTuple();
if (customReader == null) {
tuple.set(new TInt(FileLayer.OP_READ), new TString(key), new TInt(
context.getMyNodeId()));
} else {
tuple.set(new TInt(FileLayer.OP_READ), new TString(key), new TInt(
context.getMyNodeId()), new TString(customReader));
}
ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
c.setParamString(QueryInputLayer.S_INPUTLAYER,
FileLayer.class.getName());
c.setParamWritable(QueryInputLayer.W_QUERY, new Query(tuple));
output.branch(new ActionSequence(c));
currentFileSplit = new FileCollection();
}
示例10: readEverythingFromBTree
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
public static void readEverythingFromBTree(ActionSequence actions)
throws ActionNotConfiguredException {
ActionConf c = ActionFactory.getActionConf(ReadFromBtree.class);
c.setParamInt(ReadFromBtree.I_PARALLEL_TASKS,
nl.vu.cs.dynamite.reasoner.support.Consts.READ_NUM_THREADS);
c.setParamWritable(ReadFromBtree.W_TUPLE, new Query(new TLong(-1),
new TLong(-1), new TLong(-1)));
actions.add(c);
}
示例11: readFakeTuple
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
public static void readFakeTuple(ActionSequence actions)
throws ActionNotConfiguredException {
ActionConf a = ActionFactory.getActionConf(QueryInputLayer.class);
a.setParamString(QueryInputLayer.S_INPUTLAYER,
DummyLayer.class.getName());
a.setParamWritable(QueryInputLayer.W_QUERY, new Query());
actions.add(a);
}
示例12: readFakeTuple
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
public static void readFakeTuple(ActionSequence actions) throws ActionNotConfiguredException {
ActionConf a = ActionFactory.getActionConf(QueryInputLayer.class);
a.setParamString(QueryInputLayer.S_INPUTLAYER, DummyLayer.class.getName());
a.setParamWritable(QueryInputLayer.W_QUERY, new Query());
actions.add(a);
}
示例13: setQuery
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void setQuery(Query query) {
query.getTuple().copyTo(this.tuple);
}
示例14: getQuery
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void getQuery(Query query) {
tuple.copyTo(query.getTuple());
}
示例15: run
import nl.vu.cs.ajira.actions.support.Query; //导入依赖的package包/类
@Override
public void run() {
Query query = new Query();
Chain chain = new Chain();
Chain supportChain = new Chain();
while (true) {
WriteMessage msg = null;
try {
chainsToSend.remove(chain);
ChainExecutor ac = new ChainExecutor(null, context, chain);
chain.getQuery(query);
Location loc = context.getInputLayer(chain.getInputLayer())
.getLocations(query.getTuple(), ac);
NetworkLayer ibis = context.getNetworkLayer();
IbisIdentifier[] nodes = ibis.getPeersLocation(loc);
if (nodes.length == 0) { // Put it directly in the queue
chainsToProcess.add(chain);
} else { // Send the chains
int i = nodes.length - 1;
while (i != 0) {
chain.branch(supportChain, context
.getChainCounter(chain.getSubmissionId()), 0);
if (nodes[i].compareTo(ibis.clusterIbis.identifier()) == 0) {
chainsToProcess.add(supportChain);
} else {
msg = ibis.getMessageToSend(nodes[i],
NetworkLayer.nameMgmtReceiverPort);
msg.writeByte((byte) 0);
supportChain.writeTo(new WriteMessageWrapper(msg));
ibis.finishMessage(msg,
supportChain.getSubmissionId());
msg = null;
}
i--;
}
if (nodes[0].compareTo(ibis.clusterIbis.identifier()) == 0) {
chainsToProcess.add(chain);
} else {
msg = ibis.getMessageToSend(nodes[0],
NetworkLayer.nameMgmtReceiverPort);
msg.writeByte((byte) 0);
chain.writeTo(new WriteMessageWrapper(msg));
ibis.finishMessage(msg, chain.getSubmissionId());
msg = null;
}
}
} catch (Throwable e) {
if (msg != null && e instanceof IOException) {
msg.finish((IOException) e);
}
if (log.isDebugEnabled()) {
log.debug(
"Error in the main execution of the communicator thread",
e);
}
context.killSubmission(chain.getSubmissionNode(),
chain.getSubmissionId(), e);
}
}
}