Hi Peter,
UISPIN makes it possible to evaluate result sets in any node, using letrs:...
attributes. Using this technique, you can add an ui:if before opening up the
table. The result set is then a normal SPARQL variable, which points to a SPIN
Result Set (http://spinrdf.org/spr.html) and you can use the spr functions such
as spr:rowCount to do meta-analysis of the table. The resulting snippet may
look like this (note: I did not test this, so it may have syntax errors):
<ui:let letrs:data="{#
SELECT ?attrib ?value
WHERE { ... } }">
<h4>...</h4>
<ui:if ui:condition="{= spr:rowCount(?data) > 0 }">
<table>
<ui:forEach ui:resultSet="{= ?data }">
<tr>....</tr>
</ui:forEach>
</table>
</ui:if>
</ui:let>
BTW, the ifs in your snippet look like the body of <tui:Label> which you may
want to reuse.
Let me know if you have further questions - feedback like this helps me
understand the startup problems that new users of UISPIN are facing.
Thanks,
Holger
On Apr 21, 2010, at 11:55 PM, peter wrote:
> I'm having good fun with UISPIN to create architecture description
> documents. I'm refactoring my template by moving common structures
> into tui:Element subclasses. I think this what your tutorial
> advocates. My specific question is, given a table generation loop such
> as below, is there a neat way of suppressing the whole table (and
> header) if there is no content?
>
> Peter
>
> <ui:let>
> <h4>{= ui:label(?predicate) }</h4>
> <table>
> <ui:forEach ui:resultSet="{#
> SELECT ?attrib ?value
> WHERE {
> ?attrib rdfs:subPropertyOf ?predicate .
> ?node ?attrib ?value .
> } }">
> <tr>
> <td>{= ui:label(?attrib) }</td>
> <td>
> <ui:if ui:condition="{= isLiteral(?value) }">
> <span class="tuiLabel">{= ?value }</span>
> </ui:if>
> <ui:if ui:condition="{= isIRI(?value) || isBlank(?
> value) }">
> <span class="tuiResource">{= ui:label(?value) }
> </span>
> </ui:if>
> </td>
> </tr>
> </ui:forEach>
> </table>
> </ui:let>
>
> --
> You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en