Gerrick; Here's an example of a callback that will print out the results of a query:
function selectCallback(g:Graph,sparql:String,results:Array):void { for each (var result:Dictionary in results) { trace(“result:”); for (var key:String in result) { trace(“\t” + key + “: “ + result[key]); } } } So, given the following query, each result in the results parameter to the callback is a Dictionary containing keys 'subject' and 'object' per the variable bindings in the query. SELECT ?subject ?object WHERE { ?subject rdf:type ?object . } -- Scott On Mar 12, 8:51 am, Gerrick Bivins <gbivi...@gmail.com> wrote: > We figured some things out here. The next question is, how do we properly > access the results of the select method: > * > org.topbraidlive.graph.select(sparql:String,callback:Function,variableBindings:Object=null,errorCallback:Function=null); > * > * > * > We've figured out how to use it with the default settings for > variableBindings and errorCallback, ie both set to null. However, when > trying to set up our dataFunctions for our UI components, we're not sure how > to access the dictionary. From what I understand the* select() method > populates the results into a Dictionary or Associated Array. * > *We can certainly traverse this and get the data out but from the docs, it > seems like there is a way to tie "variableBindings" to the results > Dictionary but it's not clear from the docs how to do this, especially since > the docs for the parameters to the select method seem to be incorrect:* > * > * > * > * > select () method > public function select(sparql:String, callback:Function, > variableBindings:Object = null, errorCallback:Function = null):void > > Executes a SPARQL select query against this graph (usually on the server) > and returns the SPARQL results in a single callback. By the time the > callback is called, the graph may have changed, so the results cannot be > guaranteed to still be valid. > Parameters sparql:String — The SPARQL select query callback:Function — > callback(g:Graph,sparql:String,results:Array) Each item in the results array, > is a Dictionary in which each key is a variable in the query, and each > corresponding value is the binding for that variable in the result. > variableBindings:Object (default = null) — ??? If null all errors are > treated as fatal. errorCallback:Function (default = null) — is an > assocaiate array of variable name to Node which associates a SPARQL variable > to a particular node, before the query is executed. This variable can occur > in the head of the SELECT, which is useful to test the graph for the > existence of triples. > > Gerrick > > On Thu, Mar 11, 2010 at 3:42 PM, Scott Henninger <shennin...@topquadrant.com > > > wrote: > > Gerrick; The first question is whether this is a question on Composer > > or Live. I.e. where are you looking of the data providers? What kind > > of data providers? > > > <The only docs we have found are for the helloworld example and api > > docs> > > > That defines the current documentation for Live SDK. There will be > > some enhancements for 3.3. > > > <..see how to create dataproviders for the components that stay in > > sync with the current "graph"> > > > All of the Ensemble components do this. Any custom component created > > with the Live SDK will do this as well, as the calls are to the Live > > API which will query the back-end for a given event. > > > If that's not hitting the mark, then you'll need to explain what you > > mean by "current graph" and when you believe it would be in or out of > > synch. > > > -- Scott > > > On Mar 11, 3:21 pm, Gerrick Bivins <gbivi...@gmail.com> wrote: > > > Hi Scott. > > > The only docs we have found are for the helloworld example and api docs. > > I > > > have looked over those (got our plugin up and running) but we are trying > > to > > > see how to create dataproviders for the components that stay in sync with > > > the current "graph". We thought TBC may have that functionality already > > but > > > we can't find any references to it. > > > Gerrick > > > > On Thu, Mar 11, 2010 at 3:13 PM, Scott Henninger < > > shennin...@topquadrant.com > > > > > wrote: > > > > Gerrick; There are examples of how to use the Live SDK in the download > > > > (go to the Live console - e.g.http://localhost:8083/tbl-and click > > > > on Download SDK). > > > > > Composer/Live can be extended through SPARQL functions or SPARQLMotion > > > > modules. See Help > Extending TopBraid. > > > > > -- Scott > > > > > On Mar 11, 2:33 pm, Gerrick Bivins <gbivi...@gmail.com> wrote: > > > > > Hello, > > > > > Are there any docs/examples on how to create dataproviders from rdf > > > > > graphs/subgraphs for custom ensemble plugin components(flex). > > > > > Gerrick > > > > > -- > > > > You received this message because you are subscribed to the Google > > Groups > > > > "TopBraid Composer Users" group. > > > > To post to this group, send email to > > > > topbraid-composer-us...@googlegroups.com. > > > > To unsubscribe from this group, send email to > > > > topbraid-composer-users+unsubscr...@googlegroups.com<topbraid-composer-users%2bunsubscr...@googlegroups.com> > > <topbraid-composer-users%2bunsubscr...@googlegroups.com<topbraid-composer-users%252bunsubscr...@googlegroups.com> > > > > > . > > > > For more options, visit this group at > > > >http://groups.google.com/group/topbraid-composer-users?hl=en. > > > -- > > You received this message because you are subscribed to the Google Groups > > "TopBraid Composer Users" group. > > To post to this group, send email to > > topbraid-composer-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > topbraid-composer-users+unsubscr...@googlegroups.com<topbraid-composer-users%2bunsubscr...@googlegroups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/topbraid-composer-users?hl=en. -- You received this message because you are subscribed to the Google Groups "TopBraid Composer Users" group. To post to this group, send email to topbraid-composer-us...@googlegroups.com. To unsubscribe from this group, send email to topbraid-composer-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/topbraid-composer-users?hl=en.