Tabnine Logo
IterLib
Code IndexAdd Tabnine to your IDE (free)

How to use
IterLib
in
org.apache.jena.sparql.util

Best Java code snippets using org.apache.jena.sparql.util.IterLib (Showing top 20 results out of 315)

origin: apache/jena

private QueryIterator concreteSubject(Binding binding, Node s,
    SpatialMatch match, ExecutionContext execCxt) {
  if (!s.isURI()) {
    log.warn("Subject not a URI: " + s);
    return IterLib.noResults(execCxt);
  }
  List<Node> x = query(match);
  if (x == null || !x.contains(s))
    return IterLib.noResults(execCxt);
  else
    return IterLib.result(binding, execCxt);
}
origin: apache/jena

@Override
public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt)
{
  try {
    if ( subject.isVariable() )
    {
      Log.warn(this, "Variable found: expected a value: "+subject) ;
      return IterLib.noResults(execCxt) ;
    }
    
    Node r = calc(subject) ;
    
    // Variable bound? 
    if ( Var.isVar(object) ) //object.isVariable() )
      return IterLib.oneResult(binding, Var.alloc(object), r, execCxt) ;
    
    // Variable already bound - test same value.
    if ( r.equals(object) )
      return IterLib.result(binding, execCxt) ;
    
    return IterLib.noResults(execCxt) ;
  }  catch (Exception ex)
  { 
    Log.warn(this, "Exception: "+ex.getMessage(), ex);
    return null ;
  }
}
origin: apache/jena

private static QueryIterator getByIndex(Graph graph, Binding binding, 
                    Node listNode, Node indexNode, Var varMember,
                    ExecutionContext execCxt)
{
  int i = NodeFactoryExtra.nodeToInt(indexNode) ;
  if ( i < 0 )
    return IterLib.noResults(execCxt) ;
  Node n = GraphList.get(new GNode(graph, listNode), i) ;
  if ( n == null )
    return IterLib.noResults(execCxt) ;
  return IterLib.oneResult(binding, varMember, n, execCxt) ; 
}
origin: apache/jena

  private QueryIterator subjectIsVariable(Node arg, PropFuncArg argObject, ExecutionContext execCxt)
  {
    Log.warn(this, "Subject to property function splitURI is not a bound nor a constant.") ;
    return IterLib.noResults(execCxt) ;
  }
}
origin: apache/jena

  @Override
  public QueryIterator execEval(Binding binding, ExprList args, ExecutionContext execCxt)
  {
    System.out.println("Debug: "+args.toString()) ;
    return IterLib.result(binding, execCxt) ;
  }
}
origin: apache/jena

@Override
protected QueryIterator nextStage(Binding binding)
{
  QueryIterator iter = exec(binding, name, args, super.getExecContext()) ;
  if ( iter == null ) 
    iter = IterLib.noResults(execCxt) ;
  return iter ;
}

origin: apache/jena

private static QueryIterator findIndex(Graph graph, Binding binding,
                    Node listNode, Var var, Node member,
                    ExecutionContext execCxt)
{
  // Find index of member.
  int i = GraphList.index(new GNode(graph, listNode), member) ;
  if ( i < 0 )
    return IterLib.noResults(execCxt) ;
  Node idx = NodeFactoryExtra.intToNode(i) ;
  return IterLib.oneResult(binding, var, idx, execCxt) ; 
}
origin: org.apache.jena/jena-spatial

private QueryIterator concreteSubject(Binding binding, Node s,
    SpatialMatch match, ExecutionContext execCxt) {
  if (!s.isURI()) {
    log.warn("Subject not a URI: " + s);
    return IterLib.noResults(execCxt);
  }
  List<Node> x = query(match);
  if (x == null || !x.contains(s))
    return IterLib.noResults(execCxt);
  else
    return IterLib.result(binding, execCxt);
}
origin: apache/jena

  @Override
  public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt)
  {
    if ( Var.isVar(subject) )
      throw new ExprEvalException("bnode: subject is an unbound variable") ;
    if ( ! subject.isBlank() )
      return IterLib.noResults(execCxt) ;
    String str = subject.getBlankNodeLabel() ;
    Node obj = NodeFactory.createLiteral(str) ;
    if ( Var.isVar(object) )
      return IterLib.oneResult(binding, Var.alloc(object), obj, execCxt) ;
    
    // Subject and object are concrete 
    if ( object.sameValueAs(obj) )
      return IterLib.result(binding, execCxt) ;
    return IterLib.noResults(execCxt) ;
  }
}
origin: apache/jena

private QueryIterator members(Binding binding, Node containerNode, Var memberVar, ExecutionContext execCxt)
{
  // Not necessarily very efficient
  Collection<Node> x = GraphContainerUtils.containerMembers(execCxt.getActiveGraph(), containerNode, typeNode) ;
  if ( x == null )
    // Wrong type.
    return IterLib.noResults(execCxt) ;
  List<Binding> bindings = new ArrayList<>() ;
  for ( Node n : x )
  {
    Binding b = BindingFactory.binding( binding, memberVar, n );
    bindings.add( b );
  }
  
  // Turn into a QueryIterator of extra bindings.
  return new QueryIterPlainWrapper(bindings.iterator(), execCxt) ;
}

origin: apache/jena

private QueryIterator length(Binding binding, Graph graph, 
               Node listNode, Var varLength,
               ExecutionContext execCxt)
{
  int x = GraphList.length(new GNode(graph, listNode)) ;
  if ( x < 0 )
    return IterLib.noResults(execCxt) ;
  Node n = NodeFactoryExtra.intToNode(x) ;
  return IterLib.oneResult(binding, varLength, n, execCxt) ;
}

