Annotation Interface VariableResult
Used in conjunction with the
SparqlResultSetMapping
annotation or ConstructorResult
annotation to map
a column of the SELECT list of a SPARQL query.
The name element references the name of a variable in the SELECT list. Scalar result types can be included in the
query result by specifying this annotation in the metadata. If the variable is not bound in the result, null
is returned.
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 -
Optional Element Summary
Optional Elements
-
Element Details
-
name
String name(Required) The name of a variable in the SELECT clause of a SPARQL query.
-
-
-
type
Class<?> type(Optional) The Java type to which the variable mapping type is to be mapped.If the type element is not specified, the default OntoDriver type mapping for the variable mapping will be used.
- Default:
- void.class
-