Annotation 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 -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionMaps the variables specified in the SELECT list of the query to the properties or fields of the entity class.
-
Element Details
-
entityClass
Class<?> entityClassThe class of the result.
-
-
-
fields
FieldResult[] fieldsMaps the variables specified in the SELECT list of the query to the properties or fields of the entity class.- Default:
- {}
-