public class RMLConverter extends java.lang.Object implements Converter
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
attrAssignedCategory |
(package private) java.util.Map<java.lang.String,java.lang.Integer> |
attrStatistics |
(package private) java.lang.String[] |
csvHeader |
private static Configuration |
currentConfig |
private long |
dt |
(package private) java.lang.String[] |
exeTriplesMap |
(package private) be.ugent.mmlab.rml.model.TriplesMap[] |
maps |
com.vividsolutions.jts.geom.Envelope |
mbr |
private Assistant |
myAssistant |
private FeatureRegister |
myRegister |
private int |
numRec |
private int |
numTriples |
(package private) java.lang.String |
paramCategoryURI |
(package private) java.util.Map<java.lang.String,java.lang.String> |
parameters |
(package private) java.lang.String |
paramFeatureURI |
(package private) be.ugent.mmlab.rml.performer.RMLPerformer[] |
performers |
private java.io.BufferedWriter |
registryWriter |
private int |
rejectedRec |
private long |
t_start |
(package private) java.lang.String |
templateCategoryURI |
(package private) java.lang.String |
templateFeatureURI |
Constructor and Description |
---|
RMLConverter(Configuration config,
Assistant assist,
java.lang.String outputFile)
Constructs a RMLConverter object that will conduct transformation at RML mode.
|
Modifier and Type | Method and Description |
---|---|
private void |
collectTuples4Registry()
Collects tuples generated from a batch of features (their basic thematic attributes and their geometries) and streamlines them to a file for the SLIPO Registry.
|
com.vividsolutions.jts.geom.Envelope |
getMBR()
Provides the MBR of the geographic dataset that has been transformed.
|
org.apache.jena.rdf.model.Model |
getModel()
Provides the disk-based model consisting of transformed triples.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getStatistics()
Provides statistics collected for each attribute after transformation.
|
java.lang.String |
getTDBDir()
Returns the local directory that holds the disk-based RDF graph for this transformation thread.
|
java.util.List<org.apache.jena.graph.Triple> |
getTriples()
Provides triples resulting from transformation.
|
java.lang.String |
getURItemplate4Classification()
Provides the URI template used for all subjects in RDF triples concerning the classification hierarchy.
|
java.lang.String |
getURItemplate4Feature()
Provides the URI template used for all subjects in RDF triples concerning features.
|
void |
parse(org.geotools.feature.FeatureIterator<?> iterator,
Classification classific,
org.opengis.referencing.operation.MathTransform reproject,
int targetSRID,
java.lang.String outputFile)
Parses each record from a FeatureIterator and streamlines the resulting triples (including geometric and non-spatial attributes) according to the given RML mapping.
|
void |
parse(java.util.Iterator<org.apache.commons.csv.CSVRecord> records,
Classification classific,
org.opengis.referencing.operation.MathTransform reproject,
int targetSRID,
java.lang.String outputFile)
Parses each record from a collection of CSV records and streamlines the resulting triples (including geometric and non-spatial attributes) according to the given RML mapping.
|
void |
parse(OSMRecord rs,
Classification classific,
org.opengis.referencing.operation.MathTransform reproject,
int targetSRID)
Parses a single OSM record and streamlines the resulting triples (including geometric and non-spatial attributes) according to the given RML mapping.
|
void |
parse(java.sql.ResultSet rs,
Classification classific,
org.opengis.referencing.operation.MathTransform reproject,
int targetSRID,
java.lang.String outputFile)
Parses each record from a ResultSet and streamlines the resulting triples (including geometric and non-spatial attributes) according to the given RML mapping.
|
void |
parse(java.lang.String wkt,
java.util.Map<java.lang.String,java.lang.String> attrValues,
Classification classific,
int targetSRID,
org.opengis.referencing.operation.MathTransform reproject,
java.lang.String geomType,
int partition_index,
java.lang.String outputFile)
Parses a Map structure of (key, value) pairs and streamlines the resulting triples (including geometric and non-spatial attributes).
|
void |
parse(java.lang.String wkt,
java.util.Map<java.lang.String,java.lang.String> attrValues,
Classification classific,
int targetSRID,
java.lang.String geomType)
Parses a single GPX waypoint/track or a single JSON node and streamlines the resulting triples (including geometric and non-spatial attributes) according to the given RML mapping.
|
void |
parseWithRML(java.util.HashMap<java.lang.String,java.lang.String> row,
be.ugent.mmlab.rml.model.dataset.RMLDataset dataset)
Converts a row (with several attribute values, including geometry) into suitable triples according to the specified RML mappings.
|
void |
setHeader(java.lang.String[] header)
Retains the header (column names) of an input CSV file.
|
void |
store(java.lang.String outputFile)
Stores resulting tuples into a file for the SLIPO Registry.
|
void |
store(java.lang.String outputFile,
int partition_index)
Finalizes storage of resulting tuples into a file.
|
void |
updateMBR(com.vividsolutions.jts.geom.Geometry g)
Updates the MBR of the geographic dataset as this is being transformed.
|
private void |
updateStatistics(java.lang.String attrKey)
Update statistics for the given attribute during transformation.
|
int |
writeTriples(be.ugent.mmlab.rml.model.dataset.RMLDataset dataset,
java.io.BufferedWriter writer,
org.openrdf.rio.RDFFormat rdfFormat,
java.lang.String encoding)
Serializes the given RML dataset as triples written into a file.
|
int |
writeTriples(be.ugent.mmlab.rml.model.dataset.RMLDataset dataset,
java.io.OutputStream writer,
org.openrdf.rio.RDFFormat rdfFormat)
Serializes the given RML dataset as triples written into a file.
|
private static Configuration currentConfig
private java.io.BufferedWriter registryWriter
private Assistant myAssistant
private FeatureRegister myRegister
be.ugent.mmlab.rml.performer.RMLPerformer[] performers
java.lang.String[] exeTriplesMap
java.util.Map<java.lang.String,java.lang.String> parameters
be.ugent.mmlab.rml.model.TriplesMap[] maps
java.lang.String paramFeatureURI
java.lang.String templateFeatureURI
java.lang.String paramCategoryURI
java.lang.String templateCategoryURI
java.lang.String attrAssignedCategory
java.util.Map<java.lang.String,java.lang.Integer> attrStatistics
java.lang.String[] csvHeader
private long t_start
private long dt
private int numRec
private int rejectedRec
private int numTriples
public com.vividsolutions.jts.geom.Envelope mbr
public RMLConverter(Configuration config, Assistant assist, java.lang.String outputFile)
config
- User-specified configuration for the transformation process.assist
- Assistant to perform auxiliary operations.outputFile
- Output file that will collect resulting triples.private void updateStatistics(java.lang.String attrKey)
attrKey
- Attribute name for which to update statistics.public java.util.Map<java.lang.String,java.lang.Integer> getStatistics()
public void updateMBR(com.vividsolutions.jts.geom.Geometry g)
g
- Geometry that will be checked for possible expansion of the MBR of all features processed thus farpublic com.vividsolutions.jts.geom.Envelope getMBR()
public void parse(org.geotools.feature.FeatureIterator<?> iterator, Classification classific, org.opengis.referencing.operation.MathTransform reproject, int targetSRID, java.lang.String outputFile)
parse
in interface Converter
iterator
- FeatureIterator over spatial features collected from an ESRI shapefile of a GeoJSON file.classific
- Instantiation of the classification scheme that assigns categories to input features.reproject
- CRS transformation parameters to be used in reprojecting a geometry to a target SRID (EPSG code).targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.outputFile
- Path to the output file that collects RDF triples.public void parse(java.sql.ResultSet rs, Classification classific, org.opengis.referencing.operation.MathTransform reproject, int targetSRID, java.lang.String outputFile)
parse
in interface Converter
rs
- ResultSet containing spatial features retrieved from a DBMS.classific
- Instantiation of the classification scheme that assigns categories to input features.reproject
- CRS transformation parameters to be used in reprojecting a geometry to a target SRID (EPSG code).targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.outputFile
- Path to the output file that collects RDF triples.public void parse(java.util.Iterator<org.apache.commons.csv.CSVRecord> records, Classification classific, org.opengis.referencing.operation.MathTransform reproject, int targetSRID, java.lang.String outputFile)
parse
in interface Converter
records
- Iterator over CSV records collected from a CSV file.classific
- Instantiation of the classification scheme that assigns categories to input features.reproject
- CRS transformation parameters to be used in reprojecting a geometry to a target SRID (EPSG code).targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.outputFile
- Path to the output file that collects RDF triples.public void parse(OSMRecord rs, Classification classific, org.opengis.referencing.operation.MathTransform reproject, int targetSRID)
parse
in interface Converter
rs
- Representation of an OSM record with attributes extracted from an OSM element (node, way, or relation).classific
- Instantiation of the classification scheme that assigns categories to input features.reproject
- CRS transformation parameters to be used in reprojecting a geometry to a target SRID (EPSG code).targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.public void parse(java.lang.String wkt, java.util.Map<java.lang.String,java.lang.String> attrValues, Classification classific, int targetSRID, java.lang.String geomType)
parse
in interface Converter
wkt
- Well-Known Text representation of the geometryattrValues
- Attribute values for each thematic (non-spatial) attributeclassific
- Instantiation of the classification scheme that assigns categories to input features.targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.geomType
- The type of the geometry (e.g., POINT, POLYGON, etc.)public void parse(java.lang.String wkt, java.util.Map<java.lang.String,java.lang.String> attrValues, Classification classific, int targetSRID, org.opengis.referencing.operation.MathTransform reproject, java.lang.String geomType, int partition_index, java.lang.String outputFile)
parse
in interface Converter
wkt
- Well-Known Text representation of the geometryattrValues
- Attribute values for each thematic (non-spatial) attributeclassific
- Instantiation of the classification scheme that assigns categories to input features.targetSRID
- Spatial reference system (EPSG code) of geometries in the output RDF triples.reproject
- CRS transformation parameters to be used in reprojecting a geometry to a target SRID (EPSG code).geomType
- The type of the geometry (e.g., POINT, POLYGON, etc.)partition_index
- The index of the partition.outputFile
- Path to the output file that collects RDF triples.private void collectTuples4Registry()
public void store(java.lang.String outputFile)
public void store(java.lang.String outputFile, int partition_index)
public void setHeader(java.lang.String[] header)
public org.apache.jena.rdf.model.Model getModel()
public java.lang.String getTDBDir()
public java.util.List<org.apache.jena.graph.Triple> getTriples()
getTriples
in interface Converter
public void parseWithRML(java.util.HashMap<java.lang.String,java.lang.String> row, be.ugent.mmlab.rml.model.dataset.RMLDataset dataset)
parseWithRML
in interface Converter
row
- Record with attribute names and their respective values.dataset
- RMLDataset to collect the resulting triples.public java.lang.String getURItemplate4Classification()
getURItemplate4Classification
in interface Converter
public java.lang.String getURItemplate4Feature()
public int writeTriples(be.ugent.mmlab.rml.model.dataset.RMLDataset dataset, java.io.BufferedWriter writer, org.openrdf.rio.RDFFormat rdfFormat, java.lang.String encoding)
writeTriples
in interface Converter
dataset
- RMLDataset that has collected the resulting triples.writer
- BufferedWriter to write triples in the output stream.rdfFormat
- Serialization format of triples to be written to the file.encoding
- Encoding for string literals.java.io.IOException
public int writeTriples(be.ugent.mmlab.rml.model.dataset.RMLDataset dataset, java.io.OutputStream writer, org.openrdf.rio.RDFFormat rdfFormat)
writeTriples
in interface Converter
dataset
- RMLDataset that has collected the resulting triples.writer
- BufferedWriter to write triples in the output stream.rdfFormat
- Serialization format of triples to be written to the file.java.io.IOException