org.apache.jena.query.Query.toString()方法的使用及代码示例

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

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

Query.toString介绍

暂无

代码示例

代码示例来源:origin: apache/jena

@Override
  public String toString() {
    return query.toString();
  }
}

代码示例来源:origin: org.apache.jena/jena-querybuilder

@Override
  public String toString() {
    return query.toString();
  }
}

代码示例来源:origin: apache/tinkerpop

for (ExprAggregator expr : exprAgg) {
  if (expr.getAggregator().getName().contains("COUNT")) {
    if (!query.toString().contains("GROUP")) {
      if (expr.getAggregator().toString().contains("DISTINCT"))
        traversal = traversal.dedup(expr.getAggregator().getExprList().get(0).toString().substring(1));

代码示例来源:origin: apache/jena

@Override
public String getLastQueryString()
{ 
  Query q = query ;    // Get once.
  if ( q != null ) return q.toString() ;
  // Sometimes an alegra expression is executited without a query.
  return getLastAlgebra() ;
}
public void setLastQueryString(Query q)     { query = q ; }

代码示例来源:origin: apache/jena

/**
 * Build the query as a string.
 * 
 * @return the string representation of the query.
 */
public final String buildString() {
  return build().toString();
}

代码示例来源:origin: org.apache.jena/jena-querybuilder

/**
 * Build the query as a string.
 * 
 * @return the string representation of the query.
 */
public final String buildString() {
  return build().toString();
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
  public void write(Query query, boolean value) {
    write(query.toString(), value);
  }
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

protected String getQueryStr() {
  Query query = getQuery();
  Objects.requireNonNull(query);
  String result = query.toString();
  return result;
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

public static String addPrefix(String queryString, Map<String, String> prefix2Namespace){
  Query query = QueryFactory.create(queryString);
  for (Entry<String, String> entry : prefix2Namespace.entrySet()) {
    String prefix = entry.getKey();
    String namespace = entry.getValue();
    query.setPrefix(prefix, namespace);
  }
  return query.toString();
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Deprecated
public QueryExecution createQueryExecution(Query query, @Context HttpServletRequest req) {
  QueryExecutionAndType tmp = createQueryExecutionAndType(query.toString());
  QueryExecution result = tmp.getQueryExecution();
  return result;
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public ResultSet execSelect() {
  if (!query.isSelectType()) {
    throw new RuntimeException("SELECT query expected. Got: ["
        + query.toString() + "]");
  }
  return executeCoreSelect(query);
}

代码示例来源:origin: apache/jena

/**
 * Makes a copy of this query.  Copies by parsing a query from the serialized form of this query
 * @return Copy of this query
 */
public Query cloneQuery() {
  // A little crude.
  // Must use toString() rather than serialize() because we may not know how to serialize extended syntaxes
  String qs = this.toString();
  return QueryFactory.create(qs, getSyntax()) ;
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

public static String addPrefixes(String queryString, String prefix, String namespace){
  Query query = QueryFactory.create(queryString);
  query.setPrefix(prefix, namespace);
  return query.toString();
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
public CacheResource lookup(Query query) {
  CacheEntry cacheEntry = cacheCore.lookup(query.toString());
  return cacheEntry == null
      ? null
      : new CacheResourceCacheEntry(cacheEntry);
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public static Query substitutePaths(Query query, String pathString, Model model) {
  // TODO: This is a bad algorithm - should be operating on syntax tree, not string
  String str = query.toString().replaceAll(" \\?" + SH.PATHVar.getVarName() + " ", pathString);
  return ARQFactory.get().createQuery(model, str);
}

代码示例来源:origin: at.researchstudio.sat/won-core

public ValidationResult validate(Dataset input) {
  if (logger.isDebugEnabled()) {
    logger.debug("validating constraint of WonSparqlValidator '{}'", name);
  }
  if (constraint.isAskType()) {
    return validateAsk(input);
  } else if (constraint.isSelectType()) {
    return validateSelect(input);
  }
  return new ValidationResult(false, "Invalid constraint: " + constraint.toString());
}

代码示例来源:origin: SmartDataAnalytics/DL-Learner

public int getPopularityOf(OWLClassExpression description){
  if(classPopularityMap != null && classPopularityMap.containsKey(description)){
    return classPopularityMap.get(description);
  } else {
    String query = converter.asCountQuery(description).toString();
    ResultSet rs = executeSelectQuery(query);
    int cnt = rs.next().getLiteral("cnt").getInt();
    return cnt;
  }
}

代码示例来源:origin: apache/jena

private QueryExecution queryExec(Query query, String queryString) {
  checkQuery();
  if ( query == null && queryString == null )
    throw new InternalErrorException("Both query and query string are null"); 
  if ( query == null ) {
    if ( parseCheckQueries )
      QueryFactory.create(queryString);
  }

  // Use the query string as provided if possible, otherwise serialize the query.
  String queryStringToSend = ( queryString != null ) ?  queryString : query.toString();
  return exec(()-> createQueryExecution(query, queryStringToSend));
}

代码示例来源:origin: org.apache.jena/jena-rdfconnection

private QueryExecution queryExec(Query query, String queryString) {
  checkQuery();
  if ( query == null && queryString == null )
    throw new InternalErrorException("Both query and query string are null"); 
  if ( query == null ) {
    if ( parseCheckQueries )
      QueryFactory.create(queryString);
  }

  // Use the query string as provided if possible, otherwise serialize the query.
  String queryStringToSend = ( queryString != null ) ?  queryString : query.toString();
  return exec(()-> createQueryExecution(query, queryStringToSend));
}

代码示例来源:origin: apache/jena

@Test
public void testExtendInService() {
  //Original test case from JENA-422
  Query[] result = test_roundTripQuery("SELECT * WHERE { SERVICE <http://example/endpoint> { ?s ?p ?o . BIND(?o AS ?x) } }");
  assertTrue(result[1].toString().contains("BIND"));
}

相关文章