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

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

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

Query.getBaseURI介绍

暂无

代码示例

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

@Override
public NodeValue eval(NodeValue v, FunctionEnv env)
{ 
  String baseIRI = null ;
  if ( env.getContext() != null )
  {
    Query query = (Query)env.getContext().get(ARQConstants.sysCurrentQuery) ;
    if ( query != null )
      baseIRI = query.getBaseURI() ;
  }
  return NodeFunctions.iri(v, baseIRI) ;
}

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

@Override
public NodeValue eval(NodeValue v, FunctionEnv env)
{ 
  String baseIRI = null ;
  if ( env.getContext() != null )
  {
    Query query = (Query)env.getContext().get(ARQConstants.sysCurrentQuery) ;
    if ( query != null )
      baseIRI = query.getBaseURI() ;
  }
  return NodeFunctions.iri(v, baseIRI) ;
}

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.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.getDatasetDescription(),
                            fileManager, baseURI ) ;
  return dsg ;
}

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

public void visitPrologue(Prologue query1)
{
  // This is after parsing so all IRIs in the query have been made absolute.
  // For two queries to be equal, their explicitly set base URIs must be the same. 
  
  String b1 = query1.explicitlySetBaseURI() ? query1.getBaseURI() : null ;
  String b2 = query2.explicitlySetBaseURI() ? query2.getBaseURI() : null ;        
  check("Base URIs", b1, b2) ;
  if ( query1.getPrefixMapping() == null &&
    query2.getPrefixMapping() == null )
    return ;
  check("Prefixes", query1.getPrefixMapping().samePrefixMappingAs(query2.getPrefixMapping())) ;
}

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

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

if ( ! query.explicitlySetBaseURI() )
  baseURI = query.getBaseURI() ;

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

if ( ! query.explicitlySetBaseURI() )
  baseURI = query.getBaseURI() ;

相关文章