Indeed - my own ontology imports http://topbraid.org/functions-smf. I have added SPINModuleRegistry.get().registerAll(model,null); just after registering the OWL RL model, but I get a similar error (output shown below). Could it have anything to do with SPIN functions being only available under a commercial license?
Regards, Gerrit ----------------- Output: Function http://topbraid.org/sparqlmotionfunctions#deriveURI does not define a valid body java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java: 48) at java.lang.Integer.parseInt(Integer.java:470) at java.lang.Integer.valueOf(Integer.java:554) at org.topbraid.spin.model.impl.FunctionCallImpl.getArgumentProperties(FunctionCallImpl.java: 64) at org.topbraid.spin.model.impl.FunctionCallImpl.getArguments(FunctionCallImpl.java: 49) at org.topbraid.spin.model.impl.FunctionCallImpl.print(FunctionCallImpl.java: 172) at org.topbraid.spin.util.SPINExpressions.printExpressionString(SPINExpressions.java: 189) at org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedExpressionString(AbstractSPINResourceImpl.java: 146) at org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedExpressionString(AbstractSPINResourceImpl.java: 141) at org.topbraid.spin.model.impl.BindImpl.print(BindImpl.java:54) at org.topbraid.spin.model.impl.ElementListImpl.print(ElementListImpl.java: 139) at org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedElementList(AbstractSPINResourceImpl.java: 132) at org.topbraid.spin.model.impl.QueryImpl.printWhere(QueryImpl.java: 177) at org.topbraid.spin.model.impl.SelectImpl.print(SelectImpl.java:99) at org.topbraid.spin.model.impl.AbstractSPINResourceImpl.toString(AbstractSPINResourceImpl.java: 183) at org.topbraid.spin.arq.SPINARQFunction.<init>(SPINARQFunction.java: 58) at org.topbraid.spin.arq.SPINBodyFunctionDriver.doCreate(SPINBodyFunctionDriver.java: 21) at org.topbraid.spin.arq.SPINFunctionDrivers.create(SPINFunctionDrivers.java: 31) at org.topbraid.spin.system.SPINModuleRegistry.registerARQFunction(SPINModuleRegistry.java: 222) at org.topbraid.spin.system.SPINModuleRegistry.register(SPINModuleRegistry.java: 176) at org.topbraid.spin.system.SPINModuleRegistry.registerFunctions(SPINModuleRegistry.java: 258) at org.topbraid.spin.system.SPINModuleRegistry.registerAll(SPINModuleRegistry.java: 207) at org.topbraid.spin.system.SPINImports.getImportsModel(SPINImports.java: 120) at org.topbraid.spin.constraints.SPINConstraints.run(SPINConstraints.java: 441) at org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java: 313) at org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java: 297) .... On Jun 11, 1:24 am, Holger Knublauch <[email protected]> wrote: > Hi Gerrit, > > I don't see where you load and register the smf namespace. If your own > ontology imports this namespace, then you should also register the SPIN > functions contained therein. In your example below it seems you only register > the OWL RL model - try to do the same registerAll on model. This assumes > thathttp://topbraid.org/functions-smfis somewhere in your model's imports > closure. > > Holger > > model = > loadModelWithImports("/home/gerrit/code/TBCFreeWorkspace/TopBraid/BondingDe > vice5.owl","http://sofia.gotdns.com/ontologies/BondingDevice.owl"); > > // Load OWL RL library from the web > logger.debug("Loading OWL RL ontology..."); > OntModel owlrlModel = > loadModelWithImports("http://topbraid.org/spin/owlrl-all"); > > // Initialize system functions and templates > SPINModuleRegistry.get().init(); > // Create and add Model for inferred triples > newTriples = ModelFactory.createDefaultModel(ReificationStyle.Minimal); > model.addSubModel(newTriples); > SPINModuleRegistry.get().registerAll(owlrlModel, null); > > On Jun 10, 2011, at 9:59 PM, Gerrit wrote: > > > > > > > > > Holger, > > > I have created a gist of the Java code setup to make it more readable > > at: > >https://gist.github.com/9e89d33b88518327c19b > > > The setup is based on OWLRLExample.java that you provided in another > > thread: > >http://groups.google.com/group/topbraid-users/browse_thread/thread/87... > > > Regards, > > Gerrit > > > On Jun 10, 3:45 am, Holger Knublauch <[email protected]> wrote: > >> Hi Gerrit, > > >> I may need more information to understand this issue. I tried the > >> following and got no error. I changed the > >> KennedysInferencingAndConstraintsExample so that it also loads the SMF > >> function file > > >> // Create OntModel with imports > >> OntModel ontModel = > >> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, baseModel); > >> Model smfModel = ModelFactory.createDefaultModel(); > >> smfModel.read("http://topbraid.org/functions-smf"); > >> ontModel.addSubModel(smfModel); > > >> And it then ran fine. In your exception trace it seems that the system > >> fails to parse the body of that smf:deriveURI function. Could you provide > >> more details on how you set up your Java code before you run the > >> constraints? > > >> Thanks > >> Holger > > >> On Jun 9, 2011, at 7:10 PM, Gerrit wrote: > > >>> When performing constraint checking using > > >>> // Run all constraints > >>> List<ConstraintViolation> cvs = SPINConstraints.check(model, > >>> null); > >>> System.out.println("Constraint violations:"); > >>> for(ConstraintViolation cv : cvs) { > >>> System.out.println(" - at " + > >>> SPINLabels.get().getLabel(cv.getRoot()) + ": " + cv.getMessage()); > >>> } > > >>> I get the following error: > > >>> java.lang.IllegalArgumentException: > >>> Functionhttp://topbraid.org/sparqlmotionfunctions#deriveURI > >>> does not define a valid body > >>> at org.topbraid.spin.arq.SPINARQFunction.<init>(SPINARQFunction.java: > >>> 71) > >>> at > >>> org.topbraid.spin.arq.SPINBodyFunctionDriver.doCreate(SPINBodyFunctionDrive > >>> r.java: > >>> 21) > >>> at > >>> org.topbraid.spin.arq.SPINFunctionDrivers.create(SPINFunctionDrivers.java: > >>> 31) > >>> at > >>> org.topbraid.spin.system.SPINModuleRegistry.registerARQFunction(SPINModuleR > >>> egistry.java: > >>> 222) > >>> at > >>> org.topbraid.spin.system.SPINModuleRegistry.register(SPINModuleRegistry.jav > >>> a: > >>> 176) > >>> at > >>> org.topbraid.spin.system.SPINModuleRegistry.registerFunctions(SPINModuleReg > >>> istry.java: > >>> 258) > >>> at > >>> org.topbraid.spin.system.SPINModuleRegistry.registerAll(SPINModuleRegistry. > >>> java: > >>> 207) > >>> at > >>> org.topbraid.spin.system.SPINImports.getImportsModel(SPINImports.java: > >>> 120) > >>> at > >>> org.topbraid.spin.constraints.SPINConstraints.run(SPINConstraints.java: > >>> 441) > >>> at > >>> org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java: > >>> 313) > >>> at > >>> org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java: > >>> 297) > >>> at > >>> eu.sofia.adk.sib.model.semantic.SemanticModel.query(SemanticModel.java: > >>> 484) > >>> at > >>> eu.sofia.adk.sib.model.request.QueryRequest.processRequest(QueryRequest.jav > >>> a: > >>> 135) > >>> at eu.sofia.adk.sib.model.request.Request.run(Request.java:94) > >>> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java: > >>> 441) > >>> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) > >>> at java.util.concurrent.FutureTask.run(FutureTask.java:138) > >>> at java.util.concurrent.ThreadPoolExecutor > >>> $Worker.runTask(ThreadPoolExecutor.java:886) > >>> at java.util.concurrent.ThreadPoolExecutor > >>> $Worker.run(ThreadPoolExecutor.java:908) > >>> at java.lang.Thread.run(Thread.java:662) > >>> Caused by: java.lang.NumberFormatException: For input string: "" > >>> at > >>> java.lang.NumberFormatException.forInputString(NumberFormatException.java: > >>> 48) > >>> at java.lang.Integer.parseInt(Integer.java:470) > >>> at java.lang.Integer.valueOf(Integer.java:554) > >>> at > >>> org.topbraid.spin.model.impl.FunctionCallImpl.getArgumentProperties(Functio > >>> nCallImpl.java: > >>> 64) > >>> at > >>> org.topbraid.spin.model.impl.FunctionCallImpl.getArguments(FunctionCallImpl > >>> .java: > >>> 49) > >>> at > >>> org.topbraid.spin.model.impl.FunctionCallImpl.print(FunctionCallImpl.java: > >>> 172) > >>> at > >>> org.topbraid.spin.util.SPINExpressions.printExpressionString(SPINExpression > >>> s.java: > >>> 189) > >>> at > >>> org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedExpression > >>> String(AbstractSPINResourceImpl.java: > >>> 146) > >>> at > >>> org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedExpression > >>> String(AbstractSPINResourceImpl.java: > >>> 141) > >>> at org.topbraid.spin.model.impl.BindImpl.print(BindImpl.java:54) > >>> at > >>> org.topbraid.spin.model.impl.ElementListImpl.print(ElementListImpl.java: > >>> 139) > >>> at > >>> org.topbraid.spin.model.impl.AbstractSPINResourceImpl.printNestedElementLis > >>> t(AbstractSPINResourceImpl.java: > >>> 132) > >>> at org.topbraid.spin.model.impl.QueryImpl.printWhere(QueryImpl.java: > >>> 177) > >>> at org.topbraid.spin.model.impl.SelectImpl.print(SelectImpl.java:99) > >>> at > >>> org.topbraid.spin.model.impl.AbstractSPINResourceImpl.toString(AbstractSPIN > >>> ResourceImpl.java: > >>> 183) > >>> at org.topbraid.spin.arq.SPINARQFunction.<init>(SPINARQFunction.java: > >>> 58) > >>> ... 19 more > > >>> I am using SPIN 1.2.0, ARQ 2.8.7 and Jena 2.6.4. > > >>> Regards, > >>> Gerrit > > >>> -- > >>> 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
