当前位置: 首页>>代码示例>>Java>>正文


Java TupleFactory类代码示例

本文整理汇总了Java中nl.vu.cs.ajira.data.types.TupleFactory的典型用法代码示例。如果您正苦于以下问题:Java TupleFactory类的具体用法?Java TupleFactory怎么用?Java TupleFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TupleFactory类属于nl.vu.cs.ajira.data.types包,在下文中一共展示了TupleFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: applyTo

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public static final void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		ActionSequence actions) throws ActionNotConfiguredException {
	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	c = ActionFactory.getActionConf(QSQBCAlgo.class);
	actions.add(c);

	actions.add(ActionFactory.getActionConf(QSQRemoveLastTerm.class));
	
	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName());
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:23,代码来源:QSQBCAlgo.java

示例2: generateTuples

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
private List<Tuple> generateTuples(int numTuples, int minValue,
		int maxValue, Random r, List<String> attributes) {
	List<Tuple> result = new ArrayList<Tuple>();
	int tupleSize = attributes.size() * 2;
	for (int i = 0; i < numTuples; i++) {
		SimpleData[] data = new SimpleData[tupleSize];
		int pos = 0;
		for (String attr : attributes) {
			data[pos++] = new TString(attr);
			data[pos++] = new TInt(minValue
					+ r.nextInt(maxValue - minValue));
		}
		result.add(TupleFactory.newTuple(data));
	}
	return result;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:17,代码来源:RandomGeneratorInputLayer.java

示例3: GroupIterator

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public GroupIterator(TupleIterator itr, Tuple inputTuple,
		SimpleData[] key, int sizeKey, ActionContext context)
		throws Exception {
	this.itr = itr;
	this.key = key;
	this.sizeKey = sizeKey;
	this.inputTuple = inputTuple;
	this.context = context;

	// The values are a copy of the current tuple
	this.sValues = new SimpleData[inputTuple.getNElements() - sizeKey];
	for (int i = 0; i < sValues.length; ++i) {
		sValues[i] = DataProvider.get().get(
				inputTuple.get(sizeKey + i).getIdDatatype());
	}
	this.outputTuple = TupleFactory.newTuple(sValues);

	this.moreGroups = true;

	for (int i = 0; i < sizeKey; ++i) {
		key[i] = DataProvider.get().get(
				inputTuple.get(i).getIdDatatype());
	}
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:25,代码来源:GroupBy.java

示例4: startProcess

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
@Override
public void startProcess(ActionContext context) throws Exception {
	tl1 = new TLong();
	tl2 = new TLong();
	tl3 = new TLong();
	step = new TInt();
	count = new TInt();
	previousTuple = TupleFactory.newTuple(tl1, tl2, tl3);
	outputTuple = new SimpleData[5];
	for (int i = 0; i < 3; ++i) {
		outputTuple[i] = previousTuple.get(i);
	}
	outputTuple[3] = step;
	outputTuple[4] = count;
	currentCount = 0;
	minStep = Integer.MAX_VALUE;
	stepToCount = getParamInt(I_MIN_STEP);
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:19,代码来源:AddDerivationCount.java

示例5: Tuples

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public Tuples(List<Tuple> tuples, int tuplesLength, List<Integer> steps) {
	this.tuplesLength = tuplesLength;
	rows = new ArrayList<Row>();
	for (int i = 0; i < tuples.size(); ++i) {
		Tuple t = tuples.get(i);
		TLong[] signature = new TLong[tuplesLength];
		for (int j = 0; j < tuplesLength; ++j) {
			signature[j] = new TLong();
		}
		Tuple resultTuple = TupleFactory.newTuple(signature);
		for (int j = 0; j < tuplesLength; j++) {
			SimpleData data = t.get(j);
			resultTuple.set(data, j);
		}
		int step = steps.get(i);
		rows.add(new Row(step, resultTuple));
	}
}
 
开发者ID:jrbn,项目名称:dynamite,代码行数:19,代码来源:Tuples.java

示例6: applyTo

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public static void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		boolean explicit, int typeRules, long iteration,
		ActionSequence actions) throws ActionNotConfiguredException {

	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, explicit);
	c.setParamInt(ExpandQuery.I_TYPE_RULES, typeRules);
	actions.add(c);

	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	c.setParamBoolean(CollectToNode.B_SORT, true);
	actions.add(c);

	actions.add(ActionFactory.getActionConf(RemoveDuplicates.class));

	c = ActionFactory.getActionConf(OptimalBCAlgo.class);
	c.setParamLong(OptimalBCAlgo.L_FIELD1, v1.getValue());
	c.setParamLong(OptimalBCAlgo.L_FIELD2, v2.getValue());
	c.setParamLong(OptimalBCAlgo.L_FIELD3, v3.getValue());
	c.setParamBoolean(OptimalBCAlgo.B_EXPLICIT, explicit);
	c.setParamLong(OptimalBCAlgo.L_ITERATION, iteration);
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:36,代码来源:OptimalBCAlgo.java

示例7: reloadRulesOnOtherNodes

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
private void reloadRulesOnOtherNodes(ActionOutput output, String newList)
		throws Exception {

	if (log.isDebugEnabled()) {
		log.debug("reloadRulesOnOtherNodes");
	}
	ActionSequence sequence = new ActionSequence();

	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			RDFStorage.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					new RDFTerm(Schema.CLOSURE_BROADCASTFLAG), new RDFTerm(
							0), new RDFTerm(0), new TInt(0))));
	sequence.add(c);

	// Action which reloads the rules and sends nothing
	c = ActionFactory.getActionConf(ReloadRules.class);
	c.setParamString(ReloadRules.S_FILE, newList);
	sequence.add(c);

	// CollectToNode
	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			TLong.class.getName());
	sequence.add(c);

	// Action that increase the lock in the stopProcess
	sequence.add(ActionFactory.getActionConf(IncreaseLock.class));

	output.branch(sequence);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:35,代码来源:CalculateClosure.java

