Examples of Indices


Examples of cc.redberry.core.indices.Indices

        return set;
    }

    private static void getAllIndicesT1(ParseToken node, TIntSet set) {
        if (node instanceof ParseTokenSimpleTensor) {
            Indices indices = node.getIndices();
            for (int i = indices.size() - 1; i >= 0; --i)
                set.add(IndicesUtils.getNameWithType(indices.get(i)));
        } else
            for (ParseToken pn : node.content)
                if (!(pn instanceof ParseTokenScalarFunction))
                    getAllIndicesT1(pn, set);
    }
View Full Code Here

Examples of cc.redberry.core.indices.Indices

        }

        int tensorIndex;
        for (tensorIndex = 0; tensorIndex < data.length; ++tensorIndex) {
            //Main algorithm
            Indices tInds = data[tensorIndex].getIndices();
            short[] diffIds = tInds.getDiffIds();

            //FUTURE move to other place
            if (tInds.size() >= 0x10000)
                throw new RuntimeException("Too many indices!!! max count = 2^16");

            for (i = 0; i < tInds.size(); ++i) {
                index = tInds.get(i);
                state = IndicesUtils.getStateInt(index);
                info[state][pointer[state]] = packToLong(tensorIndex, diffIds[i], i);
                indices[state][pointer[state]++] = IndicesUtils.getNameWithType(index);
            }

            //Result allocation
            contractions[tensorIndex] = new long[tInds.size()];
        }

        //Here we can use unstable sorting algorithm (all indices are different)
        ArraysUtils.quickSort(indices[0], info[0]);
        ArraysUtils.quickSort(indices[1], info[1]);
View Full Code Here

