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

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

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

Query.isDescribeType介绍

暂无

代码示例

代码示例来源:origin: AtomGraph/Core

  1. /**
  2. * Convenience method for <pre>DESCRIBE</pre> queries.
  3. *
  4. * @param defaultGraphUris default graph URIs
  5. * @param namedGraphUris named graph URIs
  6. * @link #loadModel(query)
  7. * @param query
  8. * @return RDF model
  9. */
  10. public Model describe(Query query, List<URI> defaultGraphUris, List<URI> namedGraphUris)
  11. {
  12. if (query == null) throw new IllegalArgumentException("Query must be not null");
  13. if (!query.isDescribeType()) throw new IllegalArgumentException("Query must be DESCRIBE");
  14. return loadModel(query, defaultGraphUris, namedGraphUris);
  15. }

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

  1. public static Node extractDescribeNode(Query query) {
  2. if (!query.isDescribeType()) {
  3. throw new RuntimeException("DESCRIBE query expected. Got: ["
  4. + query.toString() + "]");
  5. }
  6. // TODO Right now we only support describe with a single constant.
  7. //Element queryPattern = query.getQueryPattern();
  8. if(query.getQueryPattern() != null || !query.getResultVars().isEmpty() || query.getResultURIs().size() > 1) {
  9. throw new RuntimeException("Sorry, DESCRIBE is only implemented for a single resource argument");
  10. }
  11. Node result = query.getResultURIs().get(0);
  12. return result;
  13. }

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

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

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

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

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

  1. private static QueryType getQueryType(final Query query)
  2. {
  3. if (query.isSelectType())
  4. return QueryType.SELECT;
  5. if (query.isConstructType())
  6. return QueryType.CONSTRUCT;
  7. if (query.isDescribeType())
  8. return QueryType.DESCRIBE;
  9. if (query.isAskType())
  10. return QueryType.ASK;
  11. return null;
  12. }

代码示例来源:origin: AtomGraph/Core

  1. /**
  2. * Loads RDF model from an RDF dataset using a SPARQL query.
  3. * Only <code>DESCRIBE</code> and <code>CONSTRUCT</code> queries can be used with this method.
  4. *
  5. * @param dataset the RDF dataset to be queried
  6. * @param query query object
  7. * @return result RDF model
  8. * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#describe">DESCRIBE</a>
  9. * @see <a href="http://www.w3.org/TR/2013/REC-sparql11-query-20130321/#construct">CONSTRUCT</a>
  10. */
  11. public Model loadModel(Dataset dataset, Query query)
  12. {
  13. if (log.isDebugEnabled()) log.debug("Local Dataset Query: {}", query);
  14. if (dataset == null) throw new IllegalArgumentException("Dataset must be not null");
  15. if (query == null) throw new IllegalArgumentException("Query must be not null");
  16. try (QueryExecution qex = QueryExecutionFactory.create(query, dataset))
  17. {
  18. if (query.isConstructType()) return qex.execConstruct();
  19. if (query.isDescribeType()) return qex.execDescribe();
  20. throw new QueryExecException("Query to load Model must be CONSTRUCT or DESCRIBE");
  21. }
  22. catch (QueryExecException ex)
  23. {
  24. if (log.isDebugEnabled()) log.debug("Local query execution exception: {}", ex);
  25. throw ex;
  26. }
  27. }

