Annotation Interface FieldResult


@Target({}) @Retention(RUNTIME) public @interface FieldResult
Used in conjunction with the EntityResult annotation to map columns specified in the SELECT list of a SPARQL query to the properties or fields of an entity class.

Note that if variable is not bound in result row, the field is skipped (its value is not set).

Example:

     
         Query q = em.createNativeQuery(
 "SELECT ?x, ?quantity, ?item, ?label, ?description "+
 "WHERE {
     ?x 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, fields = {
     @FieldResult(name="uri", variable="x")
 }),
 @EntityResult(entityClass=cz.cvut.kbss.jopa.Item.class)
 })
     
 
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Name of the persistent field or property of the class.
    Name of the variable in the SELECT clause.
  • Element Details

    • name

      String name
      Name of the persistent field or property of the class.
    • variable

      String variable
      Name of the variable in the SELECT clause.