origin: apache/jena

private static QueryIterator testSlotValue(Graph graph, Binding binding,
                      Node listNode, Node indexNode, Node memberNode,
                      ExecutionContext execCxt)
{
  int i = NodeFactoryExtra.nodeToInt(indexNode) ;
  if ( i < 0 )
    return IterLib.noResults(execCxt) ;
  Node n = GraphList.get(new GNode(graph, listNode), i) ;
  if ( n == null )
    return IterLib.noResults(execCxt) ;
  if ( n.equals(memberNode) )
    return IterLib.result(binding, execCxt) ; 
  else
    return IterLib.noResults(execCxt) ;
}
origin: apache/jena

@Override
public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt)
{
  if ( subject.isVariable() && object.isVariable() )
    throw new QueryExecException("Both subject and object are unbound variables: "+FmtUtils.stringForNode(predicate)) ;
  if ( subject.isVariable() )
    // Object not a variable or already bound
    return IterLib.oneResult(binding, Var.alloc(subject), object, execCxt) ;
  if ( object.isVariable() )
    // Subjects not a variable or already bound
    return IterLib.oneResult(binding, Var.alloc(object), subject, execCxt) ;
  // Both bound.  Must be the same.
  if ( subject.sameValueAs(object) )
    return IterLib.result(binding, execCxt) ;
  // different
  return IterLib.noResults(execCxt) ;
}
origin: apache/jena

@Override
protected QueryIterator nextStage(Binding binding)
{
  QueryIterator iter = exec(binding, argSubject, predicate, argObject, getExecContext()) ;
  if ( iter == null ) 
    iter = IterLib.noResults(getExecContext()) ;
  return iter ;
}

origin: apache/jena

@Override
public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, PropFuncArg object,
                  ExecutionContext execCxt)
{
  if ( ! Var.isVar(subject) )
    throw new ExprEvalException("Subject is not a variable ("+subject+")") ;
  
  String x = "" ;
  for ( Node node : object.getArgList() )
  {
    if ( Var.isVar(node) )
      return IterLib.noResults(execCxt) ;
    String str = NodeFunctions.str(node) ;
    x = x+str ;
  }
     return IterLib.oneResult(binding, Var.alloc(subject), NodeFactory.createLiteral(x), execCxt) ;
}
origin: apache/jena

private QueryIterator verify(Binding binding, Graph graph, Node listNode, Node length, ExecutionContext execCxt)
{
  int x = GraphList.length(new GNode(graph, listNode)) ;
  int len = NodeFactoryExtra.nodeToInt(length) ;
  
  if ( x == len )
    return IterLib.result(binding, execCxt) ;
  return IterLib.noResults(execCxt) ;
}
origin: apache/jena

  return IterLib.noResults(execCxt) ;
  return IterLib.oneResult(binding, Var.alloc(subject), strValue, execCxt) ;
else
    return IterLib.result(binding, execCxt) ;
  return IterLib.noResults(execCxt) ;
origin: apache/jena

private QueryIterator concreteSubject(Binding binding, Node s, Node score, Node literal, Node graph, StrMatch match, ExecutionContext execCxt) {
  log.trace("concreteSubject: {}", match) ;
  ListMultimap<String,TextHit> x;
  if (s instanceof Node_URI) {
    x = query(s.getURI(), match.getProperty(), match.getQueryString(), match.getLang(), -1, match.getHighlight(), execCxt);
  } else {
    x = query(match.getProperty(), match.getQueryString(), match.getLang(), -1, match.getHighlight(), execCxt);
  }
  if ( x == null ) // null return value - empty result
    return IterLib.noResults(execCxt) ;
  
  List<TextHit> r = x.get(TextQueryFuncs.subjectToString(s));
  return resultsToQueryIterator(binding, s, score, literal, graph, r, execCxt);
}
origin: apache/jena

@Override
public QueryIterator execEvaluated(Binding binding, PropFuncArg subject, Node predicate, PropFuncArg object, ExecutionContext execCxt)
{
  BindingMap b = BindingFactory.create(binding) ;
  Node subj = subject.getArg() ;
  if ( ! isSameOrVar(subj, arq) ) IterLib.noResults(execCxt) ;
  if ( subj.isVariable() )
    b.add(Var.alloc(subj), arq) ;
  Node obj = object.getArg() ;
  if ( ! isSameOrVar(obj, version) ) IterLib.noResults(execCxt) ;
  if ( obj.isVariable() )
    b.add(Var.alloc(obj), version) ;
  
  return IterLib.result(b, execCxt) ;
}
origin: org.apache.jena/jena-text

private QueryIterator concreteSubject(Binding binding, Node s, Node score, Node literal, Node graph, StrMatch match, ExecutionContext execCxt) {
  log.trace("concreteSubject: {}", match) ;
  ListMultimap<String,TextHit> x;
  if (s instanceof Node_URI) {
    x = query(s.getURI(), match.getProperty(), match.getQueryString(), match.getLang(), -1, match.getHighlight(), execCxt);
  } else {
    x = query(match.getProperty(), match.getQueryString(), match.getLang(), -1, match.getHighlight(), execCxt);
  }
  if ( x == null ) // null return value - empty result
    return IterLib.noResults(execCxt) ;
  
  List<TextHit> r = x.get(TextQueryFuncs.subjectToString(s));
  return resultsToQueryIterator(binding, s, score, literal, graph, r, execCxt);
}
org.apache.jena.sparql.utilIterLib

Most used methods

  • noResults
  • result
  • oneResult

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • startActivity (Activity)
  • runOnUiThread (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • ImageIO (javax.imageio)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now