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.ApplicationEventPublisherprotected CustomFormManagerprotected ExtensionPointManagerprotected STServiceContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddValue(org.eclipse.rdf4j.repository.RepositoryConnection repoConn, org.eclipse.rdf4j.model.Resource subject, org.eclipse.rdf4j.model.IRI predicate, SpecialValue value) protected voidcheckNotLocallyDefined(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.protected QueryBuildercreateQueryBuilder(String resourceQuery) protected StringfilterDeprecated(String resourceVar, boolean includeDeprecated) Piece of query shared by several tree/list services.org.eclipse.rdf4j.model.IRIgenerateIRI(String xRole, Map<String, org.eclipse.rdf4j.model.Value> valueMapping) Returns a new IRI for a resource.protected Stringprotected StringgenerateNatureSPARQLWherePart(String varName) protected org.eclipse.rdf4j.model.IRIgenerateResourceWithCustomConstructor(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.LexModelForSearchgetCodaLexModeForSearchFromLexicalizationModel(org.eclipse.rdf4j.model.IRI lexicalizationModel) org.eclipse.rdf4j.model.Resourcestatic Optional<org.eclipse.rdf4j.model.IRI>getGraphFromNature(String nature) protected it.uniroma2.art.coda.core.CODACoregetInitializedCodaCore(org.eclipse.rdf4j.repository.RepositoryConnection repoConnection) Returns an instance ofCODACoreto use in services.org.eclipse.rdf4j.repository.RepositoryConnectionorg.eclipse.rdf4j.model.Resourceprotected org.springframework.transaction.PlatformTransactionManagerorg.eclipse.rdf4j.repository.RepositoryReturns the repository for servicing a data request.static RDFResourceRolegetRoleFromNature(String nature) getShard()org.eclipse.rdf4j.model.Resource[]org.eclipse.rdf4j.model.Resourceprotected SearchStrategyprotected SearchStrategyinstantiateSearchStrategy(STRepositoryInfo.SearchStrategies searchStrategy) protected ReferenceparseReference(String relativeReference) protected voidpublishResourceDeleted(org.eclipse.rdf4j.model.Resource resource) protected voidpublishResourceDeleted(org.eclipse.rdf4j.model.Resource resource, RDFResourceRole role) protected voidremoveReifiedValue(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 voidresolveRemoteRepositoryAccess(RepositoryAccess repositoryAccess) Resolves repository access details (serverURL, username, password) for remote repositories.protected Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>retrieveResources(String queryString) protected voidshutDownCodaCore(it.uniroma2.art.coda.core.CODACore codaCore) Stops and shutdown the instance of CODACore.protected voidupdateTriplePredicate(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
-
getShard
-
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:
-
getOntologyManager
-
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 parameterxRoleholds 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 ofCODACoreto 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 tomodelAdditionsandmodelRemovalsReturns 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 ifnewResourceis 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:
CustomFormExceptionCODAExceptionPrefPrefLabelClashExceptionURIGenerationExceptionPrefAltLabelClashExceptionUnsupportedLexicalizationModelException
-
generateNatureSPARQLSelectPart
-
generateNatureSPARQLWherePart
-
filterDeprecated
Piece of query shared by several tree/list services. This piece, simply filter deprecated resources if includeDeprecated is false- Parameters:
resourceVar-includeDeprecated-- Returns:
-
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
-
resolveRemoteRepositoryAccess
protected void resolveRemoteRepositoryAccess(RepositoryAccess repositoryAccess) throws NoSuchSettingsManager, STPropertyAccessException Resolves repository access details (serverURL, username, password) for remote repositories. If an instance ID is provided, it fetches the corresponding configuration. If not, attempts to use a default instance (currently hardcoded as "GraphDBRepositoryConfigurer"). Throws if no configuration is available or the instance ID is invalid.- Parameters:
repositoryAccess- the repository access object to enrich with connection details- Throws:
NoSuchSettingsManagerSTPropertyAccessException
-