Package org.exist.dom

Examples of org.exist.dom.DocumentSet


        // the expression can be called multiple times, so we need to clear the previous preselectResult
        preselectResult = null;
        LuceneIndexWorker index = (LuceneIndexWorker) context.getBroker().getIndexController().getWorkerByIndexId(LuceneIndex.ID);

        // DW: contextSequence can be null
        DocumentSet docs = contextSequence.getDocumentSet();
        Item key = getKey(contextSequence, null);
        List<QName> qnames = new ArrayList<>(1);
        qnames.add(contextQName);
        Properties options = parseOptions(contextSequence, null);
        try {
View Full Code Here


            Sequence input = getArgument(0).eval(contextSequence);
            if (!(input instanceof VirtualNodeSet) && input.isEmpty())
                result = NodeSet.EMPTY_SET;
            else {
                NodeSet inNodes = input.toNodeSet();
                DocumentSet docs = inNodes.getDocumentSet();
                LuceneIndexWorker index = (LuceneIndexWorker)
                        context.getBroker().getIndexController().getWorkerByIndexId(LuceneIndex.ID);
                Item key = getKey(contextSequence, contextItem);
                List<QName> qnames = null;
                if (contextQName != null) {
View Full Code Here

        long start = System.currentTimeMillis();

        NGramIndexWorker index = (NGramIndexWorker) context.getBroker().getIndexController().getWorkerByIndexId(
            NGramIndex.ID);
        DocumentSet docs = contextSequence.getDocumentSet();
        String key = getArgument(1).eval(contextSequence).getStringValue();
        List<QName> qnames = new ArrayList<QName>(1);
        qnames.add(contextQName);
        preselectResult = processMatches(index, docs, qnames, key, useContext ? contextSequence.toNodeSet() : null,
            NodeSet.DESCENDANT);
View Full Code Here

            if (input.isEmpty())
                result = NodeSet.EMPTY_SET;
            else {
                long start = System.currentTimeMillis();
                NodeSet inNodes = input.toNodeSet();
                DocumentSet docs = inNodes.getDocumentSet();
                NGramIndexWorker index = (NGramIndexWorker) context.getBroker().getIndexController()
                    .getWorkerByIndexId(NGramIndex.ID);
                //Alternate design
                // NGramIndexWorker index =
                // (NGramIndexWorker)context.getBroker().getBrokerPool().getIndexManager().getIndexById(NGramIndex.ID).getWorker();
View Full Code Here

        // the expression can be called multiple times, so we need to clear the previous preselectResult
        preselectResult = null;
        LuceneIndexWorker index = (LuceneIndexWorker)
                context.getBroker().getIndexController().getWorkerByIndexId(LuceneIndex.ID);
        String field = getArgument(0).eval(contextSequence).getStringValue();
        DocumentSet docs = contextSequence.getDocumentSet();
        Item query = getKey(contextSequence, null);
        Properties options = parseOptions(contextSequence, null);
        try {
            if (Type.subTypeOf(query.getType(), Type.ELEMENT))
                preselectResult = index.queryField(context, getExpressionId(), docs, useContext ? contextSequence.toNodeSet() : null,
View Full Code Here

          long start = System.currentTimeMillis();
          String field = getArgument(0).eval(contextSequence).getStringValue();
         
          Item query = getKey(contextSequence, null);
         
          DocumentSet docs = null;
          if (contextSequence == null)
            docs = context.getStaticallyKnownDocuments();
          else
                docs = contextSequence.getDocumentSet();
View Full Code Here

            if (contextItem != null)
                {context.getProfiler().message(this, Profiler.START_SEQUENCES, "CONTEXT ITEM", contextItem.toSequence());}
        }
       
        // get statically known documents from the context
        DocumentSet ds = context.getStaticallyKnownDocuments();
        if (ds == null || ds.getDocumentCount() == 0) {return Sequence.EMPTY_SEQUENCE;}
       
//        // if the expression occurs in a nested context, we might have cached the
//        // document set
//        // TODO: disabled cache for now as it may cause concurrency issues
//        // better use compile-time inspection and maybe a pragma to mark those
//        // sections in the query that can be safely cached
//        if (cachedDocs != null && cachedDocs.equalDocs(ds)) return cached;
       
        // check if the loaded documents should remain locked
        NewArrayNodeSet result = new NewArrayNodeSet(2);
        try {
            // wait for pending updates
            if (!context.inProtectedMode())
                {ds.lock(context.getBroker(), false, true);}
          DocumentImpl doc;
          for (final Iterator<DocumentImpl> i = ds.getDocumentIterator(); i.hasNext();) {
              doc = i.next();
                if (context.inProtectedMode() && !context.getProtectedDocs().containsKey(doc.getDocId()))
                    {continue;}
                if(doc.getResourceType() == DocumentImpl.XML_FILE) {  // skip binary resources
                result.add(new NodeProxy(doc));
              }
            }
          cached = result;
          cachedDocs = ds;
        } catch (final LockException e) {
            throw new XPathException(this, "Failed to acquire lock on the context document set");
        } finally {
            // release all locks
            if (!context.inProtectedMode())
                {ds.unlock(false);}
        }
//        result.updateNoSort();
        if (context.getProfiler().isEnabled())
            {context.getProfiler().end(this, "", result);}
       
View Full Code Here

                        "Can not access '" + path + "'", arg);
                }
                //TODO: we still need a final decision about this. Also check base-uri.
                //if (result == Sequence.EMPTY_SEQUENCE)
                    //throw new XPathException(this, path + " is not an XML document");
                final DocumentSet docs = result.getDocumentSet();
                if (docs != null && DocumentSet.EMPTY_DOCUMENT_SET != docs) {
                    // only cache node sets (which have a non-empty document set)
                    registerUpdateListener();
                }
            } catch (final Exception e) {
View Full Code Here

    final Sequence idrefval = arg.eval(contextSequence);
    if(idrefval.isEmpty())
            {result = Sequence.EMPTY_SEQUENCE;}
        else {
        String nextId;
        DocumentSet docs = null;
            if (getArgumentCount() == 2) {
                // second argument should be a node, whose owner document will be
                // searched for the id
                final Sequence nodes = getArgument(1).eval(contextSequence);
                if (nodes.isEmpty())
View Full Code Here

      Sequence result;
      if (args[0].isEmpty())
            {result = Sequence.EMPTY_SEQUENCE;}
      else {
          final NodeSet nodes = args[0].toNodeSet();
          final DocumentSet docs = nodes.getDocumentSet();
         
          if (this.getArgumentCount() == 3){
            final IndexWorker indexWorker = context.getBroker().getIndexController().getWorkerByIndexName(args[2].itemAt(0).getStringValue());
            //Alternate design
            //IndexWorker indexWorker = context.getBroker().getBrokerPool().getIndexManager().getIndexByName(args[2].itemAt(0).getStringValue()).getWorker();
View Full Code Here

TOP

Related Classes of org.exist.dom.DocumentSet

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.