Class Refactor
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Refactor
- All Implemented Interfaces:
NewerNewStyleService
,STService
This class provides services to convert SKOS to SKOSXL data and SKOSXL to SKOS.
- Author:
- Andrea Turbati
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, exptManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeResourceURI
(org.eclipse.rdf4j.model.IRI oldResource, org.eclipse.rdf4j.model.IRI newResource) org.eclipse.rdf4j.model.IRI
generateConceptIRI
(org.eclipse.rdf4j.model.Literal label, List<org.eclipse.rdf4j.model.IRI> schemes) Generates a new URI for a SKOS concept, optionally given its accompanying preferred label and concept scheme.void
migrateDefaultGraphToBaseURIGraph
(boolean clearDestinationGraph) Moves the content of the default graph to a graph named after the base URI of the current project.void
moveXLabelToResource
(org.eclipse.rdf4j.model.Resource sourceResource, org.eclipse.rdf4j.model.IRI predicate, org.eclipse.rdf4j.model.Resource xLabel, org.eclipse.rdf4j.model.Resource targetResource, Boolean force) a refactoring service for moving xLabels to an existing concept ( ST-498 )void
replaceBaseURI
(org.eclipse.rdf4j.model.IRI sourceBaseURI, org.eclipse.rdf4j.model.IRI targetBaseURI) Replace thesourceBaseURI
with thetargetBaseURI
.void
SKOStoSKOSXL
(boolean reifyNotes) it refactor SKOS data into SKOSXLvoid
SKOSXLtoSKOS
(boolean flattenNotes) it refactor SKOSXL data into SKOSAnnotatedValue<org.eclipse.rdf4j.model.IRI>
spawnNewConceptFromLabel
(org.eclipse.rdf4j.model.IRI newConcept, org.eclipse.rdf4j.model.Resource xLabel, org.eclipse.rdf4j.model.IRI oldConcept, org.eclipse.rdf4j.model.Resource broaderConcept, List<org.eclipse.rdf4j.model.IRI> conceptSchemes, CustomFormValue customFormValue) a refactoring service for moving xLabels to new concepts ( ST-498 )Methods inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
addValue, checkNotLocallyDefined, createQueryBuilder, generateIRI, generateNatureSPARQLSelectPart, generateNatureSPARQLWherePart, generateResourceWithCustomConstructor, getCodaLexModeForSearchFromLexicalizationModel, getDeleteGraph, getGraphFromNature, getInitializedCodaCore, getManagedConnection, getMetadataGraph, getOptionalProject, getPlatformTransactionManager, getProject, getRepository, getRoleFromNature, getUserNamedGraphs, getWorkingGraph, instantiateSearchStrategy, instantiateSearchStrategy, parseReference, publishResourceDeleted, publishResourceDeleted, removeReifiedValue, retrieveResources, shutDownCodaCore, updateTriplePredicate
-
Constructor Details
-
Refactor
public Refactor()
-
-
Method Details
-
changeResourceURI
@STServiceOperation @Write @PreAuthorize("@auth.isAuthorized(\'rdf(\' +@auth.typeof(#oldResource)+ \')\', \'U\')") public void changeResourceURI(@LocallyDefined org.eclipse.rdf4j.model.IRI oldResource, org.eclipse.rdf4j.model.IRI newResource) throws DuplicatedResourceException - Throws:
DuplicatedResourceException
-
replaceBaseURI
@STServiceOperation(method=POST) @Write @PreAuthorize("@auth.isAuthorized(\'rdf(code)\', \'CRUD\')") public void replaceBaseURI(@Optional org.eclipse.rdf4j.model.IRI sourceBaseURI, org.eclipse.rdf4j.model.IRI targetBaseURI) throws ProjectUpdateException Replace thesourceBaseURI
with thetargetBaseURI
. IfsourceBaseURI
is not provided, replace the default baseURI.- Parameters:
sourceBaseURI
-targetBaseURI
-- Throws:
ProjectUpdateException
-
migrateDefaultGraphToBaseURIGraph
@STServiceOperation @Write @PreAuthorize("@auth.isAuthorized(\'rdf(code)\', \'CRUD\')") public void migrateDefaultGraphToBaseURIGraph(@Optional(defaultValue="false") boolean clearDestinationGraph) Moves the content of the default graph to a graph named after the base URI of the current project. This method clears the default graph and preserves (by default) the information already contained in the destination graph.- Parameters:
clearDestinationGraph
- Specifies whether the destination graph is cleared before the insert of triples from the default graph
-
SKOStoSKOSXL
@STServiceOperation @Write @PreAuthorize("@auth.isAuthorized(\'rdf(lexicalization)\', \'CD\')") public void SKOStoSKOSXL(boolean reifyNotes) throws URIGenerationException it refactor SKOS data into SKOSXL- Throws:
URIGenerationException
-
SKOSXLtoSKOS
@STServiceOperation @Write @PreAuthorize("@auth.isAuthorized(\'rdf(lexicalization)\', \'CD\')") public void SKOSXLtoSKOS(boolean flattenNotes) it refactor SKOSXL data into SKOS -
spawnNewConceptFromLabel
@STServiceOperation(method=POST) @Write @PreAuthorize("@auth.isAuthorized(\'rdf(concept)\', \'{lang: \'\'\' +@auth.langof(#xLabel)+ \'\'\'}\',\'C\')") public AnnotatedValue<org.eclipse.rdf4j.model.IRI> spawnNewConceptFromLabel(@Optional @NotLocallyDefined org.eclipse.rdf4j.model.IRI newConcept, @LocallyDefined org.eclipse.rdf4j.model.Resource xLabel, @Optional @LocallyDefined org.eclipse.rdf4j.model.IRI oldConcept, @Optional @LocallyDefined @Selection org.eclipse.rdf4j.model.Resource broaderConcept, @LocallyDefinedResources List<org.eclipse.rdf4j.model.IRI> conceptSchemes, @Optional CustomFormValue customFormValue) throws URIGenerationException, CustomFormException, CODAException, NonExistingLiteralFormForResourceException a refactoring service for moving xLabels to new concepts ( ST-498 )- Returns:
- the newCoceptIRI as an AnnotatedValue
- Throws:
URIGenerationException
CustomFormException
CODAException
NonExistingLiteralFormForResourceException
-
moveXLabelToResource
@STServiceOperation(method=POST) @Write @PreAuthorize("@auth.isAuthorized(\'rdf(\' +@auth.typeof(#sourceResource)+ \', lexicalization)\', \'{lang: \'\'\' +@auth.langof(#xLabel)+ \'\'\'}\', \'CD\')") public void moveXLabelToResource(@LocallyDefined org.eclipse.rdf4j.model.Resource sourceResource, org.eclipse.rdf4j.model.IRI predicate, @LocallyDefined org.eclipse.rdf4j.model.Resource xLabel, @LocallyDefined org.eclipse.rdf4j.model.Resource targetResource, @Optional(defaultValue="false") Boolean force) throws PrefPrefLabelClashException a refactoring service for moving xLabels to an existing concept ( ST-498 )- Parameters:
sourceResource
-predicate
-xLabel
-targetResource
-force
- set to true to create a new prefLabel for the targetResource even if this creates a conflict with another prefLabel belonging to a third resource- Throws:
PrefPrefLabelClashException
-
generateConceptIRI
public org.eclipse.rdf4j.model.IRI generateConceptIRI(org.eclipse.rdf4j.model.Literal label, List<org.eclipse.rdf4j.model.IRI> schemes) throws URIGenerationException Generates a new URI for a SKOS concept, optionally given its accompanying preferred label and concept scheme. The actual generation of the URI is delegated to#generateURI(String, Map)
, which in turn invokes the current binding for the extension pointURIGenerator
. In the end, the URI generator will be provided with the following:concept
as thexRole
- a map of additional parameters consisting of
label
andscheme
(each, if notnull
)
- Parameters:
label
- the preferred label accompanying the concept (can benull
)schemes
- the schemes to which the concept is being attached at the moment of its creation (can benull
)- Returns:
- Throws:
URIGenerationException
-