Class Sheet2RDF
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Sheet2RDF
- All Implemented Interfaces:
NewerNewStyleService
,STService
-
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, exptManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdvancedGraphApplicationToHeader
(String sheetName, String headerId, String graphPattern, List<String> nodeIds, Map<String, String> prefixMapping, org.eclipse.rdf4j.model.IRI defaultPredicate) void
addNodeToHeader
(String sheetName, String headerId, String nodeId, it.uniroma2.art.coda.interfaces.annotations.converters.RDFCapabilityType converterCapability, String converterContract, String converterDatatypeUri, String converterLanguage, Map<String, String> converterParams, String defaultNamespace, it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) Creates and adds a node to a header.void
addSimpleGraphApplicationToHeader
(String sheetName, String headerId, org.eclipse.rdf4j.model.IRI property, String nodeId, org.eclipse.rdf4j.model.IRI type) Creates and adds a new graph application to an headervoid
addTriples
(String sheetName) Simply adds the triples generated to the modelvoid
void
exportGlobalStatus
(jakarta.servlet.http.HttpServletResponse oRes) void
exportSheetStatus
(jakarta.servlet.http.HttpServletResponse oRes, String sheetName) Serializes a JSON file that represents the status of the conversion.void
exportTriples
(jakarta.servlet.http.HttpServletResponse oRes, String sheetName, org.eclipse.rdf4j.rio.RDFFormat outputFormat) getConfiguration
(String identifier) Returns the serialization of the configuration identified through the given identifier.Returns the default configurations references stored directly in the Sheet2RDF classpathcom.fasterxml.jackson.databind.JsonNode
getHeaderFromId
(String sheetName, String headerId) Returns information about the header structure with the given idcom.fasterxml.jackson.databind.JsonNode
Returns all the headers (mapping structs) of all the available sheetscom.fasterxml.jackson.databind.JsonNode
Returns the PEARL code generated by Excel2RDFcom.fasterxml.jackson.databind.JsonNode
getSheetHeaders
(String sheetName) Returns an array list containing the headers of the given sheetcom.fasterxml.jackson.databind.JsonNode
getTablePreview
(String sheetName, int maxRows) Returns a preview of the sheet containing the firstmaxRows
rowscom.fasterxml.jackson.databind.JsonNode
getTriplesPreview
(String sheetName, int maxTableRows) Returns triples generated by Sheet2RDF XML Response structure: data -> triple -> subject, predicate, object.void
ignoreHeader
(String sheetName, String headerId, boolean ignore) void
importGlobalStatus
(org.springframework.web.multipart.MultipartFile statusFile) void
importSheetStatus
(org.springframework.web.multipart.MultipartFile statusFile, String sheetName) isNodeIdAlreadyUsed
(String sheetName, String nodeId) Returns true if the given node id is already in use.void
removeGraphApplicationFromHeader
(String sheetName, String headerId, String graphId) Removes a graph application from an headervoid
removeNodeFromHeader
(String sheetName, String headerId, String nodeId) Removes a node from an header.void
renameNodeId
(String sheetName, String headerId, String nodeId, String newNodeId) void
replicateMultipleHeader
(String sheetName, String headerId) Given the header with the headerId, replicate its configuration for all the other headers with the same namevoid
Saves/updates the PEARL code eventually edited by uservoid
updateAdvancedGraphApplication
(String sheetName, String headerId, String graphId, String graphPattern, List<String> nodeIds, Map<String, String> prefixMapping, org.eclipse.rdf4j.model.IRI defaultPredicate) Updates an existing advanced graph application of an headervoid
updateGraphApplicationDelete
(String sheetName, String headerId, String graphId, boolean delete) void
updateNodeInHeader
(String sheetName, String headerId, String nodeId, it.uniroma2.art.coda.interfaces.annotations.converters.RDFCapabilityType converterCapability, String converterContract, String converterDatatypeUri, String converterLanguage, Map<String, String> converterParams, String defaultNamespace, it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) void
updateRuleSanitization
(String sheetName, it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) void
updateSimpleGraphApplication
(String sheetName, String headerId, String graphId, org.eclipse.rdf4j.model.IRI property, String nodeId, org.eclipse.rdf4j.model.IRI type) Updates an existing graph application of an headervoid
updateSubjectHeader
(String sheetName, String headerId, String converterContract, Map<String, String> converterParams, org.eclipse.rdf4j.model.IRI type, String defaultNamespace, List<Pair<org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value>> additionalPredObjs, it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) Update the subject headervoid
uploadDBInfo
(String db_base_url, String db_name, List<String> db_tableList, String db_user, String db_password, it.uniroma2.art.sheet2rdf.db.AvailableDBDriverName.Values db_driverName, it.uniroma2.art.sheet2rdf.utils.FsNamingStrategy fsNamingStrategy) Uploads an excel file into a server directorycom.fasterxml.jackson.databind.JsonNode
uploadPearl
(String sheetName, org.springframework.web.multipart.MultipartFile file) Uploads a pearl file into a server directory and returns the codevoid
uploadSpreadsheet
(org.springframework.web.multipart.MultipartFile file, it.uniroma2.art.sheet2rdf.utils.FsNamingStrategy fsNamingStrategy) Uploads an excel file into a server directorycom.fasterxml.jackson.databind.JsonNode
validateGraphPattern
(String pearlCode, boolean rulesShouldExists) It validated the PEARL rule and returns the used prefixes in the graph sectionMethods 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
-
Sheet2RDF
public Sheet2RDF()
-
-
Method Details
-
uploadSpreadsheet
@STServiceOperation(method=POST) @Read public void uploadSpreadsheet(org.springframework.web.multipart.MultipartFile file, @Optional(defaultValue="columnNumericIndex") it.uniroma2.art.sheet2rdf.utils.FsNamingStrategy fsNamingStrategy) throws IOException, it.uniroma2.art.sheet2rdf.exception.GenericSheet2RDFException Uploads an excel file into a server directory- Parameters:
file
-fsNamingStrategy
-- Throws:
IOException
it.uniroma2.art.sheet2rdf.exception.GenericSheet2RDFException
-
uploadDBInfo
@STServiceOperation(method=POST) @Read public void uploadDBInfo(String db_base_url, String db_name, List<String> db_tableList, String db_user, String db_password, it.uniroma2.art.sheet2rdf.db.AvailableDBDriverName.Values db_driverName, @Optional(defaultValue="columnNumericIndex") it.uniroma2.art.sheet2rdf.utils.FsNamingStrategy fsNamingStrategy) throws it.uniroma2.art.sheet2rdf.exception.GenericSheet2RDFException Uploads an excel file into a server directory- Parameters:
db_base_url
-db_name
-db_tableList
-db_user
-db_password
-fsNamingStrategy
-- Throws:
IOException
it.uniroma2.art.sheet2rdf.exception.GenericSheet2RDFException
-
getSupportedDBDrivers
-
listSheetNames
-
getHeaders
@STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode getHeaders() throws DOMExceptionReturns all the headers (mapping structs) of all the available sheets- Returns:
- Throws:
DOMException
-
getSheetHeaders
@STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode getSheetHeaders(String sheetName) throws DOMException Returns an array list containing the headers of the given sheet- Returns:
- Throws:
DOMException
-
getHeaderFromId
@STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode getHeaderFromId(String sheetName, String headerId) Returns information about the header structure with the given id- Parameters:
headerId
-- Returns:
- Throws:
DOMException
-
ignoreHeader
@STServiceOperation(method=POST) public void ignoreHeader(String sheetName, String headerId, boolean ignore) -
addSimpleGraphApplicationToHeader
@STServiceOperation(method=POST) public void addSimpleGraphApplicationToHeader(String sheetName, String headerId, org.eclipse.rdf4j.model.IRI property, String nodeId, @Optional org.eclipse.rdf4j.model.IRI type) Creates and adds a new graph application to an header- Parameters:
headerId
- id of the headerproperty
- property of the graph applicationnodeId
- node id of the graph applicationtype
- the optional rdf:type of the node
-
addAdvancedGraphApplicationToHeader
-
updateSimpleGraphApplication
@STServiceOperation(method=POST) public void updateSimpleGraphApplication(String sheetName, String headerId, String graphId, org.eclipse.rdf4j.model.IRI property, String nodeId, @Optional org.eclipse.rdf4j.model.IRI type) Updates an existing graph application of an header- Parameters:
headerId
- id of the headergraphId
- id of the existing graph applicationproperty
- property of the graph applicationnodeId
- node id of the graph applicationtype
- the optional rdf:type of the node
-
updateAdvancedGraphApplication
@STServiceOperation(method=POST) public void updateAdvancedGraphApplication(String sheetName, String headerId, String graphId, String graphPattern, List<String> nodeIds, Map<String, String> prefixMapping, @Optional org.eclipse.rdf4j.model.IRI defaultPredicate) Updates an existing advanced graph application of an header- Parameters:
headerId
- id of the headergraphId
- id of the existing graph applicationgraphPattern
- updated graph patternnodeIds
- updated list of referenced node idsdefaultPredicate
- predicate for the fallback of the pred placeholder in the pattern
-
updateGraphApplicationDelete
@STServiceOperation(method=POST) public void updateGraphApplicationDelete(String sheetName, String headerId, String graphId, boolean delete) - Parameters:
headerId
-graphId
-delete
-
-
removeGraphApplicationFromHeader
@STServiceOperation(method=POST) public void removeGraphApplicationFromHeader(String sheetName, String headerId, String graphId) Removes a graph application from an header- Parameters:
headerId
- id of the headergraphId
- id of the existing graph application
-
isNodeIdAlreadyUsed
Returns true if the given node id is already in use. Check useful when creating/updating a node- Parameters:
nodeId
-- Returns:
-
addNodeToHeader
@Read @STServiceOperation(method=POST) public void addNodeToHeader(String sheetName, String headerId, String nodeId, it.uniroma2.art.coda.interfaces.annotations.converters.RDFCapabilityType converterCapability, String converterContract, @Optional String converterDatatypeUri, @Optional String converterLanguage, @Optional Map<String, String> converterParams, @Optional String defaultNamespace, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) Creates and adds a node to a header. Note: This service does not perform any check on node ID collision. This check should be done separately viaisNodeIdAlreadyUsed(String, String)
Note 2: The creation of a node doesn't imply that it is used in a graph application. This needs to be done separately (with add/update Simple/Advanced GraphApplicationToHeader}- Parameters:
headerId
-nodeId
-converterCapability
-converterContract
-converterDatatypeUri
-converterLanguage
-converterParams
-memoize
-
-
updateNodeInHeader
@Read @STServiceOperation(method=POST) public void updateNodeInHeader(String sheetName, String headerId, String nodeId, it.uniroma2.art.coda.interfaces.annotations.converters.RDFCapabilityType converterCapability, String converterContract, @Optional String converterDatatypeUri, @Optional String converterLanguage, @Optional Map<String, String> converterParams, @Optional String defaultNamespace, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) -
updateRuleSanitization
@STServiceOperation(method=POST) public void updateRuleSanitization(String sheetName, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) -
renameNodeId
-
removeNodeFromHeader
@STServiceOperation(method=POST) public void removeNodeFromHeader(String sheetName, String headerId, String nodeId) Removes a node from an header. If the node is used/referenced by a graph application, updates the graph application as well.- Parameters:
headerId
- id of the headernodeId
- id of the existing node
-
replicateMultipleHeader
@STServiceOperation(method=POST) public void replicateMultipleHeader(String sheetName, String headerId) Given the header with the headerId, replicate its configuration for all the other headers with the same name- Parameters:
headerId
-
-
updateSubjectHeader
@Read @STServiceOperation(method=POST) public void updateSubjectHeader(String sheetName, String headerId, String converterContract, @Optional Map<String, String> converterParams, @Optional org.eclipse.rdf4j.model.IRI type, @Optional String defaultNamespace, @Optional(defaultValue="[]") @JsonSerialized List<Pair<org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value>> additionalPredObjs, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeMemoization memoization, @Optional @JsonSerialized it.uniroma2.art.sheet2rdf.header.NodeSanitization sanitization) Update the subject header- Parameters:
headerId
-type
-converterContract
-converterParams
-memoize
-
-
getTablePreview
@STServiceOperation public com.fasterxml.jackson.databind.JsonNode getTablePreview(String sheetName, int maxRows) throws it.uniroma2.art.sheet2rdf.exception.NotExistingSheetException Returns a preview of the sheet containing the firstmaxRows
rows- Parameters:
maxRows
-- Returns:
- Throws:
it.uniroma2.art.sheet2rdf.exception.NotExistingSheetException
-
getPearl
@STServiceOperation public com.fasterxml.jackson.databind.JsonNode getPearl(String sheetName) throws IOException Returns the PEARL code generated by Excel2RDF- Returns:
- Throws:
IOException
-
savePearl
@STServiceOperation(method=POST) public void savePearl(String sheetName, String pearlCode) throws IOException Saves/updates the PEARL code eventually edited by user- Throws:
FileNotFoundException
IOException
-
validateGraphPattern
@STServiceOperation(method=POST) public com.fasterxml.jackson.databind.JsonNode validateGraphPattern(String pearlCode, @Optional(defaultValue="true") boolean rulesShouldExists) It validated the PEARL rule and returns the used prefixes in the graph section -
uploadPearl
@STServiceOperation(method=POST) public com.fasterxml.jackson.databind.JsonNode uploadPearl(String sheetName, org.springframework.web.multipart.MultipartFile file) throws IOException Uploads a pearl file into a server directory and returns the code- Parameters:
file
-- Returns:
- Throws:
IOException
-
getTriplesPreview
@STServiceOperation @Read public com.fasterxml.jackson.databind.JsonNode getTriplesPreview(String sheetName, int maxTableRows) throws org.apache.uima.UIMAException, it.uniroma2.art.coda.exception.parserexception.PRParserException, it.uniroma2.art.coda.provisioning.ComponentProvisioningException, it.uniroma2.art.coda.exception.ConverterException, it.uniroma2.art.coda.exception.DependencyException, it.uniroma2.art.coda.exception.RDFModelNotSetException, it.uniroma2.art.coda.exception.ProjectionRuleModelNotSet, it.uniroma2.art.coda.exception.UnassignableFeaturePathException, it.uniroma2.art.sheet2rdf.exception.NotExistingSheetException, it.uniroma2.art.coda.exception.ValueNotPresentDueToConfigurationException Returns triples generated by Sheet2RDF XML Response structure: data -> triple -> subject, predicate, object. This means that inside data element will be some triple element containing subject predicate and object element- Parameters:
maxTableRows
- max number of table rows to consider in the triples preview (e.g. returns the triples generated considering the first 10 rows)- Returns:
- Throws:
org.eclipse.rdf4j.query.QueryEvaluationException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
it.uniroma2.art.coda.exception.ConverterException
it.uniroma2.art.coda.provisioning.ComponentProvisioningException
it.uniroma2.art.coda.exception.parserexception.PRParserException
org.apache.uima.UIMAException
it.uniroma2.art.coda.exception.DependencyException
it.uniroma2.art.coda.exception.RDFModelNotSetException
it.uniroma2.art.coda.exception.UnassignableFeaturePathException
it.uniroma2.art.coda.exception.ProjectionRuleModelNotSet
Exception
it.uniroma2.art.sheet2rdf.exception.NotExistingSheetException
it.uniroma2.art.coda.exception.ValueNotPresentDueToConfigurationException
-
addTriples
Simply adds the triples generated to the model -
exportTriples
@STServiceOperation public void exportTriples(jakarta.servlet.http.HttpServletResponse oRes, String sheetName, org.eclipse.rdf4j.rio.RDFFormat outputFormat) throws IOException - Throws:
IOException
-
getPrefixMappings
-
exportSheetStatus
@STServiceOperation public void exportSheetStatus(jakarta.servlet.http.HttpServletResponse oRes, String sheetName) throws IOException Serializes a JSON file that represents the status of the conversion.- Parameters:
oRes
-- Throws:
IOException
com.fasterxml.jackson.databind.JsonMappingException
com.fasterxml.jackson.core.JsonGenerationException
-
exportGlobalStatus
@STServiceOperation public void exportGlobalStatus(jakarta.servlet.http.HttpServletResponse oRes) throws IOException - Throws:
IOException
-
importSheetStatus
@Read @STServiceOperation(method=POST) public void importSheetStatus(org.springframework.web.multipart.MultipartFile statusFile, String sheetName) throws IOException, it.uniroma2.art.sheet2rdf.exception.InvalidWizardStatusException - Parameters:
statusFile
-- Throws:
it.uniroma2.art.sheet2rdf.exception.InvalidWizardStatusException
- Load a JSON file that represents the status of the conversion and restore the mapping structIOException
-
importGlobalStatus
@Read @STServiceOperation(method=POST) public void importGlobalStatus(org.springframework.web.multipart.MultipartFile statusFile) throws IOException, it.uniroma2.art.sheet2rdf.exception.InvalidWizardStatusException - Throws:
IOException
it.uniroma2.art.sheet2rdf.exception.InvalidWizardStatusException
-
getDefaultAdvancedGraphApplicationConfigurations
Returns the default configurations references stored directly in the Sheet2RDF classpath- Returns:
-
getConfiguration
@STServiceOperation public Configuration getConfiguration(String identifier) throws STPropertyAccessException, IOException Returns the serialization of the configuration identified through the given identifier.- Parameters:
identifier
-- Returns:
- Throws:
STPropertyAccessException
IOException
-
closeSession
-