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

Public Member Functions

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...
 
String operation (Geometry geom)
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Static Package Functions

 [static initializer]
 

Package Attributes

String out
 
String out2 ="</item></channel></rss>"
 

Member Function Documentation

◆ [static initializer]()

[static initializer] ( )
staticpackage

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited

References LiteralRegistry.getLiteral(), and GeometricStringExportFunction.operation().

16  {
17  if (args.length != 1) {
18  throw new ValueExprEvaluationException(getURI() + " requires exactly 1 arguments, got " + args.length);
19  }
20 
21  LiteralType l=LiteralRegistry.getLiteral(((Literal)args[0]).getDatatype().toString());
22  if(l instanceof VectorLiteral) {
23  Geometry geom=((VectorLiteral)l).read(args[0].stringValue());
24  String result = operation(geom);
25  return valueFactory.createLiteral(result);
26  }
27  throw new ValueExprEvaluationException("Argument given is not a geometry literal");
28 
29  }

◆ 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.

86  {
87  return ValueType.GEOMETRY;
88  }

◆ getMaxArgs()

int getMaxArgs ( )

Return the maximum number of arguments this function can take.

Returns
106  {
107  return 1;
108  }

◆ getMinArgs()

int getMinArgs ( )

Return the minimum number of arguments this function requires.

Returns
96  {
97  return 1;
98  }

◆ 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_ASGEORSS.

45  {
46  if (dialect instanceof PostgreSQLDialect) {
47  if (args.length == 1) {
48  String geom1 = args[0];
49  String SRID_default = "4326";
50  /*
51  * The following condition is required to read WKT inserted directly into args[0] and create a geometries with SRID
52  * POINT, MULTIPOINT, LINESTRING ... and MULTIPOLYGON conditions:
53  * example: geof:convexHull("POLYGON(( -7 43, -2 43, -2 38, -7 38, -7 43))"^^geo:wktLiteral)
54  * st_AsText condition: It is to use the geometry that is the result of another function geosparql.
55  * example: geof:convexHull(geof:buffer(?geom, 50, units:meter))
56  */
57  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")) {
58  geom1 = String.format("ST_GeomFromText(%s,%s)", args[0], SRID_default);
59  }
60  return String.format("ST_AsGeoRSS(%s)", geom1);
61  }
62  }
63  throw new UnsupportedOperationException(FN_POSTGIS.ST_ASGEORSS.toString()+" function not supported by dialect " + dialect);
64  }

◆ getReturnType()

ValueType getReturnType ( )

Get the return type of the function.

This is needed for SQL type casting inside KiWi.

Returns

References ValueType.STRING.

73  {
74  return ValueType.STRING;
75  }

◆ getURI()

String getURI ( )

References FN_POSTGIS.ST_ASGEORSS.

20  {
21  return FN_POSTGIS.ST_ASGEORSS.stringValue();
22  }

◆ isSupported()

boolean isSupported ( KiWiDialect  dialect)

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

Parameters
dialect
Returns
32  {
33  return dialect instanceof PostgreSQLDialect;
34  }

◆ operation()

String operation ( Geometry  geom)
inherited

References AsGML.operation(), AsGeoRSS.out, and AsGeoRSS.out2.

11  {
12  AsGML asgml=new AsGML();
13  String gml=asgml.operation(geom);
14  return out+gml+out2;
15  }
String out
Definition: openrdf/query/algebra/evaluation/function/postgis/geometry/exporter/AsGeoRSS.java:17
String out2
Definition: openrdf/query/algebra/evaluation/function/postgis/geometry/exporter/AsGeoRSS.java:28

Member Data Documentation

◆ out

String out
packageinherited
Initial value:
="<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
"<rss version=\"2.0\""+
"xmlns:georss=\"http://www.georss.org/georss\""+
"xmlns:gml=\"http://www.opengis.net/gml\">"+
"<channel>"+
"<link>http://www.i3mainz.de/postgis-jena</link>"+
"<title>Cambridge Neighborhoods</title>"+
"<description>One guy's view of Cambridge, MA</description>"+
"<item>"+
"<guid isPermaLink=\"false\">00000111c36421c1321d3</guid>"+
"<pubDate>"+System.currentTimeMillis()+"</pubDate>"

Referenced by AsGeoRSS.operation().

◆ out2

String out2 ="</item></channel></rss>"
packageinherited

Referenced by AsGeoRSS.operation().