Class STServiceAdapter
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
- All Implemented Interfaces:
NewerNewStyleService
,STService
Base class of Semantic Turkey services.
- Author:
- Manuel Fiorelli
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationEventPublisher
protected CustomFormManager
protected ExtensionPointManager
protected STServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addValue
(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, SpecialValue value) protected void
checkNotLocallyDefined
(org.eclipse.rdf4j.repository.RepositoryConnection conn, org.eclipse.rdf4j.model.IRI resource) This is used to manually replicate the NotLocallyDefined constraint behaviour whereas a creation service (e.g. createInstance, createProperty, ...) receives a null IRI (copied fromMetadataRegistryBackendImpl
protected QueryBuilder
createQueryBuilder
(String resourceQuery) org.eclipse.rdf4j.model.IRI
generateIRI
(String xRole, Map<String, org.eclipse.rdf4j.model.Value> valueMapping) Returns a new IRI for a resource.protected String
protected String
generateNatureSPARQLWherePart
(String varName) protected org.eclipse.rdf4j.model.IRI
generateResourceWithCustomConstructor
(org.eclipse.rdf4j.repository.RepositoryConnection repoConnection, org.eclipse.rdf4j.model.IRI newResource, CustomFormValue customFormValue, StandardForm stdForm, org.eclipse.rdf4j.model.Model modelAdditions, org.eclipse.rdf4j.model.Model modelRemovals) Initialize the new created resource (and the xLabel in case of SKOSXL lex model), by running the CF provided within thecustomFormValue
.protected it.uniroma2.art.coda.core.UIMACODAUtilities.LexModelForSearch
getCodaLexModeForSearchFromLexicalizationModel
(org.eclipse.rdf4j.model.IRI lexicalizationModel) org.eclipse.rdf4j.model.Resource
static Optional<org.eclipse.rdf4j.model.IRI>
getGraphFromNature
(String nature) protected it.uniroma2.art.coda.core.CODACore
getInitializedCodaCore
(org.eclipse.rdf4j.repository.RepositoryConnection repoConnection) Returns an instance ofCODACore
to use in services.org.eclipse.rdf4j.repository.RepositoryConnection
org.eclipse.rdf4j.model.Resource
protected org.springframework.transaction.PlatformTransactionManager
org.eclipse.rdf4j.repository.Repository
Returns the repository for servicing a data request.static RDFResourceRole
getRoleFromNature
(String nature) org.eclipse.rdf4j.model.Resource[]
org.eclipse.rdf4j.model.Resource
protected SearchStrategy
protected SearchStrategy
instantiateSearchStrategy
(STRepositoryInfo.SearchStrategies searchStrategy) protected Reference
parseReference
(String relativeReference) protected void
publishResourceDeleted
(org.eclipse.rdf4j.model.Resource resource) protected void
publishResourceDeleted
(org.eclipse.rdf4j.model.Resource resource, RDFResourceRole role) protected void
removeReifiedValue
(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Resource value) protected Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
retrieveResources
(String queryString) protected void
shutDownCodaCore
(it.uniroma2.art.coda.core.CODACore codaCore) Stops and shutdown the instance of CODACore.protected void
updateTriplePredicate
(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.IRI newPredicate, org.eclipse.rdf4j.model.Value object)
-
Field Details
-
stServiceContext
-
applicationEventPublisher
@Autowired protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher -
cfManager
-
exptManager
-
-
Constructor Details
-
STServiceAdapter
public STServiceAdapter()
-
-
Method Details
-
getPlatformTransactionManager
protected org.springframework.transaction.PlatformTransactionManager getPlatformTransactionManager() -
getProject
-
getOptionalProject
-
getUserNamedGraphs
public org.eclipse.rdf4j.model.Resource[] getUserNamedGraphs() -
getWorkingGraph
public org.eclipse.rdf4j.model.Resource getWorkingGraph() -
getDeleteGraph
public org.eclipse.rdf4j.model.Resource getDeleteGraph() -
getMetadataGraph
public org.eclipse.rdf4j.model.Resource getMetadataGraph() -
getManagedConnection
public org.eclipse.rdf4j.repository.RepositoryConnection getManagedConnection() -
getRepository
public org.eclipse.rdf4j.repository.Repository getRepository()Returns the repository for servicing a data request. This operation is aware of different mechanisms that alter the repository, e.g. version dumps.- Returns:
-
retrieveResources
protected Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> retrieveResources(String queryString) -
createQueryBuilder
-
generateIRI
public org.eclipse.rdf4j.model.IRI generateIRI(String xRole, Map<String, org.eclipse.rdf4j.model.Value> valueMapping) throws URIGenerationExceptionReturns a new IRI for a resource. The parameterxRole
holds the nature of the resource that will be identified with the given URI. Depending on the value of the parameterxRole
, a conforming converter may generate differently shaped URIs, possibly using specific arguments passed via the mapargs
.- Parameters:
xRole
-valueMapping
-- Returns:
- Throws:
URIGenerationException
-
getInitializedCodaCore
protected it.uniroma2.art.coda.core.CODACore getInitializedCodaCore(org.eclipse.rdf4j.repository.RepositoryConnection repoConnection) Returns an instance ofCODACore
to use in services.- Parameters:
repoConnection
-- Returns:
- Throws:
ProjectInconsistentException
-
getCodaLexModeForSearchFromLexicalizationModel
protected it.uniroma2.art.coda.core.UIMACODAUtilities.LexModelForSearch getCodaLexModeForSearchFromLexicalizationModel(org.eclipse.rdf4j.model.IRI lexicalizationModel) -
shutDownCodaCore
protected void shutDownCodaCore(it.uniroma2.art.coda.core.CODACore codaCore) Stops and shutdown the instance of CODACore. This method should be called when it is finished using the instance of CODACore returned bygetInitializedCodaCore(RepositoryConnection)
- Parameters:
codaCore
-
-
addValue
protected void addValue(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, SpecialValue value) throws CODAException - Throws:
CODAException
-
updateTriplePredicate
protected void updateTriplePredicate(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.IRI newPredicate, org.eclipse.rdf4j.model.Value object) -
removeReifiedValue
protected void removeReifiedValue(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Resource value) throws it.uniroma2.art.coda.exception.parserexception.PRParserException - Throws:
it.uniroma2.art.coda.exception.parserexception.PRParserException
-
generateResourceWithCustomConstructor
protected org.eclipse.rdf4j.model.IRI generateResourceWithCustomConstructor(org.eclipse.rdf4j.repository.RepositoryConnection repoConnection, @Nullable org.eclipse.rdf4j.model.IRI newResource, CustomFormValue customFormValue, StandardForm stdForm, org.eclipse.rdf4j.model.Model modelAdditions, org.eclipse.rdf4j.model.Model modelRemovals) throws CustomFormException, CODAException Initialize the new created resource (and the xLabel in case of SKOSXL lex model), by running the CF provided within thecustomFormValue
. The updates produced by the CF execution are added tomodelAdditions
andmodelRemovals
Returns the IRI of the creating resource, which is: - generated through the CC, in case it is delegated, OR - the same provided in input (newResource
) Note that ifnewResource
is not provided and the CC is not delegated to create the resource, a runtime Exception is thrown- Parameters:
repoConnection
-newResource
- the resource being created. It is the one provided/generated in the calling service (e.g. createConcept, createCollection, ...) and represents the fallback IRI in case the CC is not delegated to the resource IRI creationcustomFormValue
-stdForm
-modelAdditions
-modelRemovals
-- Returns:
- Throws:
CustomFormException
CODAException
PrefPrefLabelClashException
URIGenerationException
PrefAltLabelClashException
UnsupportedLexicalizationModelException
-
generateNatureSPARQLSelectPart
-
generateNatureSPARQLWherePart
-
getRoleFromNature
-
getGraphFromNature
-
instantiateSearchStrategy
-
instantiateSearchStrategy
protected SearchStrategy instantiateSearchStrategy(STRepositoryInfo.SearchStrategies searchStrategy) -
parseReference
-
publishResourceDeleted
protected void publishResourceDeleted(org.eclipse.rdf4j.model.Resource resource, RDFResourceRole role) -
publishResourceDeleted
protected void publishResourceDeleted(org.eclipse.rdf4j.model.Resource resource) -
checkNotLocallyDefined
protected void checkNotLocallyDefined(org.eclipse.rdf4j.repository.RepositoryConnection conn, @Nullable org.eclipse.rdf4j.model.IRI resource) throws IllegalArgumentException This is used to manually replicate the NotLocallyDefined constraint behaviour whereas a creation service (e.g. createInstance, createProperty, ...) receives a null IRI (copied fromMetadataRegistryBackendImpl
- Parameters:
conn
-resource
-- Throws:
IllegalArgumentException
-