Class InputOutput
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.InputOutput
- All Implemented Interfaces:
NewerNewStyleService
,STService
This class provides services for input/output.
- Author:
- Manuel Fiorelli
-
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, exptManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clear the repository associated with the current projectCollection<org.eclipse.rdf4j.rio.RDFFormat>
GetsRDFFormat
s for which a parser is availablegetParserFormatForFileName
(String fileName) Tries to match the extension of a file name against the list of RDF formats that can be parsed (see:Rio.getParserFormatForFileName(String)
).getSupportedFormats
(String extensionID) Returns the formats that are accepted by an extension implementingFormatCapabilityProvider
.getWriterFormatForFileName
(String fileName) Tries to match the extension of a file name against the list of RDF formats that can be written (see:Rio.getWriterFormatForFileName(String)
).loadRDF
(org.springframework.web.multipart.MultipartFile inputFile, String baseURI, String format, TransitiveImportMethodAllowance transitiveImportAllowance, PluginSpecification loaderSpec, PluginSpecification rdfLifterSpec, TransformationPipeline transformationPipeline, boolean validateImplicitly, boolean targetGraphsFromData) Adds RDF data directly to the ontology being edited (i.e. it is not a read-only import of an external ontology that the working ontology depends on, but a mass add of RDF triples to the main graph of the working ontology).protected Collection<OntologyImport>
loadRDFInternal
(org.springframework.web.multipart.MultipartFile inputFile, String baseURI, String format, TransitiveImportMethodAllowance transitiveImportAllowance, org.eclipse.rdf4j.repository.RepositoryConnection conn, PluginSpecification loaderSpec, PluginSpecification rdfLifterSpec, TransformationPipeline transformationPipeline, boolean targetGraphsFromData) 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
-
InputOutput
public InputOutput()
-
-
Method Details
-
getSupportedFormats
Returns the formats that are accepted by an extension implementingFormatCapabilityProvider
.- Parameters:
extensionID
-- Returns:
-
getParserFormatForFileName
Tries to match the extension of a file name against the list of RDF formats that can be parsed (see:Rio.getParserFormatForFileName(String)
).- Parameters:
fileName
-- Returns:
- the name of the matched
RDFFormat
, ornull
if none is found
-
getWriterFormatForFileName
Tries to match the extension of a file name against the list of RDF formats that can be written (see:Rio.getWriterFormatForFileName(String)
).- Parameters:
fileName
-- Returns:
- the name of the matched
RDFFormat
, ornull
if none is found
-
loadRDF
@STServiceOperation(method=POST) @Write @PreAuthorize("#validateImplicitly ? @auth.isAuthorized(\'rdf(code)\', \'CV\') : @auth.isAuthorized(\'rdf(code)\', \'C\')") public Collection<OntologyImport> loadRDF(@Optional org.springframework.web.multipart.MultipartFile inputFile, String baseURI, @Optional String format, TransitiveImportMethodAllowance transitiveImportAllowance, @Optional PluginSpecification loaderSpec, @Optional PluginSpecification rdfLifterSpec, @Optional(defaultValue="[]") TransformationPipeline transformationPipeline, @Optional(defaultValue="false") boolean validateImplicitly, @Optional(defaultValue="false") boolean targetGraphsFromData) throws FileNotFoundException, IOException, org.eclipse.rdf4j.common.exception.RDF4JException, IllegalStateException, IllegalArgumentException, NoSuchExtensionException, WrongPropertiesException, STPropertyAccessException, InvalidConfigurationException, LiftingException Adds RDF data directly to the ontology being edited (i.e. it is not a read-only import of an external ontology that the working ontology depends on, but a mass add of RDF triples to the main graph of the working ontology). The data can originate from the body of the request (inputFile
is non-null) or be fetched from some source, by means of aLoader
(loaderSpec
is non-null). ALoader
can be associated with anRDFLifter
(rdfLifter
is non-null), when the data source is not a triple store (interpreted broadly as a source of RDF data). Whatever the source of the data is, it is possible to setup atransformationPipeline
, to transform the data before feeding it to the repository. The presence of a transformation pipeline requires the creation of a temporary repository, where data are first loaded and processed.- Parameters:
inputFile
-baseURI
-format
-transitiveImportAllowance
-loaderSpec
-rdfLifterSpec
-transformationPipeline
-validateImplicitly
-- Throws:
FileNotFoundException
IOException
InvalidConfigurationException
STPropertyAccessException
WrongPropertiesException
NoSuchExtensionException
IllegalArgumentException
IllegalStateException
org.eclipse.rdf4j.common.exception.RDF4JException
LiftingException
-
loadRDFInternal
protected Collection<OntologyImport> loadRDFInternal(@Nullable org.springframework.web.multipart.MultipartFile inputFile, String baseURI, @Nullable String format, TransitiveImportMethodAllowance transitiveImportAllowance, org.eclipse.rdf4j.repository.RepositoryConnection conn, @Nullable PluginSpecification loaderSpec, PluginSpecification rdfLifterSpec, TransformationPipeline transformationPipeline, boolean targetGraphsFromData) throws IOException, IllegalStateException, IllegalArgumentException, org.eclipse.rdf4j.common.exception.RDF4JException, NoSuchExtensionException, WrongPropertiesException, STPropertyAccessException, InvalidConfigurationException, LiftingException - Throws:
IOException
IllegalStateException
IllegalArgumentException
org.eclipse.rdf4j.common.exception.RDF4JException
NoSuchExtensionException
WrongPropertiesException
STPropertyAccessException
InvalidConfigurationException
LiftingException
-
clearData
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'rdf(code)\', \'D\')") public void clearData() throws ExceptionClear the repository associated with the current project- Throws:
Exception
-
getInputRDFFormats
GetsRDFFormat
s for which a parser is available- Returns:
-