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

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

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

Query.getNamedGraphURIs介绍

[英]Return the list of URIs (strings) for the named graphs (FROM NAMED clause)
[中]返回命名图的URI(字符串)列表(来自命名子句)

代码示例

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

public void visitDatasetDecl(Query query)
{
  x ^= query.getNamedGraphURIs().hashCode() ; 
}

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

@Override
public void visitDatasetDecl(Query query)
{
  x ^= query.getNamedGraphURIs().hashCode() ; 
}

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

/** Return true if the query has either some graph
 * URIs or some named graph URIs in its description.
 * This does not mean these URIs will be used - just that
 * they are noted as part of the query. 
 */ 

public boolean hasDatasetDescription()
{
  if ( getGraphURIs() != null && getGraphURIs().size() > 0 )
    return true ;
  if ( getNamedGraphURIs() != null && getNamedGraphURIs().size() > 0 )
    return true ;
  return false ;
}

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

/** Return true if the query has either some graph
 * URIs or some named graph URIs in its description.
 * This does not mean these URIs will be used - just that
 * they are noted as part of the query. 
 */ 

public boolean hasDatasetDescription()
{
  if ( getGraphURIs() != null && getGraphURIs().size() > 0 )
    return true ;
  if ( getNamedGraphURIs() != null && getNamedGraphURIs().size() > 0 )
    return true ;
  return false ;
}

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

@Override
public void visitDatasetDecl(Query query1)
{
  boolean b1 = Lib.equalsListAsSet(query1.getGraphURIs(), query2.getGraphURIs()) ;
  check("Default graph URIs", b1 ) ;
  boolean b2 = Lib.equalsListAsSet(query1.getNamedGraphURIs(), query2.getNamedGraphURIs()) ; 
  check("Named graph URIs", b2 ) ;
}

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

public void visitDatasetDecl(Query query1)
{
  boolean b1 = Lib.equalsListAsSet(query1.getGraphURIs(), query2.getGraphURIs()) ;
  check("Default graph URIs", b1 ) ;
  boolean b2 = Lib.equalsListAsSet(query1.getNamedGraphURIs(), query2.getNamedGraphURIs()) ; 
  check("Named graph URIs", b2 ) ;
}

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

public void visitDatasetDecl(Query query)
{
  if ( query.getGraphURIs() != null && query.getGraphURIs().size() != 0 )
  {
    for ( String uri : query.getGraphURIs() )
    {
      out.print("FROM ") ;
      out.print(FmtUtils.stringForURI(uri, query)) ;
      out.newline() ;
    }
  }
  if ( query.getNamedGraphURIs() != null  && query.getNamedGraphURIs().size() != 0 )
  {
    for ( String uri : query.getNamedGraphURIs() )
    {
      // One per line
      out.print("FROM NAMED ") ;
      out.print(FmtUtils.stringForURI(uri, query)) ;
      out.newline() ;
    }
  }
}

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

@Override
public void visitDatasetDecl(Query query)
{
  if ( query.getGraphURIs() != null && query.getGraphURIs().size() != 0 )
  {
    for ( String uri : query.getGraphURIs() )
    {
      out.print("FROM ") ;
      out.print(FmtUtils.stringForURI(uri, query)) ;
      out.newline() ;
    }
  }
  if ( query.getNamedGraphURIs() != null  && query.getNamedGraphURIs().size() != 0 )
  {
    for ( String uri : query.getNamedGraphURIs() )
    {
      // One per line
      out.print("FROM NAMED ") ;
      out.print(FmtUtils.stringForURI(uri, query)) ;
      out.newline() ;
    }
  }
}

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

/** Return a dataset description (FROM/FROM NAMED clauses) for the query. */  
public DatasetDescription getDatasetDescription()
{
  if ( ! hasDatasetDescription() ) return null;
  
  DatasetDescription description = new DatasetDescription() ;
  
  description.addAllDefaultGraphURIs(getGraphURIs()) ;
  description.addAllNamedGraphURIs(getNamedGraphURIs()) ;
  return description ;
}

