コード例 #1
0
ファイル: listIndex.java プロジェクト: jamesw201/JenaO
    @Override
    protected QueryIterator processMethod() throws AsyncException {
      // subject a variable.

      if (objectArgs.size() != 2)
        throw new ExprEvalException("ListIndex : object not a list of length 2");
      Node indexNode = objectArgs.get(0);
      Node memberNode = objectArgs.get(1);

      final Collection<Node> x;
      if (!Var.isVar(memberNode))
        // If memberNode is defined, find lists containing it.
        x =
            GraphList.listFromMember(
                getHandler("x"), new GNode(execCxt.getActiveGraph(), memberNode));
      else
        // Hard. Subject unbound, no fixed member. Find every list and use BFI.
        x = GraphList.findAllLists(getHandler("x"), execCxt.getActiveGraph());
      return listIndex.super.allLists(
          getHandler(""),
          binding,
          x,
          listVar,
          predicate,
          new PropFuncArg(objectArgs, null),
          execCxt);
    }
コード例 #2
0
ファイル: listIndex.java プロジェクト: jamesw201/JenaO
 @Override
 protected QueryIterator processMethod() throws AsyncException {
   // Find index of member.
   int i = GraphList.index(getHandler("i"), new GNode(graph, listNode), member);
   if (i < 0) return IterLib.noResults(execCxt);
   Node idx = NodeFactory.intToNode(i);
   return IterLib.oneResult(binding, var, idx, execCxt);
 }
コード例 #3
0
ファイル: listIndex.java プロジェクト: jamesw201/JenaO
 @Override
 protected QueryIterator processMethod() throws AsyncException {
   // Iterate over list
   List<Node> members = GraphList.members(getHandler("members"), new GNode(graph, listNode));
   List<Binding> bindings = new ArrayList<Binding>();
   for (int i = 0; i < members.size(); i++) {
     Node idx = NodeFactory.intToNode(i);
     Node member = members.get(i);
     BindingMap b = BindingFactory.create(binding);
     b.add(varIndex, idx);
     b.add(varMember, member);
     bindings.add(b);
   }
   return new QueryIterPlainWrapper(bindings.iterator(), execCxt);
 }