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

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

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

Query.addNamedGraphURI介绍

[英]Location of the source for the data. If the model is not set, then the QueryEngine will attempt to load the data from these URIs as named graphs in the dataset.
[中]数据源的位置。如果未设置模型,则查询引擎将尝试将这些URI中的数据作为命名图加载到数据集中。

代码示例

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

/**
 * Add a graph name to the from named list.
 * @param graphName The graph name to add.
 */
public void fromNamed(String graphName) {
  query.addNamedGraphURI(graphName);
}

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

/**
 * Add the graph names to the from named list.
 * 
 * The names are ordered in as defined in the collection.
 * 
 * @param graphNames The from names to add.
 */
public void fromNamed(Collection<String> graphNames) {
  for (String uri : graphNames) {
    query.addNamedGraphURI(uri);
  }
}

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

/**
 * Add a graph name to the from named list.
 * @param graphName The graph name to add.
 */
public void fromNamed(String graphName) {
  query.addNamedGraphURI(graphName);
}

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

/**
 * Add the graph names to the from named list.
 * 
 * The names are ordered in as defined in the collection.
 * 
 * @param graphNames The from names to add.
 */
public void fromNamed(Collection<String> graphNames) {
  for (String uri : graphNames) {
    query.addNamedGraphURI(uri);
  }
}

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

final public void NamedGraphClause() throws ParseException {
             String iri ;
 jj_consume_token(NAMED);
 iri = SourceSelector();
 getQuery().addNamedGraphURI(iri) ;
}

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

final public void NamedGraphClause() throws ParseException {
             String iri ;
 jj_consume_token(NAMED);
 iri = SourceSelector();
 getQuery().addNamedGraphURI(iri) ;
}

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

final public void NamedGraphClause() throws ParseException {
             String iri ;
 jj_consume_token(NAMED);
 iri = SourceSelector();
 // This checks for duplicates
 getQuery().addNamedGraphURI(iri) ;
}

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

public static void main(String[] args) {
    //Query query = QueryFactory.create("SELECT * { { ?s ?p ?o } Union { Graph ?g { ?s ?p ?o } } }");
    //Query query = QueryFactory.create("SELECT * { { { Select * { ?s ?p ?o . Filter(?p = <p>) } } } Union { Graph ?g { ?s ?p ?o } } }");
    Query query = QueryFactory.create("SELECT * { { ?s ?p ?o . Graph ?x { ?a ?b ?c } } Union { Graph ?g { ?s ?p ?o } } }");
    query.addGraphURI("dg1");
    query.addGraphURI("dg2");
    query.addNamedGraphURI("ng1");
    query.addNamedGraphURI("ng2");

    Query tmp = rewrite(query);

    Op op = Algebra.compile(tmp);
    Op op2 = Transformer.transformSkipService(new TransformFilterPlacement(), op) ;
    tmp = OpAsQuery.asQuery(op2);

    System.out.println(tmp);
  }
}

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

public static void applyDatasetDescription(Query query,
    DatasetDescription dd) {
  DatasetDescription present = query.getDatasetDescription();
  if (present == null && dd != null) {
    {
      List<String> items = dd.getDefaultGraphURIs();
      if (items != null) {
        for (String item : items) {
          query.addGraphURI(item);
        }
      }
    }
    {
      List<String> items = dd.getNamedGraphURIs();
      if (items != null) {
        for (String item : items) {
          query.addNamedGraphURI(item);
        }
      }
    }
  }
}

代码示例来源:origin: com.github.galigator.openllet/openllet-jena

public final void namedGraphClause(Query q) throws RecognitionException {
  Node s =null;
  try {
    // openllet/query/sparqlowl/parser/antlr/SparqlOwlTreeARQ.g:747:2: ( ^( NAMED_GRAPH s= sourceSelector ) )
    // openllet/query/sparqlowl/parser/antlr/SparqlOwlTreeARQ.g:747:4: ^( NAMED_GRAPH s= sourceSelector )
    {
    match(input,NAMED_GRAPH,FOLLOW_NAMED_GRAPH_in_namedGraphClause1477); 
    match(input, Token.DOWN, null); 
    pushFollow(FOLLOW_sourceSelector_in_namedGraphClause1481);
    s=sourceSelector();
    state._fsp--;
    match(input, Token.UP, null); 
     q.addNamedGraphURI( s.getURI() ); 
    }
  }
    catch( RecognitionException rce ) {
      throw rce;
    }
  finally {
    // do for sure before leaving
  }
}
// $ANTLR end "namedGraphClause"

代码示例来源:origin: Galigator/openllet

public final void namedGraphClause(Query q) throws RecognitionException {
  Node s =null;
  try {
    // openllet/query/sparqlowl/parser/antlr/SparqlOwlTreeARQ.g:747:2: ( ^( NAMED_GRAPH s= sourceSelector ) )
    // openllet/query/sparqlowl/parser/antlr/SparqlOwlTreeARQ.g:747:4: ^( NAMED_GRAPH s= sourceSelector )
    {
    match(input,NAMED_GRAPH,FOLLOW_NAMED_GRAPH_in_namedGraphClause1477); 
    match(input, Token.DOWN, null); 
    pushFollow(FOLLOW_sourceSelector_in_namedGraphClause1481);
    s=sourceSelector();
    state._fsp--;
    match(input, Token.UP, null); 
     q.addNamedGraphURI( s.getURI() ); 
    }
  }
    catch( RecognitionException rce ) {
      throw rce;
    }
  finally {
    // do for sure before leaving
  }
}
// $ANTLR end "namedGraphClause"

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

相关文章