com.hp.hpl.jena.query.Query.cloneQuery()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(107)

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

Query.cloneQuery介绍

[英]Makes a copy of this query. Copies by parsing a query from the serialized form of this query
[中]复制此查询。通过分析此查询的序列化形式中的查询进行复制

代码示例

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

/**
 * Make a query from another one by deep copy (a clone).
 * The returned query will be .equals to the original.
 * The returned query can be mutated without changing the
 * original (at which point it will stop being .equals)
 * 
 * @param originalQuery  The query to clone.
 *   
 */
static public Query create(Query originalQuery)
{
  return originalQuery.cloneQuery() ;
}

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

@Override
public Object clone() { return cloneQuery() ; }

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

/**
 * Make a query from another one by deep copy (a clone).
 * The returned query will be .equals to the original.
 * The returned query can be mutated without changing the
 * original (at which point it will stop being .equals)
 * 
 * @param originalQuery  The query to clone.
 *   
 */
static public Query create(Query originalQuery)
{
  return originalQuery.cloneQuery() ;
}

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

@Override
public Object clone() { return cloneQuery() ; }

代码示例来源:origin: Quetzal-RDF/quetzal

public Query simplify(Query q) {
  QueryPatternSimplification qps = new QueryPatternSimplification();
  q.getQueryPattern().visit(qps);
  Element newelt = qps.getResult();
  Query ret = q.cloneQuery();
  ret.setQueryPattern(newelt);
  return ret;
}

代码示例来源:origin: Quetzal-RDF/quetzal

@Override
public void visit(ElementSubQuery e) {
  Query sq = e.getQuery();
  QueryPatternSimplification qps = new QueryPatternSimplification();
  sq.getQueryPattern().visit(qps);
  Element newelt = qps.getResult();
  Query newsq = sq.cloneQuery();
  newsq.setQueryPattern(newelt);
  result = new ElementSubQuery(newsq);
}

代码示例来源:origin: Quetzal-RDF/quetzal

@Override
public void visit(ElementSubQuery e) {
  Query sq = e.getQuery();
  VariableSubstitutionElementVisitor qps = new VariableSubstitutionElementVisitor(oldVar2NewValue);
  sq.getQueryPattern().visit(qps);
  Element newelt = qps.getResult();
  Query newsq = sq.cloneQuery();
  newsq.setQueryPattern(newelt);
  result = new ElementSubQuery(newsq);
}

代码示例来源:origin: Quetzal-RDF/quetzal

private Query primCompile(Query query, Set<String> allVars) {
  // query must already be in dnf 
  Element e = query.getQueryPattern();
  Element newelt;    
  /*if (e instanceof ElementUnion) {
    ElementUnion union= new ElementUnion();
    for (Element ge : ((ElementUnion) e).getElements()) {
      Set<String> distinguishedVars = getMultipleOccurrenceVars(getVisibleVarsToOccurrences(ge));
      distinguishedVars.addAll(query.getResultVars());
      ExpandBasicGraphPatterns ebgp = new ExpandBasicGraphPatterns();
      Element newge = ebgp.expand(query.getQueryPattern(),  new LinkedList<String>(distinguishedVars), allVars);
      union.addElement(newge);
    }
    newelt = union;
  } else {
    Set<String> distinguishedVars = getMultipleOccurrenceVars(getVisibleVarsToOccurrences(e));*/
    ExpandBasicGraphPatterns ebgp = new ExpandBasicGraphPatterns();
    //distinguishedVars.addAll(query.getResultVars());
    newelt = ebgp.expand(query.getQueryPattern(), /* new LinkedList<String>(distinguishedVars),*/ allVars);
    
  //}
  Query ret = query.cloneQuery();
  ret.setQueryPattern(newelt);
  return ret;
  
}

相关文章