[Mulgara-dev] patch for REST TQL subquery problems

Paul Gearon gearon at ieee.org
Mon Jan 18 16:04:17 UTC 2010


Hi David,

Looks good. I'm just running tests now, and I'll check it in soon.

Thank you very much.  :-)

Regards,
Paul

P.S. thanks for the endorsement of the TQL endpoint over SOAP. The
idea was to make it simpler and faster.


On Sat, Jan 16, 2010 at 1:35 PM, David Smith <DMS at viewpointusa.com> wrote:
> I believe this fixes the problem with using TQL REST endpoint with
> queries containing SUBQUERY
>
> Basically the old code was (incorrectly) referring to the original
> answer instead of the answer parameter.
> Also, needed to form the XML correctly.
>
> BTW, I'm in the process of switching our system from SOAP to TQL
> endpoint and am seeing 5+ times speedup
> AND appears to scale better when under load.  Nice.
>
> Dave S
>
>
>
> Index: StreamedTqlXMLAnswer.java
> ===================================================================
> --- StreamedTqlXMLAnswer.java   (revision 1888)
> +++ StreamedTqlXMLAnswer.java   (working copy)
> @@ -97,8 +97,11 @@
>
>   /** {@inheritDoc} */
>   protected void addResult(Answer a, int indent) throws
> TuplesException, IOException {
> +    int width = (a != null) ? a.getNumberOfVariables() : 0;
> +    Variable[] vars = (a != null) ? a.getVariables() : null;
> +
>     s.append(i(indent + 2)).append("<solution>");
> -    for (int c = 0; c < width; c++) addBinding(vars[c],
> answer.getObject(c), indent);
> +    for (int c = 0; c < width; c++) addBinding(vars[c], a.getObject(c),
> indent);
>     s.append(i(indent + 2)).append("</solution>");
>   }
>
> @@ -127,8 +130,10 @@
>         addLiteral((Literal)value);
>         s.append("</").append(var.getName()).append(">");
>       } else if (value instanceof Answer) {
> +               s.append(">");
>         addHeader((Answer)value, indent + 4);
>         addResults((Answer)value, indent + 4);
> +        s.append("</").append(var.getName()).append(">");
>       } else throw new IllegalArgumentException("Unable to create a
> SPARQL response with an answer containing: " +
> value.getClass().getSimpleName());
>     }
>   }
>
> This E-Mail may contain confidential and privileged information. It is intended solely for the recipient(s) indicated. Any review, use, or distribution by anyone other than the intended recipient(s) is strictly prohibited. If you have received this E-Mail in error or are not the intended recipient, please notify the sender and delete all copies immediately.
> _______________________________________________
> Mulgara-dev mailing list
> Mulgara-dev at mulgara.org
> http://mulgara.org/mailman/listinfo/mulgara-dev
>



More information about the Mulgara-dev mailing list