gap-packages/scscp

Structure of reply to get_allowed_heads

olexandr-konovalov opened this issue · 0 comments

I can not parse Python's reply to

GetAllowedHeads("localhost",26133);

in GAP SCSCP client, with an error

Error, Record: '<rec>.cd' must have an assigned value in
  if not IsBound( res.(r[i].attributes.cd) )  then
    res.(r[i].attributes.cd) := [  ];
fi; at /Users/alexk/gap4r8p6/pkg/scscp/lib/special.g:25 called from 
<function "GetAllowedHeads">( <arguments> )
 called from read-eval loop at line 74 of *stdin*
you can 'return;' after assigning a value

This is what GAP returns and what it parses (a simple server with a couple of procedures):

<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">
	<OMATTR>
		<OMATP>
			<OMS cd="scscp1" name="call_id"/>
			<OMSTR>localhost:26134:9068:CnDaZirw</OMSTR>
		</OMATP>
		<OMA>
			<OMS cd="scscp1" name="procedure_completed"/>
			<OMA>
<OMS cd="scscp2" name="symbol_set"/>
<OMS cd="scscp_transient_1" name="SCSCPStartTracing"/>
<OMS cd="scscp_transient_1" name="SCSCPStopTracing"/>
</OMA>
		</OMA>
	</OMATTR>
</OMOBJ> 

(so it mostly ignores SCSCP CDs - maybe it shouldn't?).

But this is what Python returns:

<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">
<OMATTR>
<OMATP>
<OMS name="call_id" cd="scscp1"/>
<OMSTR>b0152df8-f897-11e6-a752-0c4de9c1b942:HMENl067</OMSTR>
</OMATP>
<OMA>
<OMS name="procedure_completed" cd="scscp1"/>
<OMA>
<OMS name="symbol_set" cd="scscp2"/>
...
<OMS name="is_allowed_head" cd="scscp2"/>
<OMS name="power" cd="arith1"/>
...
<OMS name="divide" cd="arith1"/>
<OMA>
<OMS name="CDName" cd="meta"/>
<OMSTR>scscp1</OMSTR>
</OMA>
</OMA>
</OMA>
</OMATTR>
</OMOBJ>

An example of symbol_set is given at http://www.win.tue.nl/SCIEnce/cds/scscp2.html#get_allowed_heads, and documentation at http://www.win.tue.nl/SCIEnce/cds/scscp2.html#symbol_set. It says

This symbol is used in the reply to a scscp2.get_allowed_heads call. It should be the head of an OM Application, the contents of the OMA being arbitrarily many OM Symbols (meaning that a particular symbol is supported), OMA's with head meta.CDName (meaning that all symbols of a particular CD are supported) or OMA's with head meta.CDGroupName (meaning that all symbols of all CDs of a particular CD group are supported). See the example at scscp2.get_allowed_heads.

So it looks to me like this is a valid reply from Python, but GAP is not expecting to see the

<OMA>
<OMS name="CDName" cd="meta"/>
<OMSTR>scscp1</OMSTR>
</OMA>

part. This should be fixed (and support for CD groups should also be added).

Note that this is an error in the scscp2 CD: there is no meta.CDGroupName, but there is metagrp.CDName: http://www.openmath.org/cd/metagrp.xhtml#CDName