示例8: applyTo

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public static void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		boolean explicit, ActionSequence actions)
				throws ActionNotConfiguredException {

	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, explicit);
	c.setParamBoolean(ExpandQuery.B_FORCERESTART, true);
	actions.add(c);

	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	actions.add(c);

	// AddIntermediateTriples.applyTo(v1.getValue(), v2.getValue(),
	// v3.getValue(), actions);

	c = ActionFactory.getActionConf(RuleBCAlgo.class);
	c.setParamLong(L_FIELD1, v1.getValue());
	c.setParamLong(L_FIELD2, v2.getValue());
	c.setParamLong(L_FIELD3, v3.getValue());
	c.setParamBoolean(B_EXPLICIT, explicit);
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:35,代码来源:RuleBCAlgo.java

示例9: applyTo

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public static final void applyTo(RDFTerm v1, RDFTerm v2, RDFTerm v3,
		int posSet, long nameSet, ActionSequence actions)
				throws ActionNotConfiguredException {

	// Get the query
	ActionConf c = ActionFactory.getActionConf(QueryInputLayer.class);
	c.setParamString(QueryInputLayer.S_INPUTLAYER,
			DummyLayer.class.getName());
	c.setParamWritable(
			QueryInputLayer.W_QUERY,
			new nl.vu.cs.ajira.actions.support.Query(TupleFactory.newTuple(
					v1, v2, v3, new TInt(0))));
	actions.add(c);

	// Expand it in incremental fashion
	c = ActionFactory.getActionConf(ExpandQuery.class);
	c.setParamBoolean(ExpandQuery.B_EXPLICIT, true);
	c.setParamInt(ExpandQuery.I_TYPE_RULES, TreeExpander.ONLY_FIRST_SECOND);
	c.setParamBoolean(ExpandQuery.B_ALLOWRECURSION, false);
	actions.add(c);

	// Collect to node
	c = ActionFactory.getActionConf(CollectToNode.class);
	c.setParamStringArray(CollectToNode.SA_TUPLE_FIELDS,
			RDFTerm.class.getName(), RDFTerm.class.getName(),
			RDFTerm.class.getName(), TBoolean.class.getName());
	actions.add(c);

	// Check whether we should repeat the process
	c = ActionFactory.getActionConf(IncrRuleBCAlgo.class);
	c.setParamLong(L_NAMESET, nameSet);
	c.setParamInt(I_POSSET, posSet);
	c.setParamLong(L_FIELD1, v1.getValue());
	c.setParamLong(L_FIELD2, v2.getValue());
	c.setParamLong(L_FIELD3, v3.getValue());
	actions.add(c);
}
 
