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

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

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

Query.setBaseURI介绍

暂无

代码示例

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

/**
 * Set the base for the query.  This is the IRI against which relative names will be resolved.
 * @param base The string to set the base from.
 */
public void setBase(String base) {
  query.setBaseURI(base);
}

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

/**
 * Set the base for the query.  This is the IRI against which relative names will be resolved.
 * @param resolver The IRIResolver to set the base from.
 */
public void setBase(IRIResolver resolver) {
  query.setBaseURI(resolver);
}

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

/**
 * Set the base for the query.  This is the IRI against which relative names will be resolved.
 * @param base The string to set the base from.
 */
public void setBase(String base) {
  query.setBaseURI(base);
}

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

/**
 * Set the base for the query.  This is the IRI against which relative names will be resolved.
 * @param resolver The IRIResolver to set the base from.
 */
public void setBase(IRIResolver resolver) {
  query.setBaseURI(resolver);
}

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

PrefixMapping pm = query.getPrefixMapping();
String baseURI = query.getBaseURI();
query.setBaseURI((String) null);
      query.setBaseURI(baseURI);

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

@Override
  public Query get() {
    Query result = new Query();

    if(prologue != null) {
      result.setBaseURI(prologue.getBaseURI());
//            PrefixMappingImpl tmp = new PrefixMappingImpl();
//            // Note: Query parsing may modify the prefixes, hence create a copy of the prefix mappings
//            tmp.setNsPrefixes(prologue.getPrefixMapping());
      result.getPrefixMapping().setNsPrefixes(prologue.getPrefixMapping());
    }

    return result;
  }

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

protected static void stripNamespacesAndBase(Query q) {
    Map<String, String> prefixes = q.getPrefixMapping().getNsPrefixMap();
    for (String prefix : prefixes.keySet()) {
      q.getPrefixMapping().removeNsPrefix(prefix);
    }
    q.setBaseURI((String)null);
  }
}

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

@Override
public void startVisit(Query query) {
  newQuery.setSyntax(query.getSyntax());
  if (query.explicitlySetBaseURI())
    newQuery.setBaseURI(query.getPrologue().getResolver());
  newQuery.setQueryResultStar(query.isQueryResultStar());
  if (query.hasDatasetDescription()) {
    DatasetDescription desc = query.getDatasetDescription();
    for (String x : desc.getDefaultGraphURIs())
      newQuery.addGraphURI(x);
    for (String x : desc.getDefaultGraphURIs())
      newQuery.addNamedGraphURI(x);
  }
  // Aggregators.
  newQuery.getAggregators().addAll(query.getAggregators());
}

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

@Override
public void startVisit(Query query) {
  newQuery.setSyntax(query.getSyntax()) ;
  if ( query.explicitlySetBaseURI() )
    newQuery.setBaseURI(query.getPrologue().getResolver()) ;
  newQuery.setQueryResultStar(query.isQueryResultStar()) ;
  if ( query.hasDatasetDescription() ) {
    DatasetDescription desc = query.getDatasetDescription() ;
    for (String x : desc.getDefaultGraphURIs())
      newQuery.addGraphURI(x) ;
    for (String x : desc.getDefaultGraphURIs())
      newQuery.addNamedGraphURI(x) ;
  }
  // Aggregators.
  newQuery.getAggregators().addAll(query.getAggregators()) ;
}

代码示例来源:origin: com.marklogic/marklogic-jena

private SPARQLQueryDefinition prepareQueryDefinition(Query query) {
  JenaDatabaseClient client = markLogicDatasetGraph.getDatabaseClient();
  SPARQLQueryDefinition qdef = client.newQueryDefinition(query.toString());
  if (query.getBaseURI() != null) {
    qdef.setBaseUri(query.getBaseURI());
  } else {
    query.setBaseURI((String) null);
  }
  if (markLogicDatasetGraph.getRulesets() != null) {
    qdef.setRulesets(markLogicDatasetGraph.getRulesets());
  }
  bindVariables(qdef, this.initial, markLogicDatasetGraph);
  QueryDefinition constrainingQueryDefinition = markLogicDatasetGraph.getConstrainingQueryDefinition();
  qdef.setConstrainingQueryDefinition(constrainingQueryDefinition);
  return qdef;
}

相关文章