kiwi-postgis  Version 0.1.0.0
GeometryN Class Reference
Inheritance diagram for GeometryN:
Collaboration diagram for GeometryN:

Public Member Functions

Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 
String getURI ()
 
boolean isSupported (KiWiDialect dialect)
 Return true if this function has available native support for the given dialect. More...
 
String getNative (KiWiDialect dialect, String... args)
 Return a string representing how this GeoSPARQL function is translated into SQL ( Postgis Function ) in the given dialect. More...
 
ValueType getReturnType ()
 Get the return type of the function. More...
 
ValueType getArgumentType (int arg)
 Get the argument type of the function for the arg'th argument (starting to count at 0). More...
 
int getMinArgs ()
 Return the minimum number of arguments this function requires. More...
 
int getMaxArgs ()
 Return the maximum number of arguments this function can take. More...
 

Protected Member Functions

Geometry relation (Geometry geom, Integer value)
 

Static Package Functions

 [static initializer]
 

Member Function Documentation

◆ [static initializer]()

[static initializer] ( )
staticpackage

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
23  {
24  throw new UnsupportedOperationException("cannot evaluate in-memory, needs to be supported by the database");
25  }

◆ getArgumentType()

ValueType getArgumentType ( int  arg)

Get the argument type of the function for the arg'th argument (starting to count at 0).

This is needed for SQL type casting inside KiWi.

Parameters
arg
Returns

References ValueType.GEOMETRY.

95  {
96  return ValueType.GEOMETRY;
97  }

◆ getMaxArgs()

int getMaxArgs ( )

Return the maximum number of arguments this function can take.

Returns
115  {
116  return 1;
117  }

◆ getMinArgs()

int getMinArgs ( )

Return the minimum number of arguments this function requires.

Returns
105  {
106  return 1;
107  }

◆ getNative()

String getNative ( KiWiDialect  dialect,
String...  args 
)

Return a string representing how this GeoSPARQL function is translated into SQL ( Postgis Function ) in the given dialect.

Parameters
dialect
args
Returns

References FN_POSTGIS.st_longestLine.

53  {
54  if (dialect instanceof PostgreSQLDialect) {
55  if (args.length == 2) {
56  String geom1 = args[0];
57  Integer geomn = Integer.valueOf(args[1]);
58  String SRID_default = "4326";
59  /*
60  * The following condition is required to read WKT inserted directly into args[0] and create a geometries with SRID
61  * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions:
62  * example: geof:convexHull("POLYGON(( -7 43, -2 43, -2 38, -7 38, -7 43))"^^geo:wktLiteral)
63  * st_AsText condition: It is to use the geometry that is the result of another function geosparql.
64  * example: geof:convexHull(geof:buffer(?geom, 50, units:meter))
65  */
66  if (args[0].contains("POINT") || args[0].contains("MULTIPOINT") || args[0].contains("LINESTRING") || args[0].contains("MULTILINESTRING") || args[0].contains("POLYGON") || args[0].contains("MULTIPOLYGON") || args[0].contains("ST_AsText")) {
67  geom1 = String.format("ST_GeomFromText(%s,%s)", args[0], SRID_default);
68  }
69  return String.format("ST_GeometryN(%s,%s)", geom1,geomn);
70  }
71  }
72  throw new UnsupportedOperationException(FN_POSTGIS.st_longestLine.toString()+" function not supported by dialect " + dialect);
73  }

◆ getReturnType()

ValueType getReturnType ( )

Get the return type of the function.

This is needed for SQL type casting inside KiWi.

Returns

References ValueType.GEOMETRY.

82  {
83  return ValueType.GEOMETRY;
84  }

◆ getURI()

String getURI ( )

References FN_POSTGIS.st_geometryN.

28  {
29  return FN_POSTGIS.st_geometryN.stringValue();
30  }

◆ isSupported()

boolean isSupported ( KiWiDialect  dialect)

Return true if this function has available native support for the given dialect.

Parameters
dialect
Returns
40  {
41  return dialect instanceof PostgreSQLDialect;
42  }

◆ relation()

Geometry relation ( Geometry  geom,
Integer  value 
)
protectedinherited
16  {
17  return geom.getGeometryN(value);
18  }