public class RdfToCsv extends java.lang.Object implements ReverseConverter
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
attrGeom |
private static org.opengis.referencing.crs.CRSAuthorityFactory |
crsFactory |
private ReverseConfiguration |
currentConfig |
(package private) java.lang.String |
delimiter |
private java.lang.String |
encoding |
(package private) Assistant |
myAssistant |
(package private) java.lang.Integer |
numRecs |
private java.lang.String |
outputFile |
(package private) java.lang.String |
quotes |
private com.vividsolutions.jts.io.WKTReader |
reader |
private org.opengis.referencing.operation.MathTransform |
reproject |
(package private) int |
sourceSRID |
(package private) int |
targetSRID |
private java.io.BufferedWriter |
writer |
Constructor and Description |
---|
RdfToCsv(ReverseConfiguration config,
java.lang.String outFile,
int sourceSRID,
int targetSRID)
Constructor for the reverse transformation process from RDF to CSV file.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes output file, once all results have been written.
|
boolean |
createSchema(java.util.List<java.lang.String> attrList,
org.apache.jena.query.QuerySolution sol)
Determine schema with all attribute names to be used as the header of CSV file.
|
com.vividsolutions.jts.geom.Geometry |
getGeometry(java.lang.String g)
Identifies SRID (EPSG code) and geometry type from a WKT literal.
|
java.lang.String |
getGeometrySpec(org.apache.jena.rdf.model.Literal g)
Identifies SRID (EPSG code) and geometry type from a WKT literal.
|
java.lang.String |
getGeometrySpec(java.lang.String g)
Cleans up geometry literals and generates extended WKT (EWKT) representation, which includes the SRID (EPSG code).
|
java.lang.Integer |
store(java.util.List<java.lang.String> attrList,
java.util.List<java.util.List<java.lang.String>> results)
Creates a feature collection from current batch of records and writes them into the output CSV file.
|
Assistant myAssistant
private org.opengis.referencing.operation.MathTransform reproject
private com.vividsolutions.jts.io.WKTReader reader
int sourceSRID
int targetSRID
private ReverseConfiguration currentConfig
private java.lang.String outputFile
private java.lang.String encoding
private java.io.BufferedWriter writer
java.lang.String delimiter
java.lang.String quotes
java.lang.String attrGeom
java.lang.Integer numRecs
private static final org.opengis.referencing.crs.CRSAuthorityFactory crsFactory
public RdfToCsv(ReverseConfiguration config, java.lang.String outFile, int sourceSRID, int targetSRID)
config
- Parameters for Reverse Transformation.outFile
- Path to the output CSV file.sourceSRID
- Spatial reference system (EPSG code) of geometries in the input RDF triplestargetSRID
- Spatial reference system (EPSG code) of the output CSV filepublic void close()
close
in interface ReverseConverter
public boolean createSchema(java.util.List<java.lang.String> attrList, org.apache.jena.query.QuerySolution sol)
createSchema
in interface ReverseConverter
attrList
- List of attribute names. Attributes in the schema will be created in the same order as specified in the SELECT query that fetches results from the RDF graph.sol
- A single result (record) from a SELECT query in SPARQL.public java.lang.String getGeometrySpec(java.lang.String g)
getGeometrySpec
in interface ReverseConverter
g
- A geometry WKT string.public java.lang.Integer store(java.util.List<java.lang.String> attrList, java.util.List<java.util.List<java.lang.String>> results)
store
in interface ReverseConverter
attrList
- List of attribute names.results
- Collection of records in the current batch.public java.lang.String getGeometrySpec(org.apache.jena.rdf.model.Literal g)
ReverseConverter
getGeometrySpec
in interface ReverseConverter
g
- A geometry WKT literal.public com.vividsolutions.jts.geom.Geometry getGeometry(java.lang.String g)
ReverseConverter
getGeometry
in interface ReverseConverter
g
- A geometry WKT literal.