Annotation Interface Sparql


@Documented @Retention(RUNTIME) @Target(FIELD) public @interface Sparql
This annotation can be used for creating SPARQL queries directly on repository fields.

The field and query parameters cannot be of a primitive type.

Example:

     
 @Sparql("PREFIX jopa:<http://krizik.felk.cvut.cz/ontologies/jopa/>\n" +
             "SELECT ?stringAttribute WHERE {" +
             "?this jopa:attributes#B-stringAttribute ?stringAttribute}")
        private String stringQueryAttribute;
     
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    A native SPARQL query including any prefixes and parameters.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Whether to allow referencing other entity attributes in the query.
    If FetchType.LAZY is specified the attribute will not be initialized during entity construction but rather only when it is required by a getter method.
  • Element Details

    • query

      String query
      A native SPARQL query including any prefixes and parameters.
    • enableReferencingAttributes

      boolean enableReferencingAttributes
      Whether to allow referencing other entity attributes in the query.

      If enabled, the provider will attempt to replace variables with names matching entity attributes with the attribute values.

      Note that lazily loaded attribute values may not be used.

      Returns:
      true if variables referencing other entity attributes should be replaced in the query with the attribute values, false otherwise
      Default:
      true
    • fetchType

      FetchType fetchType
      If FetchType.LAZY is specified the attribute will not be initialized during entity construction but rather only when it is required by a getter method.
      Default:
      EAGER