Open VKTB opened 1 year ago
In fact, it's not just in the SOAP interface; the response format is also different in the /entityManager
REST-like endpoint.
When I send the following GET
request which does not include a DISTINCT
JPQL query condition:
http://localhost:8080/icat/entityManager/?sessionId=my-session-id&query=SELECT o FROM Investigation o WHERE o.id = '1'
I get the following JSON
response back:
[
{
"Investigation": {
"id": 1,
"createId": "simple/root",
"createTime": "2023-07-06T16:30:08.000Z",
"modId": "simple/root",
"modTime": "2023-07-06T16:30:08.000Z",
"dataCollectionInvestigations": [],
"datasets": [],
"endDate": "2000-07-09T00:00:00.000Z",
"fileCount": 0,
"fileSize": 0,
"fundingReferences": [],
"investigationFacilityCycles": [],
"investigationGroups": [],
"investigationInstruments": [],
"investigationUsers": [],
"keywords": [],
"name": "INVESTIGATION 1",
"parameters": [],
"publications": [],
"releaseDate": "2000-07-05T00:00:00.000Z",
"samples": [],
"shifts": [],
"startDate": "2000-04-03T00:00:00.000Z",
"studyInvestigations": [],
"title": "Analysis reflect work or hour color maybe.\nMuch team discussion message weight.",
"visitId": "70"
}
}
]
vs when I send the following GET
request which includes a DISTINCT
JPQL query condition:
http://localhost:8080/icat/entityManager/?sessionId=my-session-id&query=SELECT DISTINCT o.id, o.title, o.summary, o.visitId, o.name, o.doi, o.startDate, o.endDate FROM Investigation o WHERE o.id = '1'
I get the following JSON
response back:
[
[
1,
"Analysis reflect work or hour color maybe.\nMuch team discussion message weight.",
null,
"70",
"INVESTIGATION 1",
null,
"2000-04-03T00:00:00.000Z",
"2000-07-09T00:00:00.000Z"
]
]
Additional differences:
null
values are omitted from the JSON response when a DISTINCT
JPQL query condition is not used but they are not omitted when one is used.Because Python-ICAT consumes ICAT over SOAP, it means that the client.search
method does not return a list of investigations objects but instead returns a list of tuples (without the null
values) when a DISTINCT
JPQL query condition is used.
I have the following investigation in my database:
When I post the following XML, which does not include a
DISTINCT
JPQL query condition, to the Search SOAP interface:I get the following XML response back:
vs when I post the following XML, which includes a
DISTINCT
JPQL query condition, to the Search SOAP interface:I get the following XML response back:
The issue: The latter XML response does not specify the type of entity and its attribute names. This is a problem because if you look at the latter XML request, it requests 8 attributes but only 6 values are returned in the response so there is no way of knowing which value belongs to which attribute. There are only 6 values returned because the
doi
andsummary
attributes were requested but their value isnull
in the database so the SOAP framework omits them from the response.