rdf4j-postgis  Version 0.1.0.0
GeoURIDatatype Class Reference
Inheritance diagram for GeoURIDatatype:
Collaboration diagram for GeoURIDatatype:

Public Member Functions

Geometry read (String geometryLiteral)
 
String unparse (Geometry geom)
 

Static Public Attributes

static final String URI = POSTGIS.NAMESPACE+POSTGIS.GeoURI
 The default WKT type URI. More...
 
static final GeoURIDatatype INSTANCE = new GeoURIDatatype()
 A static instance of WKTDatatype. More...
 
static final IRI LiteralIRI =SimpleValueFactory.getInstance().createIRI(POSTGIS.NAMESPACE+POSTGIS.GeoURI)
 

Member Function Documentation

◆ read()

Geometry read ( String  geometryLiteral)

Reimplemented from VectorLiteral.

26  {
27  String[] items=geometryLiteral.split(";");
28  if(items.length==0 || items.length>4) {
29  throw new AssertionError("Not a valid geoURI: " + geometryLiteral);
30  }
31  String[] coordinates=items[0].replace("geo:", "").split(",");
32  GeometryFactory fac=new GeometryFactory();
33  return fac.createPoint(new Coordinate(Double.valueOf(coordinates[0]),Double.valueOf(coordinates[1])));
34  }

◆ unparse()

String unparse ( Geometry  geom)

Reimplemented from VectorLiteral.

37  {
38  if("POINT".equalsIgnoreCase(geom.getGeometryType())) {
39  return "geo:"+geom.getCoordinate().x+","+geom.getCoordinate().y+";crs=EPSG:"+geom.getSRID();
40  }
41  return "geo:"+geom.getCentroid().getCoordinate().x+","+geom.getCentroid().getCoordinate().y+";crs=EPSG:"+geom.getSRID();
42  }

Member Data Documentation

◆ INSTANCE

final GeoURIDatatype INSTANCE = new GeoURIDatatype()
static

A static instance of WKTDatatype.

Referenced by LiteralRegistry.LiteralRegistry().

◆ LiteralIRI

final IRI LiteralIRI =SimpleValueFactory.getInstance().createIRI(POSTGIS.NAMESPACE+POSTGIS.GeoURI)
static

◆ URI

final String URI = POSTGIS.NAMESPACE+POSTGIS.GeoURI
static

The default WKT type URI.

Referenced by LiteralRegistry.LiteralRegistry().