Package lupos.engine.operators.index

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


      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

              // 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

          // 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

                // 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 Triple keyMinimum = this.getKey(ztp,
                        null, minima);
                    final Triple keyMaximum = this.getKey(ztp,
                        null, maxima);

                    final VarBucket vb = this.getVarBucket(v,
                        ztp, zkey, keyMinimum,
                        keyMaximum,
                        (SixIndices) indices);
                    if (vb != null) {
                      final VarBucket previous_vb = result
                          .get(v);
                      if (previous_vb != null) {
                        vb.add(previous_vb);
                      }
                      vb.minimum = (minima == null) ? null
                          : minima.get(v);
                      vb.maximum = (maxima == null) ? null
                          : maxima.get(v);
                      result.put(v, vb);
                    }
                  }

                }

              }

              // 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 Triple keyMinimum = this.getKey(ztp,
                        null, minima);
                    final Triple keyMaximum = this.getKey(ztp,
                        null, maxima);
                    final VarBucket vb = this.getVarBucket(v,
                        ztp, zkey, keyMinimum,
                        keyMaximum,
                        (SixIndices) indices);
                    if (vb != null) {
                      final VarBucket previous_vb = result
                          .get(v);
                      if (previous_vb != null) {
                        vb.add(previous_vb);
                      }
                      vb.minimum = (minima == null) ? null
                          : minima.get(v);
                      vb.maximum = (maxima == null) ? null
                          : maxima.get(v);
                      result.put(v, vb);
                    }
                  }
                }
              }
            }

            // if the graph constraint is an URILiteral fetch the
            // matching indices object
            // but do not bind anything
            else {
              final Triple keyMinimum = this.getKey(tp, null, minima);
              final Triple keyMaximum = this.getKey(tp, null, maxima);
              for (final Indices indices : indicesC) {

                final URILiteral rdfName = indices.getRdfName();
                if (namedGraphs.contains(rdfName)) {
                  final VarBucket vb = this.getVarBucket(v, tp,
                      key, keyMinimum, keyMaximum,
                      (SixIndices) indices);
                  if (vb != null) {
View Full Code Here

            indices.add(t);
          }
        } else {
          for (final URILiteral uri : cu) {
            boolean flag = false;
            Indices indices = this.dataset.getNamedGraphIndices(uri);
            if (indices != null){
              flag = true;
              indices.add(t);
            }
            indices = this.dataset.getDefaultGraphIndices(uri);
            if (indices != null){
              flag = true;
              indices.add(t);
            }
            if(!flag){
              try {
                this.dataset.addNamedGraph(uri, new StringURILiteral("<inlinedata:"+t.getSubject()+" "+t.getPredicate()+" "+t.getObject()+".>"), false, false);
              } catch (Exception e) {
View Full Code Here

  public URILiteral getURI(){
    return uri;
  }

  public QueryResult process(QueryResult bindings, final int operandID) {
    Indices indices = dataset.getNamedGraphIndices(uri);
    if (indices != null){
      if(silent) return null;
      else throw new Error("Named Graph "+uri+" already exists");
    }
//    indices = dataset.getDefaultGraphIndices(uri);
View Full Code Here

        indices.clear();
      }
    } else {
      for(URILiteral uri: cu){
        boolean deleted = false;
        Indices indices = dataset.getNamedGraphIndices(uri);
        if (indices != null){
          indices.clear();
          deleted = true;
        }
        indices = dataset.getDefaultGraphIndices(uri);
        if (indices != null){
          indices.clear();
          deleted = true;
        }
        if(!isSilent && !deleted)
          throw new Error("Graph "+ uri + "to be deleted does not exist!");
      }
View Full Code Here

    if (into != null)
      System.err.println("Named graphs currently not supported!");
    else {
      try {
        for (final URILiteral u : cu) {
          final Indices indices = dataset.getIndicesFactory().createIndices((into==null)?u:into);
          dataset.indexingRDFGraph(u, indices, false, false);
          if (into == null) {
            // default graph!
            dataset.putIntoDefaultGraphs(u, indices);
          } else {
View Full Code Here

          for (final Indices indices : ci) {
            indices.remove(t);
          }
        } else {
          for (final URILiteral uri : cu) {
            Indices indices = dataset.getNamedGraphIndices(uri);
            if (indices != null)
              indices.remove(t);
            indices = dataset.getDefaultGraphIndices(uri);
            if (indices != null)
              indices.remove(t);

          }
        }
      }
    } else {
View Full Code Here

TOP

Related Classes of lupos.engine.operators.index.Indices

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.