代码示例来源:origin: AtomGraph/Core

  1. if (query.isConstructType() || query.isDescribeType())

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

  1. static private String labelForQuery(Query q) {
  2. if ( q.isSelectType() ) return "SELECT" ;
  3. if ( q.isConstructType() ) return "CONSTRUCT" ;
  4. if ( q.isDescribeType() ) return "DESCRIBE" ;
  5. if ( q.isAskType() ) return "ASK" ;
  6. if ( q.isJsonType() ) return "JSON" ;
  7. return "<<unknown>>" ;
  8. }

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

  1. @Override
  2. public void visitDescribeResultForm(Query query1)
  3. {
  4. check("Not both DESCRIBE queries", query2.isDescribeType()) ;
  5. check("Result variables",
  6. query1.getResultVars(), query2.getResultVars() ) ;
  7. check("Result URIs",
  8. query1.getResultURIs(), query2.getResultURIs() ) ;
  9. }

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

  1. if ( ! this.isDescribeType() )
  2. Log.warn(this, "setResultVars(): no query pattern") ;
  3. return ;
  4. if ( isDescribeType() )

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

  1. if (sparql.isDescribeType())
  2. throw new UnsupportedQueryException("DESCRIBE queries cannot be answered with PelletQueryEngine");

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

  1. if (sparql.isDescribeType())
  2. throw new UnsupportedQueryException("DESCRIBE queries cannot be answered with PelletQueryEngine");

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

  1. private QueryExecution createQueryExecution(Query query, String queryStringToSend) {
  2. QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryStringToSend, httpClient, httpContext);
  3. QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
  4. // Set the accept header - use the most specific method.
  5. if ( query != null ) {
  6. if ( query.isSelectType() && acceptSelectResult != null )
  7. qEngine.setAcceptHeader(acceptSelectResult);
  8. if ( query.isAskType() && acceptAskResult != null )
  9. qEngine.setAcceptHeader(acceptAskResult);
  10. if ( ( query.isConstructType() || query.isDescribeType() ) && acceptGraph != null )
  11. qEngine.setAcceptHeader(acceptGraph);
  12. if ( query.isConstructQuad() )
  13. qEngine.setDatasetContentType(acceptDataset);
  14. }
  15. // Use the general one.
  16. if ( qEngine.getAcceptHeader() == null && acceptSparqlResults != null )
  17. qEngine.setAcceptHeader(acceptSparqlResults);
  18. // Make sure it was set somehow.
  19. if ( qEngine.getAcceptHeader() == null )
  20. throw new JenaConnectionException("No Accept header");
  21. return qExec ;
  22. }

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

  1. } else if (q2.isAskType()) {
  2. retval.setQueryAskType();
  3. } else if (q2.isDescribeType())

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

  1. } else if (q2.isAskType()) {
  2. retval.setQueryAskType();
  3. } else if (q2.isDescribeType())

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

  1. public static void executeQuery(Prologue prologue, QueryExecution queryExecution, ResultsFormat outputFormat) {
  2. Query query = queryExecution.getQuery() ;
  3. if ( prologue == null )
  4. prologue = query.getPrologue() ;
  5. if ( prologue == null )
  6. prologue = dftPrologue ;
  7. if ( query.isSelectType() )
  8. doSelectQuery(prologue, queryExecution, outputFormat) ;
  9. else if ( query.isDescribeType() )
  10. doDescribeQuery(prologue, queryExecution, outputFormat) ;
  11. else if ( query.isConstructQuad() )
  12. // Before isConstructType.
  13. doConstructQuadsQuery(prologue, queryExecution, outputFormat) ;
  14. else if ( query.isConstructType() )
  15. doConstructQuery(prologue, queryExecution, outputFormat) ;
  16. else if ( query.isAskType() )
  17. doAskQuery(prologue, queryExecution, outputFormat) ;
  18. else if ( query.isJsonType() )
  19. doJsonQuery(prologue, queryExecution, outputFormat) ;
  20. else
  21. throw new QueryException("Unrecognized query form");
  22. }

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

  1. } else if (query.isAskType()) {
  2. } else if (query.isDescribeType()) {
  3. sTemp = new SelectHandler(aggHandler);
  4. } else if (query.isConstructType()) {

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

  1. private QueryExecution createQueryExecution(Query query, String queryStringToSend) {
  2. QueryExecution qExec = new QueryEngineHTTP(svcQuery, queryStringToSend, httpClient, httpContext);
  3. QueryEngineHTTP qEngine = (QueryEngineHTTP)qExec;
  4. // Set the accept header - use the most specific method.
  5. if ( query != null ) {
  6. if ( query.isSelectType() && acceptSelectResult != null )
  7. qEngine.setAcceptHeader(acceptSelectResult);
  8. if ( query.isAskType() && acceptAskResult != null )
  9. qEngine.setAcceptHeader(acceptAskResult);
  10. if ( ( query.isConstructType() || query.isDescribeType() ) && acceptGraph != null )
  11. qEngine.setAcceptHeader(acceptGraph);
  12. if ( query.isConstructQuad() )
  13. qEngine.setDatasetContentType(acceptDataset);
  14. }
  15. // Use the general one.
  16. if ( qEngine.getAcceptHeader() == null && acceptSparqlResults != null )
  17. qEngine.setAcceptHeader(acceptSparqlResults);
  18. // Make sure it was set somehow.
  19. if ( qEngine.getAcceptHeader() == null )
  20. throw new JenaConnectionException("No Accept header");
  21. return qExec ;
  22. }

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

  1. } else if (query.isAskType()) {
  2. } else if (query.isDescribeType()) {
  3. sTemp = new SelectHandler(aggHandler);
  4. } else if (query.isConstructType()) {

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

  1. public void visit(QueryVisitor visitor)
  2. {
  3. visitor.startVisit(this) ;
  4. visitor.visitResultForm(this) ;
  5. visitor.visitPrologue(this) ;
  6. if ( this.isSelectType() )
  7. visitor.visitSelectResultForm(this) ;
  8. if ( this.isConstructType() )
  9. visitor.visitConstructResultForm(this) ;
  10. if ( this.isDescribeType() )
  11. visitor.visitDescribeResultForm(this) ;
  12. if ( this.isAskType() )
  13. visitor.visitAskResultForm(this) ;
  14. if ( this.isJsonType() )
  15. visitor.visitJsonResultForm(this) ;
  16. visitor.visitDatasetDecl(this) ;
  17. visitor.visitQueryPattern(this) ;
  18. visitor.visitGroupBy(this) ;
  19. visitor.visitHaving(this) ;
  20. visitor.visitOrderBy(this) ;
  21. visitor.visitOffset(this) ;
  22. visitor.visitLimit(this) ;
  23. visitor.visitValues(this) ;
  24. visitor.finishVisit(this) ;
  25. }

相关文章