Class SparqlQueryFactory

java.lang.Object
cz.cvut.kbss.jopa.query.sparql.SparqlQueryFactory

public class SparqlQueryFactory extends Object
Factory for creating SPARQL queries.
  • Constructor Details

  • Method Details

    • createNativeQuery

      public QueryImpl createNativeQuery(String sparql)
      Creates query object representing a native SPARQL query.
      Parameters:
      sparql - The query
      Returns:
      Query object
      Throws:
      NullPointerException - If sparql is null
    • createNativeQuery

      public <T> TypedQueryImpl<T> createNativeQuery(String sparql, Class<T> resultClass)
      Creates a TypedQuery object representing a native SPARQL query.
      Parameters:
      sparql - The query
      resultClass - Type of the results
      Returns:
      Query object
      Throws:
      NullPointerException - If sparql or resultClass is null
    • createNativeQuery

      public QueryImpl createNativeQuery(String sparql, String resultSetMapping)
      Creates a query object representing a native SPARQL query.
      Parameters:
      sparql - The query
      resultSetMapping - Name of the result set mapping to apply
      Returns:
      Query object
      Throws:
      NullPointerException - If sparql or resultSetMapping is null
    • createQuery

      public QueryImpl createQuery(String query)
      Creates query object representing a native SPARQL query.
      Parameters:
      query - The query
      Returns:
      Query object
      Throws:
      NullPointerException - If sparql is null
    • createQuery

      public <T> TypedQueryImpl<T> createQuery(String query, Class<T> resultClass)
      Creates a typed query object representing a native SPARQL query.
      Parameters:
      query - The query
      resultClass - Type of the results param URI of the ontology context against which the query will be evaluated
      Returns:
      Query object
      Throws:
      NullPointerException - If sparql or resultClass is null
    • createNamedQuery

      public QueryImpl createNamedQuery(String name)
      Creates a query object representing a native SPARQL query.
      Parameters:
      name - The name of the query defined in metadata
      Returns:
      Query object
      Throws:
      IllegalArgumentException - If a query has not been defined with the given name
    • createNamedQuery

      public <T> TypedQueryImpl<T> createNamedQuery(String name, Class<T> resultClass)
      Creates a typed query object representing a native SPARQL query.
      Parameters:
      name - The name of the query defined in metadata
      resultClass - Type of the results param URI of the ontology context against which the query will be evaluated
      Returns:
      Query object
      Throws:
      IllegalArgumentException - If a query has not been defined with the given name