Re: allow implicitly unbound variables in SPARQL results?

Jeen Broekstra wrote:
> Steve Harris wrote:
> 
>>On Fri, Dec 09, 2005 at 03:43:30PM +0000, Steve Harris wrote:
> 
> [snip]
> 
>>>+1, though I'd like to see how much more it complicates XSLT processing,
>>>as that was more of a concern IIRC.
>>
>>
>>Duh, they were in Ron's original message.
> 
> 
> Actually, not quite (unless I missed something). Ron used XSLT to 
> produce the stripped and collapsed versions of the file, but he didn't 
> use XLST to test processing the different result variations, he just 
> timed the run of xmlwf (Expat's wellformedness checker). Since a 
> wellformedness test does not do any matching of the result values to the 
> correct column it does not really tell us much about processing 
> performance when we actually have to interpret/validate the result file, 
> unfortunately. However, the tests I ran with SAX-based processing did do 
> this kind of interpretation and there we still saw a substantial 
> performance gain.
> 
> My XSLT skills are sketchy at best so I haven't yet figured out how to 
> adapt a stylesheet to cope with the collapsed format. The best I could 
> come up with is that you insert some sort of position-based test in the 
> processing of the binding element, e.g:
> 
> <xsl:for-each select="res:binding">
>        <xsl:variable name="bindingName" select="@name" />
>        <xsl:variable name="bindingPosition" select="position()"/>
> 
>        <xsl:if test="//res:head/res:variable[$bindingPosition]/@name != 
> $bindingName">
> 	<td>null</td>
>        </xsl:if>
>        ...
> 
> But this only works when there is a single unbound: you'd need some sort 
> of recursion to have this work for arbitrary numbers of missing values, 
> I guess.
> 
> If you (or someone else) feel like taking a stab at getting this to work 
> and sharing how difficult/easy it is to get this right, there is a 
> stylesheet for rendering sparql results (in LC format of course) in HTML 
> available at http://www.w3.org/2001/sw/DataAccess/rf1/result2-to-html.xsl.
> 
> Cheers,
> 
> Jeen

In terms of generation and consumption of the result sets in java, I found the 
implementation burden of any proposed format is minimal.  I have two readers, 
one SAX, one StAX, and both cope with absence or presence of <unbound/> or a 
mix as such a tag leads to an unbound variable in the reconstructed result 
set.  My writer is a streambased custom writer - as it walks unbound 
variables, it is merely a matter of whether it bothers to write the particualr 
tag.

Hence my only concern is the practicality of XSLT and XQuery processing of 
results and reacting to the absence of the unbound marker - fixing up the 
result2-to-html.{xsl,xq} would answer that.

	Andy

Received on Monday, 12 December 2005 14:24:52 UTC