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

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

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

Var.alloc介绍

暂无

代码示例

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

protected Var createVariable(String s, int line, int column)
{
  s = s.substring(1) ; // Drop the marker
  
  // This is done by the parser input stream nowadays.
  //s = unescapeCodePoint(s, line, column) ;
  // Check \ u did not put in any illegals. 
  return Var.alloc(s) ;
}

代码示例来源: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

private static void addVar(Collection<Var> acc, Node n)
  {
    if ( n == null )
      return ;
    
    if ( n.isVariable() )
      acc.add(Var.alloc(n)) ;
  }
}

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

@Override
protected boolean _contains(String varName)
{
  return binding.contains(Var.alloc(varName)) ;
}

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

public static void addVar(Collection<Var> acc, Node n) {
  if (n == null)
    return ;
  if (n.isVariable())
    acc.add(Var.alloc(n)) ;
}

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

/** Given an old name, and some names already in use, pick a fresh, new name*/ 
public static Var chooseVarName(Var var, Collection<Var> inUse, String prefix)
{
  Var var2 = var ;
  do {
    var2 = Var.alloc(prefix+var2.getName()) ;
  } while (inUse.contains(var2)) ;    
  return var2 ;
}

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

private void _addResultVar(String varName)
{
  Var v = Var.alloc(varName) ;
  _addVar(projectVars, v) ;
  resultVarsSet = true ;
}

代码示例来源: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: org.apache.clerezza.ext/org.apache.jena.jena-arq

@Override
  protected QueryIterator execObjectBound(Binding binding, Var listVar, Node predicate, Node length,
                      ExecutionContext execCxt)
  {
    Graph graph = execCxt.getActiveGraph() ;
    return length(binding, graph, listVar,  Var.alloc(length) , execCxt) ;
  }
}

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

private static Node resolve(Binding b, Node n)
{
  if ( ! n.isVariable() )
    return n ;
  return b.get(Var.alloc(n)) ;
}

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

public void addGroupBy(String varName)
{
  varName = Var.canonical(varName) ;
  addGroupBy(Var.alloc(varName)) ;
}

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

void appendVarList(Query query, IndentedWriter sb, List<String> vars)
{
  boolean first = true ;
  for ( String varName : vars )
  {
    Var var = Var.alloc(varName) ;
    if ( ! first )
      sb.print(" ") ;
    sb.print(var.toString()) ;
    first = false ;
  }
}

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

private void endElementBNode(String ns, String localName, String name)
{
  endAccumulate() ;
  String bnodeId = buff.toString() ;
  Node node = bNodes.asNode(bnodeId) ;
  if ( checkVarName("BNode: "+bnodeId) )
    addBinding(binding, Var.alloc(varName), node) ;
}

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

private Binding copyToBinding(QuerySolution qs)
{
  BindingMap b = BindingFactory.create() ;
  for ( Iterator<String> iter = qs.varNames() ; iter.hasNext() ; )
  {
    String varName = iter.next() ;
    RDFNode rn = qs.get(varName) ;
    b.add(Var.alloc(varName), rn.asNode()) ;
  }
  return b ;
}

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

void appendVarList(Query query, IndentedWriter sb, List<String> vars)
{
  boolean first = true ;
  for ( String varName : vars )
  {
    Var var = Var.alloc(varName) ;
    if ( ! first )
      sb.print(" ") ;
    sb.print(var.toString()) ;
    first = false ;
  }
}

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

private void endElementURI(String ns, String localName, String name) {
  endAccumulate() ;
  String uri = buff.toString() ;
  Node n = NodeFactory.createURI(uri) ;
  if ( checkVarName("URI: " + uri) )
    addBinding(binding, Var.alloc(varName), n) ;
}

代码示例来源: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: com.hp.hpl.jena/sdb

@Test public void regex_2()
{
  MapAction mapAction = new MapAction() ;
  mapAction.put(Var.alloc("a1"), new ActionMatchVar()) ;
  mapAction.put(Var.alloc("a2"), new ActionMatchString()) ;
  mapAction.put(Var.alloc("a3"), new ActionMatchString()) ;
  
  noMatch("regex(?x , 'smith')",
      "regex(?a1 , ?a2, ?a3)",
      mapAction) ;
}

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

@Test public void regex_8()
{
  MapAction mapAction = new MapAction() ;
  //mapAction.put(Var.alloc("a1"), new ActionMatch
  mapAction.put(Var.alloc("a2"), new ActionMatchString()) ;
  mapAction.put(Var.alloc("a3"), new ActionMatchExact("'i'")) ;
  
  noMatch("regex(?x , 'smith', 'i')",
      "regex(str(?a1), ?a2, ?a3)",
      mapAction) ;
}

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

@Test public void match_1()
{
  MapAction mapAction = new MapAction() ;
  MapResult mapResult = new MapResult() ;
  mapResult.put(Var.alloc("a"), "?x") ;
  
  match("?x", "?a", mapAction, null) ;
}

相关文章