Class Export
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Export
- All Implemented Interfaces:
NewerNewStyleService
,STService
This class provides services for exporting the data managed by a project .
- Author:
- Manuel Fiorelli
-
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
downloadOrDeploy
(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, PluginSpecification deployerSpec, Source source) Download or deploy the data in the provided source.void
export
(jakarta.servlet.http.HttpServletResponse oRes, org.eclipse.rdf4j.model.IRI[] graphs, TransformationPipeline filteringPipeline, boolean includeInferred, String outputFormat, boolean force, PluginSpecification reformattingExporterSpec, PluginSpecification deployerSpec) Exports the content of the currently used project.static void
exportHelper
(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, org.eclipse.rdf4j.repository.RepositoryConnection sourceRepositoryConnection, org.eclipse.rdf4j.model.IRI[] graphs, TransformationPipeline filteringPipeline, boolean includeInferred, String outputFormat, boolean force, PluginSpecification deployerSpec, PluginSpecification reformattingExporterSpec) static void
formatAndThenDownloadOrDeploy
(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, org.eclipse.rdf4j.model.IRI[] graphs, boolean includeInferred, String outputFormat, PluginSpecification deployerSpec, org.eclipse.rdf4j.repository.RepositoryConnection workingRepositoryConnection, PluginSpecification reformattingExporterSpec) Depending on whetherdeployerSpec
is nonnull
, deploys the data or downloads itgetExportFormats
(String reformattingExporterID) Returns formats accepted by aReformattingExporter
.Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
Collection<org.eclipse.rdf4j.rio.RDFFormat>
GetsRDFFormat
s for which a writer is availablestatic void
write2requestResponse
(jakarta.servlet.http.HttpServletResponse oRes, RDFReporter source, org.eclipse.rdf4j.rio.RDFFormat outputFormat) Writes the provided formatted resource to the output stream of the HTTP responsestatic void
write2requestResponse
(jakarta.servlet.http.HttpServletResponse oRes, ClosableFormattedResource source) Writes the provided formatted resource to the output stream of the HTTP responseMethods 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
-
Export
public Export()
-
-
Method Details
-
getNamedGraphs
@STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(code)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> getNamedGraphs() -
getOutputFormats
GetsRDFFormat
s for which a writer is available- Returns:
- Throws:
Exception
-
getExportFormats
Returns formats accepted by aReformattingExporter
.- Parameters:
reformattingExporterID
-- Returns:
-
export
@STServiceOperation(method=POST) @Read @PreAuthorize("@auth.isAuthorized(\'rdf(code)\', \'R\')") public void export(jakarta.servlet.http.HttpServletResponse oRes, @Optional(defaultValue="") org.eclipse.rdf4j.model.IRI[] graphs, @Optional(defaultValue="[]") TransformationPipeline filteringPipeline, @Optional(defaultValue="false") boolean includeInferred, @Optional String outputFormat, @Optional(defaultValue="false") boolean force, @Optional PluginSpecification reformattingExporterSpec, @Optional PluginSpecification deployerSpec) throws Exception Exports the content of the currently used project. The RDF data can be transformed using aTransformationPipeline
, and optionally reformatted to a (usually non-RDF) format by means of aReformattingExporter
. The response of this operation is the actual data, if nodeployerSpec
is provided; otherwise, the standard response of a void service operation is written to the output stream, while the data are deployed somewhere else.- Parameters:
oRes
-graphs
- the graphs to be exported. An empty array means all graphs the name of which is an IRIfilteringPipeline
- a JSON string representing an array ofTransformationStep
. Each filter is applied to a subset of the exported graphs. No graph means every exported graphincludeInferred
- tells if inferred triples should be includedoutputFormat
- the output format. If it does not support graphs, the exported graph are merged into a single graphforce
-true
tells the service to proceed despite the presence of triples in the null context or in graphs named by blank nodes. Otherwise, under this conditions the service would fail, so that available information is not silently ignoredreformattingExporterSpec
- an optionalReformattingExporter
that reformats the data to a (usually non-RDF) formatdeployerSpec
- an optionalDeployer
to export the data somewhere instead of simply downloading it- Throws:
Exception
-
exportHelper
public static void exportHelper(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, org.eclipse.rdf4j.repository.RepositoryConnection sourceRepositoryConnection, org.eclipse.rdf4j.model.IRI[] graphs, TransformationPipeline filteringPipeline, boolean includeInferred, String outputFormat, boolean force, @Nullable PluginSpecification deployerSpec, @Nullable PluginSpecification reformattingExporterSpec) throws IOException, WrongPropertiesException, ExportPreconditionViolationException, IllegalArgumentException, STPropertyAccessException, InvalidConfigurationException, NoSuchExtensionException, ReformattingException -
formatAndThenDownloadOrDeploy
public static void formatAndThenDownloadOrDeploy(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, org.eclipse.rdf4j.model.IRI[] graphs, boolean includeInferred, String outputFormat, @Nullable PluginSpecification deployerSpec, org.eclipse.rdf4j.repository.RepositoryConnection workingRepositoryConnection, @Nullable PluginSpecification reformattingExporterSpec) throws IllegalArgumentException, NoSuchExtensionException, WrongPropertiesException, STPropertyAccessException, InvalidConfigurationException, IOException, ReformattingException Depending on whetherdeployerSpec
is nonnull
, deploys the data or downloads it- Parameters:
exptManager
-oRes
-graphs
-includeInferred
-outputFormat
-deployerSpec
-workingRepositoryConnection
-reformattingExporterSpec
-- Throws:
IllegalArgumentException
NoSuchExtensionException
WrongPropertiesException
STPropertyAccessException
InvalidConfigurationException
IOException
ReformattingException
-
downloadOrDeploy
public static void downloadOrDeploy(ExtensionPointManager exptManager, STServiceContext stServiceContext, jakarta.servlet.http.HttpServletResponse oRes, PluginSpecification deployerSpec, Source source) throws WrongPropertiesException, STPropertyAccessException, InvalidConfigurationException, IOException Download or deploy the data in the provided source. The type of source must match the kind of deployer. If there is no deployer, the the source must always be aFormattedResourceSource
.- Parameters:
exptManager
-stServiceContext
-oRes
-deployerSpec
-source
-- Throws:
WrongPropertiesException
STPropertyAccessException
InvalidConfigurationException
IOException
-
write2requestResponse
public static void write2requestResponse(jakarta.servlet.http.HttpServletResponse oRes, ClosableFormattedResource source) throws IOException Writes the provided formatted resource to the output stream of the HTTP response- Parameters:
oRes
-source
-- Throws:
IOException
-
write2requestResponse
public static void write2requestResponse(jakarta.servlet.http.HttpServletResponse oRes, RDFReporter source, org.eclipse.rdf4j.rio.RDFFormat outputFormat) throws IOException Writes the provided formatted resource to the output stream of the HTTP response- Parameters:
oRes
-source
-- Throws:
IOException
-