代码示例来源:origin: net.sf.xsparql/xsparql-evaluator-legacy

/**
 * Evaluates a SPARQL query, storing the bindings to be reused later. Used for
 * the ScopedDataset.
 * 
 * @param q
 *          query to be executed
 * @param id
 *          solution id
 * @return XML results of the query
 */
public static ResultSet createScopedDataset(String q, String id) {
  // System.out.println("createScopedDataset(" + q + "," + id + ")");
  if (scopedDataset.containsKey(id)) {
    // error?
  }
  Query query = QueryFactory.create(q);
  Dataset dataset = DatasetFactory.create(query.getGraphURIs(),
      query.getNamedGraphURIs());
  QueryExecution qe = QueryExecutionFactory.create(query, dataset);
  ResultSet resultSet = qe.execSelect();
  DatasetResults ds = new DatasetResults(dataset);
  ResultSetRewindable results = ds.addResults(resultSet);
  scopedDataset.put(id, ds);
  return results;
}

代码示例来源:origin: net.sf.xsparql/xsparql-evaluator-sparql-arq

/**
 * Evaluates a SPARQL query, storing the bindings to be reused later. Used for
 * the ScopedDataset.
 * 
 * @param q
 *          query to be executed
 * @param id
 *          solution id
 * @return XML results of the query
 */
public static ResultSet createScopedDataset(String q, String id) {
  // System.out.println("createScopedDataset(" + q + "," + id + ")");
  if (scopedDataset.containsKey(id)) {
    // error?
  }
  Query query = QueryFactory.create(q);
  Dataset dataset = DatasetFactory.create(
      query.getGraphURIs(),
      query.getNamedGraphURIs());
  QueryExecution qe = QueryExecutionFactory.create(query, dataset);
  ResultSet resultSet = qe.execSelect();
  DatasetResults ds = new DatasetResults(dataset);
  ResultSetRewindable results = ds.addResults(resultSet);
  scopedDataset.put(id, ds);
  return results;
}

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

private static DatasetGraph prepareDataset(Dataset dataset, Query query, FileManager fileManager)
{
  if ( dataset != null )
    return dataset.asDatasetGraph() ;
  
  if ( ! query.hasDatasetDescription() ) 
    //Query.Log.warn(this, "No data for query (no URL, no model)");
    throw new QueryExecException("No dataset description for query");
  
  String baseURI = query.getBaseURI() ;
  if ( baseURI == null )
    baseURI = IRIResolver.chooseBaseURI() ;
  
  DatasetGraph dsg =
    DatasetUtils.createDatasetGraph(query.getGraphURIs(),
                    query.getNamedGraphURIs(),
                    fileManager, baseURI ) ;
  return dsg ;
}

代码示例来源:origin: ldp4j/ldp4j

String query(String query) {
  LOGGER.info("Using JENA:");
  Query q=QueryFactory.create(query);
  LOGGER.info("-- Query:\n"+q);
  LOGGER.info("-- Base: "+q.getBaseURI());
  LOGGER.info("-- Prefixes: "+q.getPrefixMapping());
  LOGGER.info("-- Variables: "+q.getProjectVars());
  Set<Var> variables=new HashSet<Var>(q.getProjectVars());
  for(Entry<Var, Expr> entry:q.getProject().getExprs().entrySet()) {
    Var shadowing = entry.getKey();
    VariableShadowingDetector detector = new VariableShadowingDetector(new IndentUtils(),shadowing);
    entry.getValue().visit(detector);
    if(detector.isShadowing()) {
      variables.remove(shadowing);
      variables.add(detector.getShadowed());
    }
  }
  LOGGER.info("-- Graph URIS: "+q.getGraphURIs());
  LOGGER.info("-- Named graphd URIS: "+q.getNamedGraphURIs());
  List<String> search=q.getNamedGraphURIs();
  q.getQueryPattern().visit(new ElementVisitorImplementation(search,variables));
  return null;
}

相关文章