icatproject / icat.server

The ICAT server offering both SOAP and "RESTlike" interfaces to a metadata catalog.
Other
1 stars 5 forks source link

Provide the full ICAT JPQL query syntax also at the SOAP interface #245

Closed RKrahl closed 3 years ago

RKrahl commented 3 years ago

icat.server features two flavours of JPQL queries: one that is exposed at the "RESTful" interface and one exposed at the SOAP interface. The syntax of the SOAP flavour is somewhat reduced. For instance, quoting the ICAT Restful API documentation:

If more than one quantity is listed in the select clause then instead of a single value being returned for each result an array of values is returned.

This feature is not supported at the SOAP interface, in the SOAP flavour only single value may be queried.

Now, there is a feature request for python-icat asking exactly this, see icatproject/python-icat#76. This would need the full JPQL query syntax also to be available at the SOAP interface.

Historical note: Steve always claimed that it would not be possible to return an array of values for each result with SOAP and that was one reason to go for the "RESTful" API. I do contest this claim, I believe it is possible to do it also with SOAP.

louise-davies commented 3 years ago

I have managed to create a solution for field sets such that they are marshalled into XML in a sensible manner - however testing with python-icat means there would also have to be modifications on that side to not assume the newly created FieldSet object is an ICAT entity and to handle it differently.

The XML response of a request such as SELECT i.startDate, i.name from Investigation i is shown below as an example.

<?xml version='1.0' encoding='UTF-8'?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:searchResponse xmlns:ns2="http://icatproject.org">
            <return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:fieldSet">
                <field xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2000-04-03T00:00:00+01:00</field>
                <field xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">INVESTIGATION 1</field>
            </return>
            <return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:fieldSet">
                <field xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:dateTime">2000-06-04T00:00:00+01:00</field>
                <field xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">INVESTIGATION 2</field>
            </return>
       </ns2:searchResponse>
    </S:Body>
</S:Envelope>

@stuartpullinger @RKrahl does this look like a sensible solution? You should be able to see the commit above this comment

RKrahl commented 3 years ago

Hi @louise-davies, many thanks for taking care! Yes obviously, I'm well aware that this would require changes on the client side in python-icat. I'll have a look soonish.

RKrahl commented 3 years ago

This has been implemented in #246 and may thus be closed.