Open Aklakan opened 5 years ago
There is a @DefaultValue
annotation for exposing Java functions as SPARQL functions:
@IriNs(GeoSPARQL_URI.GEOF_URI)
public static Geometry simplifyDp(
Geometry geom,
@DefaultValue("0") double tolerance,
@DefaultValue("true") boolean ensureValid) {
DouglasPeuckerSimplifier simplifier = new DouglasPeuckerSimplifier(geom);
simplifier.setDistanceTolerance(tolerance);
simplifier.setEnsureValid(ensureValid);
Geometry result = simplifier.getResultGeometry();
return result;
}
This annotation could be reused for the purpose of the issue.
There are however different possible semantics for which it should be possible to specify it unambiguously:
On get-access convert null to the default value (do not write to the model)
On get-access write the default value into the model if the result would be null (i.e. get with a write side-effect)
On get-access write null into the model if the result would otherwise be the default value
On set replace the default value with null
On set replace null with the default value
On set just set the given value
Allow to specify a default value for the case that no triples exist for a property. E.g. the absence of certain triples may indicate a value of 'true' for a property. Most likely, we can reuse some existing annotation for that purpose.