public class TripleGenerator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) java.lang.String |
attrAssignedCategory |
(package private) java.util.List<java.lang.String> |
attrCategories |
(package private) java.lang.String |
attrCategoryURI |
(package private) java.lang.String |
attrDataSource |
(package private) Mapping |
attrMappings |
(package private) java.util.Map<java.lang.String,java.lang.Integer> |
attrStatistics |
(package private) java.lang.String |
attrURI |
private static Configuration |
currentConfig |
com.vividsolutions.jts.geom.Envelope |
mbr |
Assistant |
myAssistant |
(package private) ValueChecker |
myChecker |
(package private) java.util.Map<java.lang.String,java.lang.String> |
prefixes |
private java.util.List<org.apache.jena.graph.Triple> |
results |
Constructor and Description |
---|
TripleGenerator(Configuration config,
Assistant assist)
Constructs a TripleGenerator for transforming a feature (as a record of attributes) into RDF triples
|
Modifier and Type | Method and Description |
---|---|
private boolean |
assignClassificationURI(java.util.Map<java.lang.String,java.lang.String> attrValues,
Classification classific)
Assigns a suitable URI for the category of this feature according to the classification scheme pertinent to the dataset
|
void |
clearTriples()
Cleans up all triples resulted from conversion so far
|
private void |
createTriple4LanguageLiteral(java.lang.String s,
java.lang.String p,
java.lang.String o,
java.lang.String lang)
Creates an RDF triple with specific handling of literals having a language tag
|
private void |
createTriple4PlainLiteral(java.lang.String s,
java.lang.String p,
java.lang.String o)
Creates an RDF triple for a plain literal (without language tag or data type specification)
|
private void |
createTriple4Resource(java.lang.String s,
java.lang.String p,
java.lang.String o)
Creates an RDF triple with a resource as its object (i.e., non literal values)
|
private void |
createTriple4TypedLiteral(java.lang.String s,
java.lang.String p,
java.lang.String o,
org.apache.jena.datatypes.RDFDatatype d)
Creates an RDF triple with specific handling of literals having a data type specification
|
private java.lang.String |
expandNamespace(java.lang.String s)
Expands the prefix into the full namespace of a given RDF node (usually, a predicate)
|
private java.util.List<java.lang.String> |
getArgValues(java.util.List<java.lang.String> args,
java.util.Map<java.lang.String,java.lang.String> attrValues)
Provides a list of argument values to be used in calling a built-in function.
|
com.vividsolutions.jts.geom.Envelope |
getMBR()
Provides the MBR of the geographic dataset that has been transformed.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getStatistics()
Provides the statistics collected during transformation (i.e., count of transformed values per attribute)
|
java.util.List<org.apache.jena.graph.Triple> |
getTriples()
Provides a collection of triples resulting from conversion (usually from a single input feature)
|
private void |
insertVirtuosoPoint(java.lang.String uri,
java.lang.String pointWKT)
Insert a Point geometry of a spatial feature into the Jena model according to legacy Virtuoso RDF geometry specifications (concerning point geometries only)
|
private void |
insertWGS84Point(java.lang.String uri,
java.lang.String pointWKT)
Insert a Point geometry of a spatial feature into the Jena model according to legacy WGS84 Geoposition RDF vocabulary
|
private void |
insertWKTGeometry(java.lang.String uri,
java.lang.String wkt,
int srid,
java.lang.String geomType)
Inserts a typical WKT geometry of a spatial feature into the Jena model (suitable for GeoSPARQL compliant stores)
|
java.lang.String |
transform(java.util.Map<java.lang.String,java.lang.String> row,
java.lang.String wkt,
int targetSRID,
Classification classific)
Converts the given feature (a tuple of thematic attributes and its geometry WKT) into RDF triples according to user-specified attribute mappings (in YML)
|
void |
transformCategory2RDF(java.lang.String uuid,
java.lang.String name,
java.lang.String parent_uuid)
Transforms a given category in a (possibly hierarchical) classification scheme into RDF triples
IMPORTANT! Current handling fits the classification scheme suggested by the SLIPO ontology for Points of Interest (POI), but may be also applied against other classifications.
|
void |
transformCustomThematic2RDF(java.lang.String uri,
java.util.Map<java.lang.String,java.lang.String> attrValues,
Classification classific)
Transforms all thematic (i.e., non-spatial) attributes according to a custom ontology specified in a YML format
|
void |
transformGeometry2RDF(java.lang.String uri,
java.lang.String wkt,
int srid,
java.lang.String geomType)
Converts representation of a geometry WKT into suitable RDF triple(s) depending on the specified spatial ontology
|
void |
transformPlainThematic2RDF(java.lang.String uri,
java.util.Map<java.lang.String,java.lang.String> attrValues)
Handles all thematic (i.e., non-spatial) attributes of a feature, by simply issuing a triple with the original attribute name as property
|
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 (currently only a counter) of values transformed for a particular attribute
|
public Assistant myAssistant
ValueChecker myChecker
private static Configuration currentConfig
private java.util.List<org.apache.jena.graph.Triple> results
Mapping attrMappings
java.util.Map<java.lang.String,java.lang.String> prefixes
java.lang.String attrURI
java.lang.String attrCategoryURI
java.lang.String attrDataSource
java.lang.String attrAssignedCategory
java.util.Map<java.lang.String,java.lang.Integer> attrStatistics
java.util.List<java.lang.String> attrCategories
public com.vividsolutions.jts.geom.Envelope mbr
public TripleGenerator(Configuration config, Assistant assist)
config
- User-specified configuration for the transformation process.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 java.util.List<org.apache.jena.graph.Triple> getTriples()
public void clearTriples()
private void updateStatistics(java.lang.String attrKey)
attrKey
- The name of the attributepublic java.util.Map<java.lang.String,java.lang.Integer> getStatistics()
public java.lang.String transform(java.util.Map<java.lang.String,java.lang.String> row, java.lang.String wkt, int targetSRID, Classification classific)
row
- Attribute values for each thematic (non-spatial) attributewkt
- Well-Known Text representation of the geometrytargetSRID
- The EPSG identifier of the Coordinate Reference System of the geometryclassific
- The classification scheme used in the category assigned to the featurepublic void transformPlainThematic2RDF(java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> attrValues) throws java.io.UnsupportedEncodingException
uri
- The URI assigned to this featureattrValues
- Attribute values for each thematic (non-spatial) attribute of the featurejava.io.UnsupportedEncodingException
public void transformGeometry2RDF(java.lang.String uri, java.lang.String wkt, int srid, java.lang.String geomType)
uri
- The URI assigned to this featurewkt
- Well-Known Text representation of the geometrysrid
- The EPSG identifier of the Coordinate Reference System of the geometrygeomType
- The type of the geometry (e.g., POINT, POLYGON, etc.)private void insertWKTGeometry(java.lang.String uri, java.lang.String wkt, int srid, java.lang.String geomType)
uri
- The URI assigned to this featurewkt
- Well-Known Text representation of the geometrysrid
- The EPSG identifier of the Coordinate Reference System of the geometryprivate void insertVirtuosoPoint(java.lang.String uri, java.lang.String pointWKT)
uri
- The URI assigned to this featurepointWKT
- Well-Known Text representation of the (point) geometryprivate void insertWGS84Point(java.lang.String uri, java.lang.String pointWKT)
uri
- The URI assigned to this featurepointWKT
- Well-Known Text representation of the (point) geometryprivate java.util.List<java.lang.String> getArgValues(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,java.lang.String> attrValues)
args
- List of arguments (parameters) of the built-in function.attrValues
- List of pairs of attributes and their respective values for a given featureprivate boolean assignClassificationURI(java.util.Map<java.lang.String,java.lang.String> attrValues, Classification classific)
attrValues
- Attribute values for each thematic (non-spatial) attribute of the featureclassific
- The classification scheme used in the category assigned to the featurepublic void transformCustomThematic2RDF(java.lang.String uri, java.util.Map<java.lang.String,java.lang.String> attrValues, Classification classific) throws java.io.UnsupportedEncodingException
uri
- The URI assigned to this featureattrValues
- Attribute values for each thematic (non-spatial) attribute of the featureclassific
- The classification scheme used in the category assigned to the featurejava.io.UnsupportedEncodingException
public void transformCategory2RDF(java.lang.String uuid, java.lang.String name, java.lang.String parent_uuid)
uuid
- A universally unique identifier (UUID) assigned to the categoryname
- The name of this category according to the classificationparent_uuid
- The universally unique identifier (UUID) assigned to the parent of this category in the classification schemeprivate java.lang.String expandNamespace(java.lang.String s)
s
- A prefixed name with a prefix label and a local part, separated by a colon ":"private void createTriple4LanguageLiteral(java.lang.String s, java.lang.String p, java.lang.String o, java.lang.String lang)
s
- Triple subjectp
- Triple predicateo
- Triple object literallang
- -- Language specification of the literal valueprivate void createTriple4PlainLiteral(java.lang.String s, java.lang.String p, java.lang.String o)
s
- -- Triple subjectp
- -- Triple predicateo
- -- Triple object literalprivate void createTriple4Resource(java.lang.String s, java.lang.String p, java.lang.String o)
s
- -- Triple subjectp
- -- Triple predicateo
- -- Triple object resourceprivate void createTriple4TypedLiteral(java.lang.String s, java.lang.String p, java.lang.String o, org.apache.jena.datatypes.RDFDatatype d)
s
- -- Triple subjectp
- -- Triple predicateo
- -- Triple object literald
- -- Data type specification of the literal value