Not that I know of, I have never used QuerySolutionMap. That surprises me. How do you do variable substitution (e.g. ?this) when you build and run SPARQL queries? String parsing? Perhaps an opportunity for me to contribute to the open source API? :-)
________________________________ From: Holger Knublauch [mailto:hol...@topquadrant.com] Sent: Tuesday, March 31, 2009 3:09 PM To: topbraid-composer-users@googlegroups.com Subject: [tbc-users] Re: SPIN API is now open source On Mar 31, 2009, at 10:39 AM, Schmitz, Jeffrey A wrote: A little more info on this, I've added code to directly execute a query that references the registered function instead of relying on executing the SPIN rule via SPINInferences.run , and I'm seeing the same behavior. When I don't use the function, the query executes correctly. However when I reference the function I get no result. And again, after registering the function, I am able to retrieve it: SPINModuleRegistry.get().registerAll(spinLibModel.memModel); Function twoDimFunc = SPINModuleRegistry.get().getFunction("http://www.boeing.com/IVHM/SpinLib .owl#twoDimArea <http://www.boeing.com/IVHM/SpinLib.owl#twoDimArea> ", spinLibModel.memModel); org.topbraid.spin.model.Query twoDimQuery = twoDimFunc.getBody(); String comment = twoDimFunc.getComment(); System.out.println("Comment for TwoDimArea: " + comment); but when I build and execute the query that uses the function as follows, I get no result, while not using the function in the query yields the correct results: String selQueryString = "SELECT ?area\n" + "WHERE {\n" + "?this :width ?width .\n" + "?this :height ?height .\n" + "LET (?area := SpinLib:twoDimArea(?width, ?height)) .\n" + "}"; ARQ2SPIN arq2SPIN = new ARQ2SPIN(spinsquareModel.baseModel); ARQFactory arqFactory = org.topbraid.spin.system.ARQFactory.get(); //This automagically pre-pends prefix declarations from the model being queried. Query arqSelQuery = arqFactory.createQuery(spinsquareModel.memModel, selQueryString); org.topbraid.spin.model.Select spinQuery = (Select) arq2SPIN.createQuery(arqSelQuery, null); QueryWrapper universalQuery = new QueryWrapper(arqSelQuery, selQueryString, spinQuery, "Area Function"); QueryExecution qe = arqFactory.createQueryExecution(universalQuery.getQuery(), spinsquareModel.memModel); ResultSet results = qe.execSelect(); It's just strange that I can retrieve the function from the SPINModuleRegistry but it doesn't seem to be able to execute it. One thing is that I'm using the SpinLib model in the call to registerAll since that's where the function resides, but I'm querying against the spinsquare model, which imports SpinLib. Is that ok? (Jeff and I have meanwhile solved the underlying problem - for the archive: the problem was that the user-defined function needs to be registered together with a union Model (OntModel) that also contains the spin.owl and sp.owl namespaces. I have clarified this in the JavaDocs for the next build). btw, is there a way to use the ARQFactory to create a QueryExecution with a QuerySolutionMap? Not that I know of, I have never used QuerySolutionMap. Holger --~--~---------~--~----~------------~-------~--~----~ 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-users@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 -~----------~----~----~----~------~----~------~--~---