rdf4j-postgis  Version 0.1.0.0
IsValidDetail Class Reference

Checks if the given geometry is valid and gives more details on a possible validation error. More...

Inheritance diagram for IsValidDetail:
Collaboration diagram for IsValidDetail:

Public Member Functions

String getURI ()
 
String operation (Geometry geom)
 
Value evaluate (ValueFactory valueFactory, Value... args) throws ValueExprEvaluationException
 

Detailed Description

Checks if the given geometry is valid and gives more details on a possible validation error.

Member Function Documentation

◆ evaluate()

Value evaluate ( ValueFactory  valueFactory,
Value...  args 
) throws ValueExprEvaluationException
inherited
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  }

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

Referenced by AsBinaryTest.testAsBinary(), AsEncodedPolylineTest.testAsEncodedPolyline(), AsGARSTest.testAsGARS(), AsGeoJSONTest.testAsGeoJSON(), AsGeoRSSTest.testAsGeoRSS(), AsGeoURITest.testAsGeoURI(), AsLatLonTextTest.testAsLatLonText(), AsOSMLinkTest.testAsOSMLink(), AsPolyshapeTest.testAsPolyShape(), AsTextTest.testAsText(), AsTextRawTest.testAsTextRaw(), AsTextTest.testAsTextZ(), DumpTest.testDump(), GeomCRSToWKTTest.testGeomCRSToWKT(), GeometryTypeTest.testLineString(), SridGetAxis1OrientationTest.testSridAxis1Orientation(), SridGetAxis2OrientationTest.testSridAxis2Orientation(), SridGetAxis1NameTest.testSridGetAxis1Name(), SridGetAxis2NameTest.testSridGetAxis2Name(), and SridGetDatumTest.testSridGetDatum().

◆ getURI()

String getURI ( )
18  {
19  return POSTGIS.st_isValidDetail.stringValue();
20  }

References POSTGIS.st_isValidDetail.

◆ operation()

String operation ( Geometry  geom)

Reimplemented from GeometricStringExportFunction.

22  {
23  Object[] details = new Object[3];
24  IsValidOp validOP = new IsValidOp(geom);
25  GeometryFactory fac=new GeometryFactory();
26  TopologyValidationError error = validOP.getValidationError();
27  if (error != null) {
28  details[0] = false ;
29  details[1] = error.getMessage();
30  details[2] = fac.createPoint(error.getCoordinate());
31  } else {
32  details[0] = true ;
33  details[1] = "Valid Geometry";
34  }
35  return Arrays.toString(details);
36  }