Class GeoSPARQLOperations
java.lang.Object
org.apache.jena.geosparql.configuration.GeoSPARQLOperations
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic final Model
applyDefaultGeometry
(File inputFile, Lang inputLang) Apply hasDefaultGeometry for every Feature with a single hasGeometry property.static final void
applyDefaultGeometry
(File inputFile, Lang inputLang, File outputFile, Lang outputLang) Apply hasDefaultGeometry for every Feature with a single hasGeometry property.static final void
applyDefaultGeometry
(Dataset dataset) Apply hasDefaultGeometry for every Feature with a single hasGeometry property.static final void
applyDefaultGeometry
(Model model) Apply hasDefaultGeometry for every Feature with a single hasGeometry property.static final void
applyDefaultGeometryFolder
(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang) Apply (to a folder of RDF files) hasDefaultGeometry for every Feature with a single hasGeometry property.static final void
applyInferencing
(Dataset dataset) Apply GeoSPARQL inferencing using GeoSPARPQL v1.0 (corrected version) and RDFS reasoner.
Statements will be added to the dataset.static final void
applyInferencing
(Model dataModel) Apply GeoSPARQL inferencing using GeoSPARPQL v1.0 (corrected version) and RDFS reasoner.
Statements will be added to the dataModel.static final void
applyInferencing
(Model geosparqlSchema, Dataset dataset) Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Dataset.static final void
applyInferencing
(Model geosparqlSchema, Model model) Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Model.static final void
applyInferencing
(Model geosparqlSchema, Model model, String graphName) Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Model.
Graph name supplied for logging purposes only.static final void
applyPrefixes
(Dataset dataset) Apply a set of commonly used prefixes for GeoSPARQL URIs to the whole Dataset.static final void
applyPrefixes
(Model model) Apply a set of commonly used prefixes for GeoSPARQL URIs to the Model.static final void
Every subProperty of hasGeometry is made a subProperty of hasDefaultGeometry.
Assumption that each Feature has a single hasGeometry property.
Requires RDFS inferencing to propagate through the data.static double
cleanUpPrecision
(double value) Converts value according to the configured precision.static final Dataset
Convert the input dataset to the most frequent coordinate reference system and default datatype.static final Dataset
Convert the input dataset to the output coordinate reference system.static final Dataset
convert
(Dataset inputDataset, String outputSrsURI, GeometryDatatype outputDatatype) Convert the input dataset to the output coordinate reference system and geometry literal datatype.static final Dataset
convert
(Dataset dataset, GeometryDatatype outputDatatype) Convert the input dataset to the output geometry literal datatype.static final Model
Convert the input model to the most frequent coordinate reference system and default datatype.static final Model
Convert the input model to the output coordinate reference system.static final Model
Convert the input model to the output coordinate reference system and geometry literal datatype.static final Model
convert
(Model inputModel, String outputSrsURI, GeometryDatatype outputDatatype) Convert the input model to the output coordinate reference system and geometry literal datatype.static final Model
convert
(Model inputModel, GeometryDatatype outputDatatype) Convert the input model to the output geometry literal datatype.static final void
convertFile
(File inputFile, Lang inputLang, File outputFile, Lang outputLang) Converts file between serialisations.static final void
Converts all geometry literals (WKT or GML) from current SRS to the specified SRS.static final void
convertFile
(File inputFile, Lang inputLang, File outputFile, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype) Converts all geometry literals (WKT or GML) from current SRS to the specified SRS and datatype.static final void
convertFile
(File inputFile, Lang inputLang, File outputFile, Lang outputLang, GeometryDatatype outputDatatype) Converts all geometry literals (WKT or GML) to the specified datatype.static final void
convertFolder
(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang) Only RDF files should be in the input folder and must all be the same RDF language.static final void
convertFolder
(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI) Only RDF files should be in the input folder and must all be the same RDF language.static final void
convertFolder
(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype) Only RDF files should be in the input folder and must all be the same RDF language.static final void
convertFolder
(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, GeometryDatatype outputDatatype) Only RDF files should be in the input folder and must all be the same RDF language.static final String
convertGeometryLiteral
(String geometryLiteral, String outputSrsURI, GeometryDatatype outputDatatype) Convert a string representation of a geometry literal to another coordinate reference system.convertGeometryLiterals
(List<String> geometryLiterals, String outputSrsURI, GeometryDatatype outputDatatype) Convert a list of strings representation of geometry literals to another coordinate reference system.static final Dataset
convertGeometryStructure
(Dataset dataset) Convert Geometry Datatypes (WKT, GML, etc.) in Model to GeoSPARQL structure.
(Subject-property-GeometryLiteral) becomes (Feature-hasGeometry-Geometry) and (Geometry-hasSerialization-GeometryLiteral).
Original property will be removed from resulting Dataset.static final Model
convertGeometryStructure
(Model model) Convert Geometry Datatypes (WKT, GML, etc.) in Model to GeoSPARQL structure.
(Subject-property-GeometryLiteral) becomes (Feature-hasGeometry-Geometry) and (Geometry-hasSerialization-GeometryLiteral).
Original property will be removed from resulting Model.static final Dataset
convertGeoPredicates
(Dataset dataset, boolean isRemoveGeoPredicate) Convert Geo Predicates (Lat/Lon) in Dataset to WKT Geometry Literal.
Option to remove Lat and Lon predicates after combining.static final Model
convertGeoPredicates
(Model model, boolean isRemoveGeoPredicates) Convert Geo Predicates (Lat/Lon) in Model to WKT Geometry Literal.
Option to remove Lat and Lon predicates after combining.static final int
countGeometryLiterals
(Dataset dataset) static final int
countGeometryLiterals
(Model model, String graphName) static final String
findModeSRS
(Dataset dataset) Find the most frequent SRS URI of Geometry Literals in the dataset.static final String
findModeSRS
(Model model) Find the most frequent SRS URI of Geometry Literals in the model.static final Model
Load GeoSPARQL v1.0 (corrected version) as a Model.static final InfModel
prepare()
Prepare an empty GeoSPARQL model with RDFS reasoning.static final InfModel
prepare
(InputStream geosparqlSchemaInputStream, Model model, Reasoner reasoner) Prepare a model from an existing model with alternative GeoSPARQL schema and Reasoner, e.g.static final InfModel
prepare
(InputStream inputStream, Reasoner reasoner) Prepare a GeoSPARQL model from file with alternative Reasoner, e.g.static final InfModel
Prepare a GeoSPARQL model from an existing model with alternative Reasoner, e.g.static final InfModel
prepareRDFS
(InputStream inputStream) Prepare a GeoSPARQL model from file with RDFS reasoning.static final InfModel
prepareRDFS
(Model model) Prepare a GeoSPARQL model from an existing model with RDFS reasoning.static final boolean
validateGeometryLiteral
(Dataset dataset) Validate Geometry Literal in Dataset.static final boolean
validateGeometryLiteral
(Model model) Validate Geometry Literal in Model.static void
writeOutputModel
(Model outputModel, File outputFile, Lang outputLang, File inputFile)
-
Constructor Details
-
GeoSPARQLOperations
public GeoSPARQLOperations()
-
-
Method Details
-
applySubPropertyDefaultGeometry
Every subProperty of hasGeometry is made a subProperty of hasDefaultGeometry.
Assumption that each Feature has a single hasGeometry property.
Requires RDFS inferencing to propagate through the data.- Parameters:
model
-
-
applyDefaultGeometry
Apply hasDefaultGeometry for every Feature with a single hasGeometry property.- Parameters:
dataset
-
-
applyDefaultGeometry
Apply hasDefaultGeometry for every Feature with a single hasGeometry property.- Parameters:
model
-
-
applyDefaultGeometry
public static final void applyDefaultGeometry(File inputFile, Lang inputLang, File outputFile, Lang outputLang) Apply hasDefaultGeometry for every Feature with a single hasGeometry property.- Parameters:
inputFile
-inputLang
-outputFile
-outputLang
-
-
applyDefaultGeometry
Apply hasDefaultGeometry for every Feature with a single hasGeometry property.- Parameters:
inputFile
-inputLang
-- Returns:
- Output model.
-
applyDefaultGeometryFolder
public static final void applyDefaultGeometryFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang) Apply (to a folder of RDF files) hasDefaultGeometry for every Feature with a single hasGeometry property.
Only RDF files should be in the input folder and must all be the same RDF * language.- Parameters:
inputFolder
-inputLang
-outputFolder
-outputLang
-
-
loadGeoSPARQLSchema
Load GeoSPARQL v1.0 (corrected version) as a Model.- Returns:
- Model containing the schema.
-
applyInferencing
Apply GeoSPARQL inferencing using GeoSPARPQL v1.0 (corrected version) and RDFS reasoner.
Statements will be added to the dataset.- Parameters:
dataset
-
-
applyInferencing
Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Dataset.- Parameters:
geosparqlSchema
-dataset
-
-
applyInferencing
Apply GeoSPARQL inferencing using GeoSPARPQL v1.0 (corrected version) and RDFS reasoner.
Statements will be added to the dataModel.- Parameters:
dataModel
-
-
applyInferencing
Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Model.- Parameters:
geosparqlSchema
-model
-
-
applyInferencing
Apply GeoSPARQL inferencing using schema model and RDFS reasoner.
Statements will be added to the Model.
Graph name supplied for logging purposes only.- Parameters:
geosparqlSchema
-model
-graphName
-
-
prepare
Prepare an empty GeoSPARQL model with RDFS reasoning.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Returns:
- Output model.
-
prepareRDFS
Prepare a GeoSPARQL model from an existing model with RDFS reasoning.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Parameters:
model
-- Returns:
- Output model.
-
prepare
Prepare a GeoSPARQL model from an existing model with alternative Reasoner, e.g. OWL.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Parameters:
model
-reasoner
-- Returns:
- Output model.
-
prepareRDFS
Prepare a GeoSPARQL model from file with RDFS reasoning.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Parameters:
inputStream
-- Returns:
- Output model.
-
prepare
Prepare a GeoSPARQL model from file with alternative Reasoner, e.g. OWL.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Parameters:
inputStream
-reasoner
-- Returns:
- Output model.
-
prepare
public static final InfModel prepare(InputStream geosparqlSchemaInputStream, Model model, Reasoner reasoner) Prepare a model from an existing model with alternative GeoSPARQL schema and Reasoner, e.g. OWL.
In-memory indexing applied by default.
This can be changed by calling GeoSPARQLConfig methods.- Parameters:
geosparqlSchemaInputStream
-model
-reasoner
-- Returns:
- Output model.
-
validateGeometryLiteral
Validate Geometry Literal in Dataset.- Parameters:
dataset
-- Returns:
- Whether dataset is valid.
-
validateGeometryLiteral
Validate Geometry Literal in Model.- Parameters:
model
-- Returns:
- Whether model is valid.
-
findModeSRS
Find the most frequent SRS URI of Geometry Literals in the dataset.- Parameters:
dataset
-- Returns:
- SRS URI
- Throws:
SrsException
-
findModeSRS
Find the most frequent SRS URI of Geometry Literals in the model.- Parameters:
model
-- Returns:
- SRS URI
- Throws:
SrsException
-
convertFile
public static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, String outputSrsURI) Converts all geometry literals (WKT or GML) from current SRS to the specified SRS.- Parameters:
inputFile
-inputLang
-outputFile
-outputLang
-outputSrsURI
-
-
convertFile
public static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang) Converts file between serialisations.- Parameters:
inputFile
-inputLang
-outputFile
-outputLang
-
-
convertFile
public static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype) Converts all geometry literals (WKT or GML) from current SRS to the specified SRS and datatype.- Parameters:
inputFile
-inputLang
-outputFile
-outputLang
-outputSrsURI
-outputDatatype
-
-
convertFile
public static final void convertFile(File inputFile, Lang inputLang, File outputFile, Lang outputLang, GeometryDatatype outputDatatype) Converts all geometry literals (WKT or GML) to the specified datatype.- Parameters:
inputFile
-inputLang
-outputFile
-outputLang
-outputDatatype
-
-
convertGeometryLiterals
public static final List<String> convertGeometryLiterals(List<String> geometryLiterals, String outputSrsURI, GeometryDatatype outputDatatype) Convert a list of strings representation of geometry literals to another coordinate reference system.- Parameters:
geometryLiterals
-outputSrsURI
- Coordinate reference system URIoutputDatatype
-- Returns:
- Output of conversion.
-
writeOutputModel
-
convertFolder
public static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI) Only RDF files should be in the input folder and must all be the same RDF language.- Parameters:
inputFolder
-inputLang
-outputFolder
-outputLang
-outputSrsURI
-
-
convertFolder
public static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang) Only RDF files should be in the input folder and must all be the same RDF language.- Parameters:
inputFolder
-inputLang
-outputFolder
-outputLang
-
-
convertFolder
public static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, String outputSrsURI, GeometryDatatype outputDatatype) Only RDF files should be in the input folder and must all be the same RDF language. Output will be in the specified SRS and datatype/serialisation.- Parameters:
inputFolder
-inputLang
-outputFolder
-outputLang
-outputSrsURI
-outputDatatype
-
-
convertFolder
public static final void convertFolder(File inputFolder, Lang inputLang, File outputFolder, Lang outputLang, GeometryDatatype outputDatatype) Only RDF files should be in the input folder and must all be the same RDF language. Output will be in the specified datatype/serialisation.- Parameters:
inputFolder
-inputLang
-outputFolder
-outputLang
-outputDatatype
-
-
convertGeoPredicates
Convert Geo Predicates (Lat/Lon) in Dataset to WKT Geometry Literal.
Option to remove Lat and Lon predicates after combining.- Parameters:
dataset
-isRemoveGeoPredicate
-- Returns:
- Converted dataset.
-
convertGeoPredicates
Convert Geo Predicates (Lat/Lon) in Model to WKT Geometry Literal.
Option to remove Lat and Lon predicates after combining.- Parameters:
model
-isRemoveGeoPredicates
-- Returns:
- Converted model.
-
convertGeometryStructure
Convert Geometry Datatypes (WKT, GML, etc.) in Model to GeoSPARQL structure.
(Subject-property-GeometryLiteral) becomes (Feature-hasGeometry-Geometry) and (Geometry-hasSerialization-GeometryLiteral).
Original property will be removed from resulting Dataset.- Parameters:
dataset
-- Returns:
- Converted dataset.
-
convertGeometryStructure
Convert Geometry Datatypes (WKT, GML, etc.) in Model to GeoSPARQL structure.
(Subject-property-GeometryLiteral) becomes (Feature-hasGeometry-Geometry) and (Geometry-hasSerialization-GeometryLiteral).
Original property will be removed from resulting Model.- Parameters:
model
-- Returns:
- Converted model.
-
convertGeometryLiteral
public static final String convertGeometryLiteral(String geometryLiteral, String outputSrsURI, GeometryDatatype outputDatatype) Convert a string representation of a geometry literal to another coordinate reference system.- Parameters:
geometryLiteral
-outputSrsURI
- Coordinate reference system URIoutputDatatype
-- Returns:
- Output of conversion.
-
convert
Convert the input model to the most frequent coordinate reference system and default datatype.- Parameters:
inputModel
-- Returns:
- Output of conversion.
-
convert
Convert the input model to the output coordinate reference system.- Parameters:
inputModel
-outputSrsURI
-- Returns:
- Output of conversion.
-
convert
Convert the input model to the output geometry literal datatype.- Parameters:
inputModel
-outputDatatype
-- Returns:
- Output of conversion.
-
convert
public static final Model convert(Model inputModel, String outputSrsURI, GeometryDatatype outputDatatype) Convert the input model to the output coordinate reference system and geometry literal datatype.- Parameters:
inputModel
-outputSrsURI
-outputDatatype
-- Returns:
- Output of conversion.
-
convert
Convert the input model to the output coordinate reference system and geometry literal datatype.- Parameters:
inputModel
-outputSrsURI
-outputDatatypeURI
-- Returns:
- Output of conversion.
-
convert
Convert the input dataset to the most frequent coordinate reference system and default datatype.- Parameters:
dataset
-- Returns:
- Converted dataset.
-
convert
Convert the input dataset to the output coordinate reference system.- Parameters:
dataset
-outputSrsURI
-- Returns:
- Converted dataset.
-
convert
Convert the input dataset to the output geometry literal datatype.- Parameters:
dataset
-outputDatatype
-- Returns:
- Converted dataset.
-
convert
public static final Dataset convert(Dataset inputDataset, String outputSrsURI, GeometryDatatype outputDatatype) Convert the input dataset to the output coordinate reference system and geometry literal datatype.- Parameters:
inputDataset
-outputSrsURI
-outputDatatype
-- Returns:
- Converted dataset.
-
countGeometryLiterals
- Parameters:
model
-graphName
- Name of graph for logging purposes.- Returns:
- Number of Geometry Literals contained in Model.
-
countGeometryLiterals
- Parameters:
dataset
-- Returns:
- Count of Geometry Literals in whole Dataset.
-
applyPrefixes
Apply a set of commonly used prefixes for GeoSPARQL URIs to the Model.- Parameters:
model
-
-
applyPrefixes
Apply a set of commonly used prefixes for GeoSPARQL URIs to the whole Dataset.- Parameters:
dataset
-
-
cleanUpPrecision
public static double cleanUpPrecision(double value) Converts value according to the configured precision.- Parameters:
value
-- Returns:
- double
-