On Jan 26, 2012, at 2:26 AM, Brian wrote: > Hi everyone: > > I'm having some problems storing and retrieving SPARQL queries in/from > my RDF SPIN model. I would like to store a set of SPARQL queries in > my model and call them in my Java application to test for conditions > and to add triples on demand. I tried to attach a spin:query to a > resource, but the query was stored in a blank node. Can I access a > blank node resource as a SPIN query in my Java code?
Yes, but you will need the SPIN API for that http://topbraid.org/spin/api/1.2.0/index.html Once you have the blank node, turn it into a Query instance using SPINFactory.asQuery() http://topbraid.org/spin/api/1.2.0/spin/apidocs/org/topbraid/spin/model/SPINFactory.html#asQuery(com.hp.hpl.jena.rdf.model.Resource) > Is there a way > to store named queries (e.g. http://example.org/MyProject#myQuery)? I would convert them to SPIN templates for that - this not only gives the query a URI but also allows you to pass in arguments and thus reuse the same query in different contexts. http://composing-the-semantic-web.blogspot.com/2009/01/understanding-spin-templates.html You can then traverse all instances of spin:Template and get their spin:body. Then do the asQuery stuff above. Regards, 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 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
