Hi Jeff, the SPIN API contains an example that shows how to parse and unparse a SPARQL SPIN RDF query in the src-examples folder. Once you have a Construct or Select object, you can call toString on it (but it needs to be cast into a SPIN Query object first). Use SPINFactory.asCommand(resource) to get a Select instance. On that you will also see the print method that can be used to create a string rendering with various options (e.g. prefixes on or off).
Let me know if you have further questions, Holger On Nov 6, 2010, at 1:38 AM, Schmitz, Jeffrey A wrote: > Thanks Holger, > Regarding the requested API function, I currently use the sp:text version > of queries I’ve stored in a model for execution by our run-time using > java/jena. Retrieving the queries as they are stored in the spin format (IOW > using sp:first, sp:rest) and constituting them into a string isn’t something > I’ve figured out how to do. Are you saying this is possible using the API > toString and print functions? If so, I’ll have to take a closer look. > > Thanks, > Jeff > > From: [email protected] > [mailto:[email protected]] On Behalf Of Holger Knublauch > Sent: Tuesday, November 02, 2010 5:21 PM > To: [email protected] > Subject: Re: [topbraid-users] Minor SPIN related bug report > > Hi Jeff, > > this is a known limitation (aka: feature) of sp:text - the sp:text is used if > present, and by default sp:text is switched off (see TBC SPIN preferences). > The main use case for sp:text is if you want to store the verbatim syntax "as > entered", e.g. including comments in arbitrary places. If you don't need > this, just ensure the corresponding option is switched off, and then you > won't run into this issue. > > It is difficult to keep the sp:text in synch after changes to the model, and > this logic is not implemented. I am not sure what API function you request to > regenerate the sp:text - this would be the toString or print methods. > > Regards, > Holger > > > > On Nov 3, 2010, at 6:32 AM, Schmitz, Jeffrey A wrote: > > > I noticed that for an sp:Construct (and probably for all the spin query > classes) when I change the name of a property that is used in the stored > query, the property name displayed in the main area of the query gets updated > accordingly, but the textual version of the query stored as the object of the > sp:text property doesn’t get updated. At that point, the text version of the > query is out of sync with the “main line” query. Had me scratching my head > for a bit since what I was seeing in TBC looked right, but what was getting > executed (the text version) wasn’t working. Any way the textual version of > the query could get regenerated whenever anything changes in the main stored > query? Or perhaps could an API function be added (or maybe it already has?) > that will allow the text version to be generated at runtime so that only one > copy of the query is ever stored? > > Btw, still haven’t had a chance to test using the spin:command property for > storing DELETE queries. Hopefully will soon. > > Thanks, > Jeff > > -- > 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 > > -- > 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
