Annotation Interface EntityResult


@Target({}) @Retention(RUNTIME) public @interface EntityResult
Used in conjunction with the SparqlResultSetMapping annotation to map the SELECT clause of a SPARQL query to an entity result.

If this annotation is used, the SPARQL statement should select all of the variables that are mapped to the entity object. This should include attributes of related entities. The results obtained when insufficient data is available are undefined.

Example:

     
 Query q = em.createNativeQuery(
 "SELECT ?uri, ?quantity, ?item, ?label, ?description "+
 "WHERE {
     ?uri a <http://onto.fel.cvut.cz/ontologies/jopa/Order> ;
        <http://onto.fel.cvut.cz/ontologies/ufo/has_part> ?item .
     ?item a <http://onto.fel.cvut.cz/ontologies/jopa/Order> ;
           rdfs:label ?label;
           rdfs:comment ?description .
 }", "OrderItemResults");
 @SparqlResultSetMapping(name="OrderItemResults",
 entities={
 @EntityResult(entityClass=cz.cvut.kbss.jopa.Order.class),
 @EntityResult(entityClass=cz.cvut.kbss.jopa.Item.class)
 })
     
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The class of the result.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Maps the variables specified in the SELECT list of the query to the properties or fields of the entity class.
  • Element Details

    • entityClass

      Class<?> entityClass
      The class of the result.
    • fields

      FieldResult[] fields
      Maps the variables specified in the SELECT list of the query to the properties or fields of the entity class.
      Default:
      {}