Package cz.cvut.kbss.jopa.oom
Class ObjectOntologyMapperImpl
java.lang.Object
cz.cvut.kbss.jopa.oom.ObjectOntologyMapperImpl
- All Implemented Interfaces:
ObjectOntologyMapper
,ConfigurationHolder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks that there are not any pending changes in the mapper.<T> boolean
containsEntity
(Class<T> cls, URI identifier, Descriptor descriptor) Checks whether the storage contains individual with the specified identifier and of the specified type.generateIdentifier
(EntityType<?> et) Generates a fresh identifier for an instance of the specified entity type.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.Gets provider configuration.<T> T
getEntityFromCacheOrOntology
(Class<T> cls, URI identifier, Descriptor descriptor) <T> IdentifiableEntityType<T>
getEntityType
(Class<T> cls) <T> T
getOriginalInstance
(T clone) <T> T
getReference
(LoadingParameters<T> loadingParameters) Gets a reference to an entity corresponding to the specified parameters.getUow()
boolean
isInferred
(Axiom<?> axiom, URI context) <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.boolean
isManagedType
(Class<?> cls) <T> T
loadEntity
(LoadingParameters<T> loadingParameters) Loads and reconstructs an entity from the ontology.<T> void
loadFieldValue
(T entity, FieldSpecification<? super T, ?> fieldSpec, Descriptor descriptor) Loads entity field value and sets it on the specified entity.Collection<Axiom<?>>
loadRdfContainer
(ContainerDescriptor containerDescriptor) Collection<Axiom<?>>
loadReferencedList
(ReferencedListDescriptor listDescriptor) loadSimpleList
(SimpleListDescriptor listDescriptor) <T> void
persistEntity
(URI identifier, T entity, Descriptor descriptor) Persists the specified entity into the underlying ontology.<T> void
removeEntity
(URI identifier, Class<T> cls, Descriptor descriptor) Removes entity with specified identifier from the ontology.<T> void
updateFieldValue
(T entity, FieldSpecification<? super T, ?> fieldSpec, Descriptor entityDescriptor) Sets value of property represented by the specified field to the field's value.
-
Constructor Details
-
ObjectOntologyMapperImpl
-
-
Method Details
-
containsEntity
Description copied from interface:ObjectOntologyMapper
Checks whether the storage contains individual with the specified identifier and of the specified type.- Specified by:
containsEntity
in interfaceObjectOntologyMapper
- Parameters:
cls
- Class representing the individual typeidentifier
- Identifierdescriptor
- Descriptor, can specify context- Returns:
true
if the ontology contains such individual,false
otherwise
-
loadEntity
Description copied from interface:ObjectOntologyMapper
Loads and reconstructs an entity from the ontology.- Specified by:
loadEntity
in interfaceObjectOntologyMapper
- Parameters:
loadingParameters
- Entity loading parameters- Returns:
- Reconstructed entity or
null
if there is none such
-
getReference
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 interfaceObjectOntologyMapper
- Type Parameters:
T
- Entity type- Parameters:
loadingParameters
- Reference loading parameters- Returns:
- Entity reference
-
getEntityType
-
isManagedType
-
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 interfaceObjectOntologyMapper
- Parameters:
entity
- The entity on which the field value will be setfieldSpec
- The field to loaddescriptor
- Descriptor possibly specifying the field context
-
persistEntity
Description copied from interface:ObjectOntologyMapper
Persists the specified entity into the underlying ontology.- Specified by:
persistEntity
in interfaceObjectOntologyMapper
- Parameters:
identifier
- Identifier of the persisted entity, possiblynull
entity
- The entity to persistdescriptor
- Descriptor possibly specifying entity and attribute contexts
-
generateIdentifier
Description copied from interface:ObjectOntologyMapper
Generates a fresh identifier for an instance of the specified entity type.- Specified by:
generateIdentifier
in interfaceObjectOntologyMapper
- Parameters:
et
- Entity type used as base for the identifier- Returns:
- New entity identifier
-
getEntityFromCacheOrOntology
-
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 interfaceObjectOntologyMapper
-
removeEntity
Description copied from interface:ObjectOntologyMapper
Removes entity with specified identifier from the ontology.- Specified by:
removeEntity
in interfaceObjectOntologyMapper
- Parameters:
identifier
- Entity identifiercls
- Entity classdescriptor
- 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 interfaceObjectOntologyMapper
- Parameters:
entity
- Entity containing the fieldfieldSpec
- The field to updateentityDescriptor
- Optionally specifies context
-
loadSimpleList
-
loadReferencedList
-
loadRdfContainer
-
getConfiguration
Description copied from interface:ConfigurationHolder
Gets provider configuration.- Specified by:
getConfiguration
in interfaceConfigurationHolder
- 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 interfaceObjectOntologyMapper
- Type Parameters:
T
- Entity type- Parameters:
entity
- Entity to extract attribute fromfieldSpec
- Field specification determining which values to extractentityDescriptor
- Entity descriptor- Returns:
- Set of axioms representing the field value
-
isInferred
-
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 interfaceObjectOntologyMapper
- Type Parameters:
T
- Entity type- Parameters:
entity
- Entity whose attribute value to examinefieldSpec
- Field specification representing the property to examinevalue
- Value whose inference status to examineentityDescriptor
- Entity descriptor used to specify repository context- Returns:
true
if the value is inferred,false
otherwise
-
getUow
-