Annotation Interface SparqlResultSetMapping


@Target(TYPE) @Retention(RUNTIME) public @interface SparqlResultSetMapping
Specifies the mapping of the result of a native SPARQL query.

Example:

     
 Query q = em.createNativeQuery("SELECT ?uri ?label ?comment WHERE {" +
             "?uri a <http://onto.fel.cvut.cz/ontologies/jopa/Example> ;" +
                  "rdfs:label ?label ;" +
                  "rdfs:comment ?comment ." +
         "}", "ExampleResults");
     
 
     
 @SparqlResultSetMapping(name="ExampleResults",
          classes={
              @ConstructorResult(targetClass=cz.cvut.kbss.jopa.Example, variables={
                  @VariableResult(name="uri"),
                  @VariableResult(name="label"),
                  @VariableResult(name="comment")
              }
          }
      )
     
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name given to the result set mapping and used to refer to it in the methods of the Query API.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specifies the result set mapping to constructors.
    Specifies the result set mapping to entities.
    Specifies the result set mapping to scalar values.
  • Element Details

    • name

      String name
      The name given to the result set mapping and used to refer to it in the methods of the Query API.
    • classes

      Specifies the result set mapping to constructors.
      Default:
      {}
    • entities

      EntityResult[] entities
      Specifies the result set mapping to entities.
      Default:
      {}
    • variables

      VariableResult[] variables
      Specifies the result set mapping to scalar values.
      Default:
      {}