Class ObjectOntologyMapperImpl

java.lang.Object
cz.cvut.kbss.jopa.oom.ObjectOntologyMapperImpl
All Implemented Interfaces:
ObjectOntologyMapper, ConfigurationHolder

public class ObjectOntologyMapperImpl extends Object implements ObjectOntologyMapper
  • Constructor Details

  • Method Details

    • containsEntity

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

      public <T> T loadEntity(LoadingParameters<T> loadingParameters)
      Description copied from interface: ObjectOntologyMapper
      Loads and reconstructs an entity from the ontology.
      Specified by:
      loadEntity in interface ObjectOntologyMapper
      Parameters:
      loadingParameters - Entity loading parameters
      Returns:
      Reconstructed entity or null if there is none such
    • getReference

      public <T> T getReference(LoadingParameters<T> loadingParameters)
      Description copied from interface: ObjectOntologyMapper
      Gets a reference to an entity corresponding to the specified parameters.

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

      Specified by:
      getReference in interface ObjectOntologyMapper
      Type Parameters:
      T - Entity type
      Parameters:
      loadingParameters - Reference loading parameters
      Returns:
      Entity reference
    • getEntityType

      public <T> IdentifiableEntityType<T> getEntityType(Class<T> cls)
    • isManagedType

      public boolean isManagedType(Class<?> cls)
    • loadFieldValue

      public <T> void loadFieldValue(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor descriptor)
      Description copied from interface: ObjectOntologyMapper
      Loads entity field value and sets it on the specified entity.
      Specified by:
      loadFieldValue in interface ObjectOntologyMapper
      Parameters:
      entity - The entity on which the field value will be set
      fieldSpec - The field to load
      descriptor - Descriptor possibly specifying the field context
    • persistEntity

      public <T> void persistEntity(URI identifier, T entity, Descriptor descriptor)
      Description copied from interface: ObjectOntologyMapper
      Persists the specified entity into the underlying ontology.
      Specified by:
      persistEntity in interface ObjectOntologyMapper
      Parameters:
      identifier - Identifier of the persisted entity, possibly null
      entity - The entity to persist
      descriptor - Descriptor possibly specifying entity and attribute contexts
    • generateIdentifier

      public URI generateIdentifier(EntityType<?> et)
      Description copied from interface: ObjectOntologyMapper
      Generates a fresh identifier for an instance of the specified entity type.
      Specified by:
      generateIdentifier in interface ObjectOntologyMapper
      Parameters:
      et - Entity type used as base for the identifier
      Returns:
      New entity identifier
    • getEntityFromCacheOrOntology

      public <T> T getEntityFromCacheOrOntology(Class<T> cls, URI identifier, Descriptor descriptor)
    • getOriginalInstance

      public <T> T getOriginalInstance(T clone)
    • checkForUnpersistedChanges

      public void checkForUnpersistedChanges()
      Description copied from interface: ObjectOntologyMapper
      Checks that there are not any pending changes in the mapper.
      Specified by:
      checkForUnpersistedChanges in interface ObjectOntologyMapper
    • removeEntity

      public <T> void removeEntity(URI identifier, Class<T> cls, Descriptor descriptor)
      Description copied from interface: ObjectOntologyMapper
      Removes entity with specified identifier from the ontology.
      Specified by:
      removeEntity in interface ObjectOntologyMapper
      Parameters:
      identifier - Entity identifier
      cls - Entity class
      descriptor - Descriptor specifying entity attribute contexts
    • updateFieldValue

      public <T> void updateFieldValue(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor entityDescriptor)
      Description copied from interface: ObjectOntologyMapper
      Sets value of property represented by the specified field to the field's value.
      Specified by:
      updateFieldValue in interface ObjectOntologyMapper
      Parameters:
      entity - Entity containing the field
      fieldSpec - The field to update
      entityDescriptor - Optionally specifies context
    • loadSimpleList

      public Collection<Axiom<NamedResource>> loadSimpleList(SimpleListDescriptor listDescriptor)
    • loadReferencedList

      public Collection<Axiom<?>> loadReferencedList(ReferencedListDescriptor listDescriptor)
    • loadRdfContainer

      public Collection<Axiom<?>> loadRdfContainer(ContainerDescriptor containerDescriptor)
    • getConfiguration

      public Configuration getConfiguration()
      Description copied from interface: ConfigurationHolder
      Gets provider configuration.
      Specified by:
      getConfiguration in interface ConfigurationHolder
      Returns:
      Configuration
    • getAttributeAxioms

      public <T> Set<Axiom<?>> getAttributeAxioms(T entity, FieldSpecification<? super T,?> fieldSpec, Descriptor entityDescriptor)
      Description copied from interface: ObjectOntologyMapper
      Extracts the value of the specified field from the specified entity and transforms it to axioms.
      Specified by:
      getAttributeAxioms in interface ObjectOntologyMapper
      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

      public boolean isInferred(Axiom<?> axiom, URI context)
    • isInferred

      public <T> boolean isInferred(T entity, FieldSpecification<? super T,?> fieldSpec, Object value, Descriptor entityDescriptor)
      Description copied from interface: ObjectOntologyMapper
      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.

      Specified by:
      isInferred in interface ObjectOntologyMapper
      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
    • getUow

      public UnitOfWork getUow()