Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service descriptors defining the difference between a required parameter and an optional parameter #51

Open
robyww opened this issue Nov 19, 2020 · 10 comments
Labels
enhancement New feature or request TBD

Comments

@robyww
Copy link

robyww commented Nov 19, 2020

When a service descriptor defines a parameter there seems to be no way to know if the parameter is require or if it is optional. This is important for a UI that reads the service descriptor and provides the user a way input those parameters.

This is not a suggestion of syntax, but just an illustration of a solution. I added an isOptional in the third parameter below.

  <RESOURCE type="meta" utype="adhoc:service">
    <DESCRIPTION>a service</DESCRIPTION>
    <GROUP name="inputParams">
      <PARAM name="abc" datatype="char" arraysize="*" ref="col_0" value="">
        <DESCRIPTION>a ref param</DESCRIPTION>
      </PARAM>
      <PARAM name="efg" datatype="char" arraysize="*"  value="123">
        <DESCRIPTION>a required param</DESCRIPTION>
      </PARAM>
      <PARAM name="mn" datatype="char" arraysize="*"  value=""  isOptional="true">
        <DESCRIPTION>a optional param</DESCRIPTION>
      </PARAM>
    </GROUP>
    <PARAM name="accessURL" datatype="char" arraysize="*" value="http://a.b.com/aEndpoint"/>
  </RESOURCE>
@Bonnarel
Copy link
Contributor

This is surely useful. I see a solution different from adding a new attribute to PARAM. FIELDS and PARAMS have a rather seldom used attribute called "type" (no datatype, utype or xtype). It's used by clients as a behavior guid. Current values are "hidden", "location", "trigger". We could add type="optional" and that's it.
However the status of this attribute in VOTable is rather unclear. This could be revisted and clarified in VOTable. What do you think ?

@robyww
Copy link
Author

robyww commented Nov 20, 2020

Yes, that sounds good. I am sure you know better how to implement it than I do. As long as there is a way to determine an optional parameter.

@cmzwolf
Copy link

cmzwolf commented Dec 7, 2020

In PDL, the parameter description comes with an attribute "dependency" which can take REQUIRED or OPTIONAL value (cf. section 5 of https://ivoa.net/documents/PDL/20140523/REC-PDL-1.0-20140523.pdf). What about a better integration between PDL and DataLink?

@Bonnarel
Copy link
Contributor

Bonnarel commented Oct 6, 2021

Can Roby tell us whether the parameters in these services will be required or optional in all contexts or if this quality depends of other parts of the query ?
The solution may be different.

@robyww
Copy link
Author

robyww commented Oct 6, 2021

Well, that is more complex than what I was thinking. Since the UI does not really know about context that much I would say the answer is.

required or optional in all contexts

They way firefly would us a service descriptor like this is it would present the user with a panel and not allow the search to happen until the required parameters were entered. It would us the optional only if the user enters them. In some cases we can infer defaults. So in the optional case the user might have the option of removing the default value.

@pdowler
Copy link
Collaborator

pdowler commented Oct 19, 2021

This comes up in even the simplest use cases and I'm a little embarrassed we didn't think of it. The other potentially related thing we cannot currently describe is the cardinality: is a param single-valued or can multiple be submitted in the request?

In a SODA service descriptor, one could use a static template and list all the params: pos, circle, polygon, band, time, pol. Users could use the ones they like, so I think we implicitly assumed that all params were "optional" in this sense. That certainly fits with the fact that you woould not use both POS and CIRCLE at the same time and services could (CADC SODA does) reject that kind of repeated usage (multiple spatial cutouts).

So, to me the question could be reduced to "which params are mandatory?" I looked at the VOTable schema for attributes we could (ab)use, but there isn't anything obvious. We do use utype="adhoc:service" in the resource so we could think about using PARAM utype="something" to indicate mandatory vs optional params (with default when absent: optional). I don't think service params obviously benefit from referring to a field in a model (the nominal utype attr usage)...

Option 1: abuse utype attribute to say required (vs optional), eg utype="adhoc:required"

Option 2: abuse utype to specify cardinality: utype="cardinality:0..1" for optional & single value, then 1..1, 0..*, and 1..* for the other possibilities.

Option 3: defer issue until some useful support/param refactoring is added to VOTable

I'm inclined to defer rather than abuse current votable mechanisms.

@robyww
Copy link
Author

robyww commented Oct 19, 2021

I would prefer not to defer the issue. To work well the UI really needs to know if it is a required parameter. I am fine with just specifying required, in some ways that is cleaner.

is a param single-valued or can multiple be submitted in the request

I had not thought of that but I agree it is very important.

The goal in this whole thing is for a user to be able to consistently get results back and not have to experiment with every search. They more we can specify about how to build the URL the better.

@msdemlei
Copy link
Collaborator

msdemlei commented Oct 20, 2021 via email

@cmzwolf
Copy link

cmzwolf commented Oct 20, 2021 via email

@mbtaylor
Copy link
Member

I've made a suggestion in ivoa-std/VOTable#29 that could provide a clean solution to this; but it's not a quick fix, since it would require a new VOTable version.

msdemlei added a commit to msdemlei/datalink-xslt that referenced this issue Oct 27, 2021
to pre-fill into forms.

This uses LINK elements as considered in
ivoa-std/DataLink#51 (comment)
and complements a feature to generate those in DaCHS 2.4.2.
@pdowler pdowler added the enhancement New feature or request label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request TBD
Projects
None yet
Development

No branches or pull requests

6 participants