FnOio/fno-specification

dependency between input and output type

Opened this issue · 0 comments

#15 makes the case for multivalued input and output types. And shows two examples of functions

  • a tentative plusOne(integer or decimal) that returns same type as its input argument
  • GeoSPARQL funcs:buffer (or geof:buffer)
    • its signature in the GeoSPARQL standard is given as
      geof:buffer (geom: ogc:geomLiteral, radius: xsd:double, units: xsd:anyURI): ogc:geomLiteral
    • The first parameter and the output are defined more precisely using FNO like this:
funcs:buffer
    a sd:Function, fno:Function ;
    dcterms:source <http://www.opengis.net/doc/geosparql/1.1> ;
    policy:status status:valid ;
    fno:expects (funcs:buffer_param1 funcs:buffer_param2 funcs:buffer_param3 ) ;
    fno:returns (funcs:buffer_output ) ;
    rdfs:isDefinedBy <http://www.opengis.net/spec/geosparql/1.1/req/geometry-extension/query-functions> ;
    rdfs:seeAlso <http://www.opengis.net/doc/geosparql/1.1> ;
    skos:definition "A query function that returns a buffer around the input geometry."@en ;
    skos:prefLabel "buffer"@en .

funcs:buffer_param1 a fno:Parameter ;
    fno:type geo:wktLiteral, geo:gmlLiteral, geo:geoJSONLiteral, geo:kmlLiteral, geo:dggsLiteral  ;
    fno:required "true"^^xsd:boolean ;
    skos:prefLabel "geom"@en .

funcs:buffer_output a fno:Output ;
    fno:required "true"^^xsd:boolean ;    
    fno:type geo:wktLiteral, geo:gmlLiteral, geo:geoJSONLiteral, geo:kmlLiteral, geo:dggsLiteral .

What's missing is the ability to specify the correspondence.

  • I'm not asking for a fully-fledged functional type system: for now it's enough to say "type is the same as the type of that other param"
  • This is useful for input->output (key input determines output) and input->input (first input determines type of second input; eg for a polymorphic function add(num1,num2))
  • It also seems useful to allow the same for required (if input is missing then output would also be missing)

So the example above can become:

funcs:buffer_output a fno:Output ;
    fno:requiredDependsOn funcs:buffer_param1;
    fno:typeDependsOn funcs:buffer_param1.

(Instead of requiredDependsOn I considered requirednessDependsOn but that name is a bit heavy-handed)