Package lupos.datastructures.bindings

Examples of lupos.datastructures.bindings.BindingsFactory


    // used threads to set up the initial plans
    final LinkedList<Thread> intialPlansThreads = new LinkedList<Thread>();
    // TODO check if we still need to use BindingsArrayReadTriples!
    final Class<? extends Bindings> classBindings = Bindings.instanceClass;
    Bindings.instanceClass = BindingsArrayReadTriples.class;
    final BindingsFactory bindingsFactoryOld = indexScan.getBindingsFactory();
    // determine all join partners of the triple partners
    // afterwards only generate histograms for the join partners
    // For this purpose, first count the occurrences of the variables in the triple patterns
    final HashMap<Variable, Integer> countVarOccurence = new HashMap<Variable, Integer>();
    for (final TriplePattern tp : triplePatterns) {
View Full Code Here


      LiteralFactory.setTypeWithoutInitializing(MapType.NOCODEMAP);
     
     
      final int instance = instanceCounter.incrementAndGet();
      if (bindings != null) Bindings.instanceClass = bindings;
      BindingsFactory bf = BindingsFactory.createBindingsFactory();
     
     
     
      String debugString = "\n";
      debugString += (String.format("Creating new P2P query client instance: %d \n",instance));
View Full Code Here

  public final static Bindings readLuposBindings(final Bindings previousBindings, final InputStream in) throws IOException, ClassNotFoundException {
    if (Bindings.instanceClass == BindingsMap.class) {
      return InputHelper.readLuposBindingsMap(in);
    } else {
      final BindingsFactory bindingsFactory = (previousBindings==null) ? readLuposBindingsFactory(in) : ((BindingsArray) previousBindings).getBindingsFactory();
      final Map<Variable, Integer> hm = bindingsFactory.getPosVariables();
      BigInteger usedVars = InputHelper.readLuposBigInteger(hm.size(), in);
      if (usedVars == null) {
        return null;
      }
      BigInteger differentFromPreviousBindings = InputHelper.readLuposBigInteger(hm.size(), in);
      final Bindings b = bindingsFactory.createInstance();
      final BigInteger TWO = BigInteger.valueOf(2);
      for (final Variable v : hm.keySet()) {
        if (usedVars.mod(TWO).compareTo(BigInteger.ONE)==0) {
          if (previousBindings == null || differentFromPreviousBindings.mod(TWO).compareTo(BigInteger.ONE)==0) {
            Literal lit;
View Full Code Here

  public final static Bindings readLuposBindings(final InputStream in) throws IOException, ClassNotFoundException {
    if (Bindings.instanceClass == BindingsMap.class) {
      return InputHelper.readLuposBindingsMap(in);
    } else {
      final BindingsFactory bindingsFactory = readLuposBindingsFactory(in);
      final Map<Variable, Integer> hm = bindingsFactory.getPosVariables();
      BigInteger usedVars = InputHelper.readLuposBigInteger(hm.size(), in);
      if (usedVars == null) {
        return null;
      }
      final Bindings b = bindingsFactory.createInstance();
      final BigInteger TWO = BigInteger.valueOf(2);
      for (final Variable v : hm.keySet()) {
        if (usedVars.mod(TWO).compareTo(BigInteger.ONE)==0) {
          final Literal lit = InputHelper.readLuposLiteral(in);
          b.add(v, lit);
View Full Code Here

        instanceClass = Bindings.instanceClass;
        Bindings.instanceClass = BindingsArray.class;
      }
    }

    final BindingsFactory bindingsFactory= BindingsFactory.createBindingsFactory(CommonCoreQueryEvaluator.getAllVariablesOfQuery(root));
    root.sendMessage(new BindingsFactoryMessage(bindingsFactory));

    // evaluate subgraph!
    root.sendMessage(new StartOfEvaluationMessage());
    root.startProcessing();
View Full Code Here

    final Collection<Variable> vars = Helper.createVariablesFromJSON(json);
    final TriplePattern tp = Helper.createTriplePatternFromJSON(json);
    final Collection<TriplePattern> tps = new LinkedList<TriplePattern>();
    tps.add(tp);
    final BasicIndexScan indexScan = operatorCreator.createIndexScan(operatorCreator.createRoot(dataset), tps);
    final BindingsFactory bindingsFactory = BindingsFactory.createBindingsFactory(tp.getVariables());
    indexScan.setBindingsFactory(bindingsFactory);
    tp.setBindingsFactory(bindingsFactory);

    return indexScan.getMinMax(tp, vars);
  }
View Full Code Here

    final Map<Variable, Literal> minima = Helper.createMapFromJSON(json.getJSONObject("minima"));
    final Map<Variable, Literal> maxima = Helper.createMapFromJSON(json.getJSONObject("maxima"));
    final Collection<TriplePattern> tps = new LinkedList<TriplePattern>();
    tps.add(tp);
    final BasicIndexScan indexScan = operatorCreator.createIndexScan(operatorCreator.createRoot(dataset), tps);
    final BindingsFactory bindingsFactory = BindingsFactory.createBindingsFactory(tp.getVariables());
    indexScan.setBindingsFactory(bindingsFactory);
    tp.setBindingsFactory(bindingsFactory);

    return indexScan.getVarBuckets(tp, Bindings.instanceClass, vars, minima, maxima);
  }
View Full Code Here

    //MoveFilter to SubgraphContainer rule
    final AfterPhysicalOptimizationDistributedRulePackage refie = new AfterPhysicalOptimizationDistributedRulePackage();
    refie.applyRules(root);

    // evaluate subgraph!
    final BindingsFactory bindingsFactory= BindingsFactory.createBindingsFactory(CommonCoreQueryEvaluator.getAllVariablesOfQuery(root));
    root.sendMessage(new BindingsFactoryMessage(bindingsFactory));

    root.sendMessage(new StartOfEvaluationMessage());
    root.startProcessing();
    root.sendMessage(new EndOfEvaluationMessage());
View Full Code Here

  public QueryResult getQueryResult() {
    if(Bindings.instanceClass!=BindingsMap.class){
      throw new RuntimeException("The configuration shouldbe set to BindingsMap, but found "+Bindings.instanceClass);
    }
    final BindingsFactory bindingsFactory = BindingsFactory.createBindingsFactory();
    final ByteArrayInputStream bais = new ByteArrayInputStream(this.serialized);
    return SerializedQueryResult.formatReader.getQueryResult(bais, bindingsFactory);
  }
View Full Code Here

TOP

Related Classes of lupos.datastructures.bindings.BindingsFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.