Beispiel #1
0
 /**
  * Performs the doc function.
  *
  * @param qc query context
  * @return result
  * @throws QueryException query exception
  */
 ANode doc(final QueryContext qc) throws QueryException {
   final Item it = exprs[0].item(qc, info);
   if (it == null) return null;
   final byte[] in = toToken(it);
   if (!Uri.uri(in).isValid()) throw INVDOC_X.get(info, in);
   return qc.resources.doc(new QueryInput(string(in)), sc.baseIO(), info);
 }
Beispiel #2
0
  /**
   * Returns a collection.
   *
   * @param qc query context
   * @return collection
   * @throws QueryException query exception
   */
  Value collection(final QueryContext qc) throws QueryException {
    // return default collection
    final Item it = exprs.length == 0 ? null : exprs[0].atomItem(qc, info);
    if (it == null) return qc.resources.collection(info);

    // check if reference is valid
    final byte[] in = toToken(it);
    if (!Uri.uri(in).isValid()) throw INVCOLL_X.get(info, in);
    return qc.resources.collection(new QueryInput(string(in)), sc.baseIO(), info);
  }
Beispiel #3
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final ANode node = toEmptyNode(arg(0, qc), qc);
   final QNm qname = node != null ? node.qname() : null;
   return qname != null ? Uri.uri(qname.uri(), false) : Uri.EMPTY;
 }