Interface ObjectOntologyMapper

All Known Implementing Classes:
ObjectOntologyMapperImpl

public interface ObjectOntologyMapper
  • Method Details

    • containsEntity

      <T> boolean containsEntity(Class<T> cls, URI identifier, Descriptor descriptor)
      Checks whether the storage contains an individual with the specified identifier and of the specified type.
      Parameters:
      cls - Class representing the individual type
      identifier - Identifier
      descriptor - Descriptor, can specify context
      Returns:
      true if the ontology contains such an individual, false otherwise
    • loadEntity

      <T> T loadEntity(LoadingParameters<T> loadingParameters)
      Loads and reconstructs an entity from the ontology.
      Type Parameters:
      T - Entity type
      Parameters:
      loadingParameters - Entity loading parameters
      Returns:
      Reconstructed entity or null if there is none such
    • loadEntity

      <T> T loadEntity(AxiomBasedLoadingParameters<T> loadingParameters)
      Loads entity from the specified axioms.

      This means the axioms are (assumed to be) already loaded from the storage, and we only need to reconstruct the entity.

      Type Parameters:
      T - Entity type
      Parameters:
      loadingParameters - Entity loading parameters
      Returns:
      Loaded entity or null if no entity of the expected target class can be reconstructed
    • getReference

      <T> T getReference(LoadingParameters<T> loadingParameters)
      Gets a reference to an entity corresponding to the specified parameters.

      The reference is an empty object with state fetched upon first access.

      Type Parameters:
      T - Entity type
      Parameters:
      loadingParameters - Reference loading parameters
      Returns:
      Entity reference
    • loadFieldValue

      <T> void loadFieldValue(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor descriptor)
      Loads entity field value and sets it on the specified entity.
      Parameters:
      entity - The entity on which the field value will be set
      fieldSpec - The field to load
      descriptor - Descriptor possibly specifying the field context
    • generateIdentifier

      URI generateIdentifier(EntityType<?> et)
      Generates a fresh identifier for an instance of the specified entity type.
      Parameters:
      et - Entity type used as base for the identifier
      Returns:
      New entity identifier
    • persistEntity

      <T> void persistEntity(URI identifier, T entity, Descriptor descriptor)
      Persists the specified entity into the underlying ontology.
      Parameters:
      identifier - Identifier of the persisted entity, possibly null
      entity - The entity to persist
      descriptor - Descriptor possibly specifying entity and attribute contexts
    • removeEntity

      <T> void removeEntity(URI identifier, Class<T> cls, Descriptor descriptor)
      Removes entity with specified identifier from the ontology.
      Parameters:
      identifier - Entity identifier
      cls - Entity class
      descriptor - Descriptor specifying entity attribute contexts
    • checkForUnpersistedChanges

      void checkForUnpersistedChanges()
      Checks that there are not any pending changes in the mapper.
      Throws:
      UnpersistedChangeException - Thrown when there are unpersisted changes
    • updateFieldValue

      <T> void updateFieldValue(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor descriptor)
      Sets value of property represented by the specified field to the field's value.
      Parameters:
      entity - Entity containing the field
      fieldSpec - The field to update
      descriptor - Optionally specifies context
    • getAttributeAxioms

      <T> Set<Axiom<?>> getAttributeAxioms(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor entityDescriptor)
      Extracts the value of the specified field from the specified entity and transforms it to axioms.
      Type Parameters:
      T - Entity type
      Parameters:
      entity - Entity to extract attribute from
      fieldSpec - Field specification determining which values to extract
      entityDescriptor - Entity descriptor
      Returns:
      Set of axioms representing the field value
    • isInferred

      <T> boolean isInferred(T entity, FieldSpecification<? super T,?> fieldSpec, Object value, Descriptor entityDescriptor)
      Checks if the specified attribute value of the specified entity is inferred in the repository.

      Note that attribute context may be ignored by the underlying repository, based on its inference storing strategy. Also note that if the corresponding statement is both inferred and asserted, this method will return true.

      Type Parameters:
      T - Entity type
      Parameters:
      entity - Entity whose attribute value to examine
      fieldSpec - Field specification representing the property to examine
      value - Value whose inference status to examine
      entityDescriptor - Entity descriptor used to specify repository context
      Returns:
      true if the value is inferred, false otherwise