开发者ID:jrbn,项目名称:querypie,代码行数:38,代码来源:IncrRuleBCAlgo.java

示例10: WritableTuple

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
/**
 * Copying constructor.
 */
public WritableTuple(WritableTuple w) {
	shouldSort = w.shouldSort;
	fieldsToSort = w.fieldsToSort;
	otherFields = w.otherFields;
	nFields = w.nFields;
	tuple = TupleFactory.newTuple();
	if (w.lengths != null) {
		lengths = new int[w.lengths.length];
	}
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:14,代码来源:WritableTuple.java

示例11: getSpot

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
private synchronized void getSpot() {
	while (bufferFull()) {
		try {
			wait();
		} catch (InterruptedException e) {
			// ignore
		}
	}
	if (head == tail) {
		notify();
	}
	if (data[tail] == null) {
		data[tail] = TupleFactory.newTuple();
	}
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:16,代码来源:ChainSplitLayer.java

示例12: emitCurrentWindowCounts

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
private final void emitCurrentWindowCounts(ActionOutput output)
		throws Exception {
	lastModifiedTracker.markAsModified();
	Map<String, Long> counts = counter.getCountsThenAdvanceWindow();
	for (Entry<String, Long> entry : counts.entrySet()) {
		String str = entry.getKey();
		Long count = entry.getValue();
		Tuple tuple = TupleFactory.newTuple(new TString(str), new TLong(
				count));
		output.output(tuple);
	}
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:13,代码来源:RollingCountAction.java

示例13: project

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public Tuple project(Tuple tuple) throws AttributeNotFoundException {
  if (first) {
    determineAttributesPositions(tuple);
    first = false;
  }
  int pos = 0;
  for (Integer i : attributesPositions) {
    data[pos++] = tuple.get(i);
    data[pos++] = tuple.get(i + 1);
  }
  return TupleFactory.newTuple(data);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:13,代码来源:Projector.java

示例14: StreamTuple

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public StreamTuple(LinkedHashMap<String, SimpleData> attributes) {
  int numElements = attributes.size() * 2;
  SimpleData[] data = new SimpleData[numElements];
  int pos = 0;
  for (String name : attributes.keySet()) {
    data[pos++] = new TString(name);
    data[pos++] = attributes.get(name);
  }
  tuple = TupleFactory.newTuple(data);
  this.attributes = attributes;
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:12,代码来源:StreamTuple.java

示例15: getTuple

import nl.vu.cs.ajira.data.types.TupleFactory; //导入依赖的package包/类
public static final Tuple getTuple(byte[] bytes) {
  int pos = 0;
  int numElements = bytes[pos++];
  SimpleData[] data = new SimpleData[numElements];
  for (int i = 0; i < numElements; i++) {
    byte type = bytes[pos++];
    switch (type) {
    case INT:
      data[i] = getInt(bytes, pos);
      pos += 4;
      break;
    case LONG:
      data[i] = getLong(bytes, pos);
      pos += 8;
      break;
    case STRING:
      int stringLen = bytes[pos++];
      data[i] = getString(bytes, pos, stringLen);
      pos += stringLen;
      break;
    case BOOLEAN:
      data[i] = getBoolean(bytes, pos);
      pos++;
      break;
    }
  }
  return TupleFactory.newTuple(data);
}
 
开发者ID:jrbn,项目名称:ajira,代码行数:29,代码来源:TupleSerializer.java


注:本文中的nl.vu.cs.ajira.data.types.TupleFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。