Hi Holger, Once again thanks for your help. It definitely pointed me in the right direction. SPINModuleRegistry.get().init() was not called. Adding this makes it all correct.
There are still a few things I need to sort out such as the spl:objectCount or spl:instanceOf. But I think I know what to do for those. Regards, Jerven On Jan 12, 2012, at 3:39 AM, Holger Knublauch wrote: > Hi Jerven, > > did you make sure that the ontModel contains the SP.getModel() and > SPIN.getModel() sub-graphs? This should resolve the sp: functions correctly. > > Also, better use > > http://topbraid.org/spin/api/1.2.0/spin/apidocs/org/topbraid/spin/arq/ARQFactory.html#createCommandString(org.topbraid.spin.model.Command) > > instead of going through the Jena Query object - I believe ARQ will not > render the CONSTRUCT part correctly in its toString method. > > Regards, > Holger > > > On Jan 12, 2012, at 3:43 AM, Jerven Bolleman wrote: > >> Dear Holger, Topbraid devs, >> >> I will understand if you don't have time to answer this question. >> >> Given a Jena model holding a set of spin queries. How do I get back a valid >> sparql query. >> My current approaches are >> >> OntModel ontModel = //Has the triples containing a SPIN model. >> Map<CommandWrapper, Map<String, RDFNode>> initialTemplateBindings = new >> HashMap<CommandWrapper, Map<String, RDFNode>>(); >> Map<Resource, List<CommandWrapper>> cls2Query = >> SPINQueryFinder.getClass2QueryMap( >> ontModel,ontModel, SPIN.command, true, >> initialTemplateBindings, false); >> for (final Map.Entry<Resource, List<CommandWrapper>> en : >> cls2Query.entrySet()) >> for (final CommandWrapper wr : en.getValue()) >> { >> final Command com = wr.getSPINCommand(); >> SPINFactory.asQuery(wr.getSource()).toString(); >> //Or this method >> ARQFactory.get() >> .createQuery(rule.getOntologyModel(), >> com.toString()).toString()); >> } >> >> This gives back a SPARQL query. The only problem is that it contains things >> like sp:regex instead of REGEX etc... >> The converter function at http://spinservices.org/spinrdfconverter.html does >> this. Which suggests that this is possible I just haven't found the right >> API calls. >> If this is outside of the open SPINAPI that's ok. >> >> Regards and thanks for your time, >> Jerven >> >> >> -- >> 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
