com.hp.hpl.jena.sparql.core.Var.isVar()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(175)

本文整理了Java中com.hp.hpl.jena.sparql.core.Var.isVar()方法的一些代码示例,展示了Var.isVar()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Var.isVar()方法的具体详情如下:
包路径:com.hp.hpl.jena.sparql.core.Var
类名称:Var
方法名:isVar

Var.isVar介绍

暂无

代码示例

代码示例来源:origin: com.hp.hpl.jena/arq

private static void slot(Set<Var> vars, Node node)
{
  if ( Var.isVar(node) )
    vars.add(Var.alloc(node)) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
  protected void check(Quad t)
  {
    if ( Var.isVar(t.getGraph()) || 
       Var.isVar(t.getSubject()) || 
       Var.isVar(t.getPredicate()) || 
       Var.isVar(t.getObject())) 
      throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
  }
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
protected void check(Triple t)
{
  if ( Var.isVar(getGraph()) )
    throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
  if ( Var.isVar(t.getSubject()) || Var.isVar(t.getPredicate()) || Var.isVar(t.getObject())) 
    throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
}

代码示例来源:origin: com.hp.hpl.jena/arq

private static Node substitute(Node node, Binding binding)
{
  if ( Var.isVar(node) )
  {
    Node x = binding.get(Var.alloc(node)) ;
    if ( x != null )
      return x ;
  }
  return node ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
protected QueryIterator execOneList(Binding binding, Node listNode, Node predicate, Node member, ExecutionContext execCxt)
{
  if ( Var.isVar(listNode) )
    throw new QueryExecException("List : subject not a list or variable bound to a list") ;
  // Case : arg 1 (the list) is bound and arg 2 not bound => generate possibilities
  // Case : arg 1 is bound and arg 2 is bound => test for membership.
  if ( Var.isVar(member) )
    return members(binding, listNode,  Var.alloc(member) , execCxt) ;
  else
    return verify(binding, listNode, member, execCxt) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
protected QueryIterator execOneList(Binding binding, Node listNode, Node predicate, Node member, ExecutionContext execCxt)
{
  if ( Var.isVar(listNode) )
    throw new QueryExecException("List : subject not a list or variable bound to a list") ;
  // Case : arg 1 (the list) is bound and arg 2 not bound => generate possibilities
  // Case : arg 1 is bound and arg 2 is bound => test for membership.
  if ( Var.isVar(member) )
    return members(binding, listNode,  Var.alloc(member) , execCxt) ;
  else
    return verify(binding, listNode, member, execCxt) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static Node lookup(Binding binding, Node node)
{
  if ( ! Var.isVar(node) )
    return node ;
  Var var = Var.alloc(node) ;
  return lookup(binding, var) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
  protected void check(Quad quad)
  {
    if ( Var.isVar(quad.getGraph()) || 
       Var.isVar(quad.getSubject()) || 
       Var.isVar(quad.getPredicate()) || 
       Var.isVar(quad.getObject())) 
      throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
    if ( quad.getSubject().isLiteral() )
      throw new QueryParseException("Literals not allowed as subjects in quad data", -1, -1) ;
  }
}

代码示例来源:origin: com.hp.hpl.jena/arq

public static Node lookup(Binding binding, Node node)
{
  if ( ! Var.isVar(node) )
    return node ;
  Var var = Var.alloc(node) ;
  return lookup(binding, var) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
protected void check(Triple t)
{
  if ( Var.isVar(getGraph()) )
    throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;   
  if ( Var.isVar(t.getSubject()) || Var.isVar(t.getPredicate()) || Var.isVar(t.getObject())) 
    throw new QueryParseException("Variables not permitted in data quad", -1, -1) ;  
  if ( t.getSubject().isLiteral() )
    throw new QueryParseException("Literals not allowed as subjects in data", -1, -1) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

private static void check(Item item)
{
  if ( Var.isVar(item.getNode()) )
    throw new ARQException("Explicit variable used in a pattern (use VAR): "+item.getNode()) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static void check(Item item)
{
  if ( Var.isVar(item.getNode()) )
    throw new ARQException("Explicit variable used in a pattern (use VAR): "+item.getNode()) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
public Expr applyNodeTransform(NodeTransform transform)
{
  Node node = transform.convert(varNode) ;
  if ( Var.isVar(node))
    return new ExprVar(Var.alloc(node)) ;
  return NodeValue.makeNode(node) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static boolean insert(Node inputNode, Node outputNode, BindingMap results)
{
  if ( ! Var.isVar(inputNode) )
    return true ;
  
  Var v = Var.alloc(inputNode) ;
  Node x = results.get(v) ;
  if ( x != null )
    return outputNode.equals(x) ;
  
  results.add(v, outputNode) ;
  return true ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
public Expr applyNodeTransform(NodeTransform transform)
{
  Node node = transform.convert(varNode) ;
  if ( Var.isVar(node))
    return new ExprVar(Var.alloc(node)) ;
  return NodeValue.makeNode(node) ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

private static boolean insert(Node inputNode, Node outputNode, Binding results)
{
  if ( ! Var.isVar(inputNode) )
    return true ;
  
  Var v = Var.alloc(inputNode) ;
  Node x = results.get(v) ;
  if ( x != null )
    return outputNode.equals(x) ;
  
  results.add(v, outputNode) ;
  return true ;
}

代码示例来源:origin: com.hp.hpl.jena/arq

public static Var buildVar(Item item)
  {
    if ( ! item.isNode() || !Var.isVar(item.getNode()) )
      BuilderLib.broken(item, "Not a variable", item) ;
//        if ( ! Var.isNamedVar(item.getNode()) )
//            BuilderBase.broken(item, "Not a named variable", item) ;
    return Var.alloc(item.getNode()) ;
  }

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

public static Var buildVar(Item item)
  {
    if ( ! item.isNode() || !Var.isVar(item.getNode()) )
      BuilderLib.broken(item, "Not a variable", item) ;
//        if ( ! Var.isNamedVar(item.getNode()) )
//            BuilderBase.broken(item, "Not a named variable", item) ;
    return Var.alloc(item.getNode()) ;
  }

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

private static void update(Node node, PatternTriple elt)
{
  if ( Var.isVar(node) )
  {
    if ( node.equals(elt.subject.getNode()) )
      elt.subject = PatternElements.TERM ;
    if ( node.equals(elt.predicate.getNode()) )
      elt.predicate = PatternElements.TERM ;
    if ( node.equals(elt.object.getNode()) )
      elt.object = PatternElements.TERM ;
  }
}

代码示例来源:origin: com.hp.hpl.jena/arq

private static void update(Node node, PatternTriple elt)
{
  if ( Var.isVar(node) )
  {
    if ( node.equals(elt.subject.getNode()) )
      elt.subject = PatternElements.TERM ;
    if ( node.equals(elt.predicate.getNode()) )
      elt.predicate = PatternElements.TERM ;
    if ( node.equals(elt.object.getNode()) )
      elt.object = PatternElements.TERM ;
  }
}

相关文章