Examples of cc.redberry.core.indices.Indices

        appendAllIndicesNamesT(tensor, set, true);
    }

    private static void appendAllIndicesNamesT(Tensor tensor, TIntHashSet set, boolean includeScalarFunctions) {
        if (tensor instanceof SimpleTensor) {
            Indices ind = tensor.getIndices();
            set.ensureCapacity(ind.size());
            final int size = ind.size();
            for (int i = 0; i < size; ++i)
                set.add(IndicesUtils.getNameWithType(ind.get(i)));
        } else if (tensor instanceof Power) {
            appendAllIndicesNamesT(tensor.get(0), set);
        } else if (tensor instanceof ScalarFunction && !includeScalarFunctions)
            return;
        else {
View Full Code Here

Examples of cc.redberry.core.indices.Indices

        assertIndicesConsistency(t, new TIntHashSet());
    }

    private static void assertIndicesConsistency(Tensor t, TIntHashSet indices) {
        if (t instanceof SimpleTensor) {
            Indices ind = t.getIndices();
            for (int i = ind.size() - 1; i >= 0; --i)
                if (indices.contains(ind.get(i)))
                    throw new AssertionError(new InconsistentIndicesException(ind.get(i)));
                else
                    indices.add(ind.get(i));
        }
        if (t instanceof Product)
            for (int i = t.size() - 1; i >= 0; --i)
                assertIndicesConsistency(t.get(i), indices);
        if (t instanceof Sum) {
View Full Code Here

Examples of cc.redberry.core.indices.Indices

                assertIndicesConsistency(c, new TIntHashSet(indices));
    }

    private static void appendAllIndicesT(Tensor tensor, TIntHashSet set) {
        if (tensor instanceof SimpleTensor) {
            Indices ind = tensor.getIndices();
            final int size = ind.size();
            for (int i = 0; i < size; ++i)
                set.add(ind.get(i));
        } else if (tensor instanceof Power) {
            appendAllIndicesT(tensor.get(0), set);
        } else {
            Tensor t;
            for (int i = tensor.size() - 1; i >= 0; --i) {
View Full Code Here

Examples of cc.redberry.core.indices.Indices


        //Processing data with indices
        int i;
        ProductContent content;
        Indices indices;
        Tensor[] data = dataContainer.list.toArray(new Tensor[dataContainer.list.size()]);
        if (dataContainer.count == 1) {
            content = dataContainer.content;
            indices = dataContainer.indices;
            if (indices == null) {
View Full Code Here

Examples of lupos.engine.operators.index.Indices

//      };
//
//      new GenerateIDTriplesUsingStringSearch2(rdfURL, dataFormat,
//          interTripleConsumer);

      final Indices indices = new SixIndices(defaultGraphs.iterator().next());
      new GenerateIDTriplesUsingStringSearch2(defaultGraphs, dataFormat, indices);

      // write out index info

      final OutputStream out = new BufferedOutputStream(new FileOutputStream(writeindexinfo));
      indices.constructCompletely();

      OutHelper.writeLuposInt(lupos.datastructures.paged_dbbptree.DBBPTree.getCurrentFileID(), out);

      ((lupos.datastructures.paged_dbbptree.DBBPTree) ((StringIntegerMapJava) LazyLiteral.getHm()).getOriginalMap()).writeLuposObject(out);
      ((StringArray) LazyLiteral.getV()).writeLuposStringArray(out);
      OutHelper.writeLuposInt(1, out);
      LiteralFactory.writeLuposLiteral(defaultGraphs.iterator().next(), out);
      indices.writeIndexInfo(out);
      OutHelper.writeLuposInt(0, out);
      out.close();
      final Date end = new Date();
      log.debug("_______________________________________________________________");
      log.info("Done, RDF3X index constructed!");
View Full Code Here

Examples of lupos.engine.operators.index.Indices

      final URILiteral defaultGraph = new StringURILiteral("<http://localhost/default>");
      // just for inserting it into the codemap:
      defaultGraph.createThisLiteralNew();

      final Indices indices = new SixIndices(defaultGraph, true);

      // write out index info

      final OutputStream out = new BufferedOutputStream(new FileOutputStream(writeindexinfo));
      indices.constructCompletely();
      BufferManager.getBufferManager().writeAllModifiedPages();

      OutHelper.writeLuposInt(lupos.datastructures.paged_dbbptree.DBBPTree.getCurrentFileID(), out);

      ((lupos.datastructures.paged_dbbptree.DBBPTree) ((StringIntegerMapJava) LazyLiteral.getHm()).getOriginalMap()).writeLuposObject(out);
      ((StringArray) LazyLiteral.getV()).writeLuposStringArray(out);
      OutHelper.writeLuposInt(1, out);
      LiteralFactory.writeLuposLiteral(defaultGraph, out);
      indices.writeIndexInfo(out);
      OutHelper.writeLuposInt(0, out);
      out.close();
      final Date end = new Date();
      log.debug("_______________________________________________________________");
      log.info("Done, RDF3X index constructed!");
View Full Code Here

Examples of lupos.engine.operators.index.Indices

              // Convert the named graphs' names into URILiterals
              // to be applicable
              // later on
              for (final String name : this.root.namedGraphs) {

                final Indices indices = this.root.dataset
                    .getNamedGraphIndices(LiteralFactory
                        .createURILiteralWithoutLazyLiteral(name));

                final URILiteral rdfName = indices.getRdfName();
                if (namedGraphs.contains(rdfName)) {
                  final TriplePattern ztp = new TriplePattern(
                      graphConstraint
                          .equals(tp.getPos(0)) ? rdfName
                          : tp.getPos(0),
                      graphConstraint
                          .equals(tp.getPos(1)) ? rdfName
                          : tp.getPos(1),
                      graphConstraint
                          .equals(tp.getPos(2)) ? rdfName
                          : tp.getPos(2));
                  final Triple zkey = getKey(ztp, null);
                  final Literal intermediateMax = this.getMaxLiteral(
                      (SixIndices) indices, zkey, pos);
                  if (intermediateMax != null
                      && (max == null || max
                          .compareToNotNecessarilySPARQLSpecificationConform(intermediateMax) < 0)) {
                    max = intermediateMax;
                  }
                }

              }

            }

            // otherwise there might have been named graphs added
            // during the evaluation
            else {

              // get all indices of named graphs and bind them to
              // the graph constraint
              final Collection<Indices> dataSetIndices = this.root.dataset
                  .getNamedGraphIndices();
              if (dataSetIndices != null) {

                for (final Indices indices : dataSetIndices) {
                  final TriplePattern ztp = new TriplePattern(
                      graphConstraint
                          .equals(tp.getPos(0)) ? indices
                          .getRdfName()
                          : tp.getPos(0),
                      graphConstraint
                          .equals(tp.getPos(1)) ? indices
                          .getRdfName()
                          : tp.getPos(1),
                      graphConstraint
                          .equals(tp.getPos(2)) ? indices
                          .getRdfName()
                          : tp.getPos(2));
                  final Triple zkey = getKey(ztp, null);
                  final Literal intermediateMax = this.getMaxLiteral(
                      (SixIndices) indices, zkey, pos);
                  if (intermediateMax != null
                      && (max == null || max
                          .compareToNotNecessarilySPARQLSpecificationConform(intermediateMax) < 0)) {
                    max = intermediateMax;
                  }
                }
              }
            }
          }

          // if the graph constraint is an URILiteral fetch the
          // matching indices object
          // but do not bind anything
          else {
            for (final Indices indices : indicesC) {

              final URILiteral rdfName = indices.getRdfName();
              if (namedGraphs.contains(rdfName)) {
                final Literal intermediateMax = this.getMaxLiteral(
                    (SixIndices) indices, key, pos);
                if (intermediateMax != null
                    && (max == null || max
View Full Code Here

Examples of lupos.engine.operators.index.Indices

          // just do this here to be faster in the normal case...
          // (it would be enough to do this after the next while-loop)
          return this.it_triples.next();
        }
        while((this.it_triples==null || (this.it_triples!=null && !this.it_triples.hasNext())) && it_indices.hasNext()){
          final Indices indices = it_indices.next();
          final Collection<Triple> col_triples = ((SevenMemoryIndices) indices).getFromMap(mapPattern, keyString);
          this.it_triples = (col_triples==null) ? null : col_triples.iterator();
        }
        if(this.it_triples!=null && this.it_triples.hasNext()){
          return this.it_triples.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.