It does work. In conclusion, I was confused on the functionality of the
ui:forEach element, thinking it can only be used for result sets that would
contain multiple results. A warning for anyone using this method: placing
a LIMIT 1 at the end of the where block is highly suggested since if the
SPARQL query has multiple result sets, it will send all the results back as
JSON objects which might cause parsing errors when the data is sent to the
browser (it did for myself as the JSON objects had no separator and the
ui:forEach element was not a child of the swon:Array element). Thank you
Mr. Henninger, Mrs. Polikoff and Mr. Knublauch for all the help.
On Wednesday, August 20, 2014 6:12:58 PM UTC-4, Holger Knublauch wrote:
>
> Yes, and you could add LIMIT 1 to the end of the WHERE block to make sure
> it only ever returns at most one value. The forEach then serves as a
> mechanism to bind all variables from the SELECT clause.
>
> Holger
>
>
> On 8/21/14, 5:22 AM, Scott Henninger wrote:
>
> Dejan; You would need to use the ui:forEach to invoke the result set
> processing, so the following should work:
>
> <ui:forEach ui:resultSet="{#
> SELECT ?some_value ?something_else
> WHERE {
> ?argument_variable rdfs:label ?some_value .
> ?argument_variable prefix:somethingElse ?something_else .
> } }">
> <swon:Object>
> <swon:Value arg:name="Name" arg:value="{= ?some_value }"/>
> <swon:Value arg:name="Other" arg:value="{= ?something_else }"/>
> </swon:Object>
> </ui:forEach>
>
>
> -- Scott
>
> On 8/20/2014, 9:42 AM, Dejan Veselinovic wrote:
>
> The technique Mr. Knublauch suggested gives me an empty JSON object. So
> far, the only method that has worked is providing a SPARQL query within the
> arg:value property of the swon:Value element as such:
>
> <swon:Object>
> <swon:Value arg:name="Name" arg:value="{# SELECT ?some_value WHERE {
> ?argument_variable rdfs:label ?some_value . } }" />
> <swon:Value arg:name="Other" arg:value="{# SELECT ?something_else
> WHERE { ?argument_variable prefix:somethingElse ?something_else . } }" />
> </swon:Object>
>
> This will produce the following output: { 'Name': 'Value_One', 'Other':
> 'Value_Two' }. I was hoping to be able to do something like the following:
>
> <someElement someAttribute="{# SELECT ?some_value ?something_else WHERE
> { ?argument_variable rdfs:label ?some_value . ?argument_variable
> prefix:somethingElse ?something_else . } }">
> <swon:Object>
> <swon:Value arg:name="Name" arg:value="{= ?some_value }" />
> <swon:Value arg:name="Other" arg:value="{= ?something_else }" />
> </swon:Object>
> </someElement>
>
> to get the output produced above. Is this even possible?
>
> On Tuesday, August 19, 2014 7:56:49 PM UTC-4, Holger Knublauch wrote:
>>
>> On 8/20/2014 5:31, Dejan Veselinovic wrote:
>> > For clarification, I am currently building this functionality within a
>> > SPARQL Web Page and have read through http://uispin.org/swon.html and
>> > http://uispin.org/ui.html. I tried defining a ui:resultSet property
>> > within a swon:Object element but that property is not allowed within
>> > that element.
>>
>> Why not? You can do
>>
>> <swon:Object>
>> <ui:forEach ui:resultSet="{# ... }">
>> <swon:Value ...
>> </ui:forEach>
>> </swon:Object>
>>
>> > I know that property is allowed within the ui:forEach element but I am
>> > only expecting a single JSON object, not an array of JSON objects
>> > which seems to be the use for the ui:forEach element. swon:RSObject
>> > does most of what I want (returning a single JSON object from a result
>> > set) but the problem here is I can't define a Name-Value pair (a
>> > swon:Value element) for that element as the names are taken directly
>> > from the result set. Ideally, what I am looking for is an element
>> > where I can define a result set from a SPARQL query that will only
>> > return a single JSON object (like the swom:RSObject element) and then
>> > define Name-Value pairs (akin to the swon:Value element) for that
>> > result set. Does such an element exist, what is it and where did I
>> > miss it?
>>
>> See above. If this does not help, please send us an example SPARQL query
>> and the output that you would like to produce.
>>
>> Thanks
>> Holger
>>
>> --
> -- You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include Enterprise
> Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid
> Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
> To post to this group, send email to
> [email protected] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> 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 Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> -- You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include Enterprise
> Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid
> Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
> To post to this group, send email to
> [email protected] <javascript:>
> To unsubscribe from this group, send email to
> [email protected] <javascript:>
> 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 Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight,
SPARQLMotion, SPARQL Web Pages 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 Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.