Hi,
When I don't register the SPINModel and execute the query, I dont get any
error but empty result set.
When I register and execute the query, getting following errors,
Exception in thread "main" java.lang.NullPointerException
at com.ontotext.jena.
StageGeneratorSesame$SesameIter.<init>(Unknown Source)
at com.ontotext.jena.StageGeneratorSesame.solve(Unknown Source)
at com.ontotext.jena.StageGeneratorSesame.execute(Unknown Source)
at
com.hp.hpl.jena.sparql.engine.main.StageBuilder.execute(StageBuilder.java:58)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:134)
at com.ontotext.jena.SesameOpExecutor.execute(Unknown Source)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:59)
at com.hp.hpl.jena.sparql.algebra.op.OpBGP.visit(OpBGP.java:49)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:47)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.executeOp(OpExecutor.java:123)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:329)
at com.ontotext.jena.SesameOpExecutor.execute(Unknown Source)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:180)
at com.hp.hpl.jena.sparql.algebra.op.OpFilter.visit(OpFilter.java:110)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:47)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.executeOp(OpExecutor.java:123)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:459)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:308)
at com.hp.hpl.jena.sparql.algebra.op.OpGroup.visit(OpGroup.java:51)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:47)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.executeOp(OpExecutor.java:123)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:491)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:292)
at com.hp.hpl.jena.sparql.algebra.op.OpExtend.visit(OpExtend.java:121)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:47)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.executeOp(OpExecutor.java:123)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:440)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.visit(ExecutionDispatch.java:260)
at com.hp.hpl.jena.sparql.algebra.op.OpProject.visit(OpProject.java:48)
at
com.hp.hpl.jena.sparql.engine.main.ExecutionDispatch.exec(ExecutionDispatch.java:47)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.executeOp(OpExecutor.java:123)
at
com.hp.hpl.jena.sparql.engine.main.OpExecutor.execute(OpExecutor.java:96)
at com.hp.hpl.jena.sparql.engine.main.QC.execute(QC.java:52)
at
com.hp.hpl.jena.sparql.engine.main.QueryEngineMain.eval(QueryEngineMain.java:65)
at
com.hp.hpl.jena.sparql.engine.QueryEngineBase.evaluate(QueryEngineBase.java:129)
at
com.hp.hpl.jena.sparql.engine.QueryEngineBase.createPlan(QueryEngineBase.java:99)
at
com.hp.hpl.jena.sparql.engine.QueryEngineBase.getPlan(QueryEngineBase.java:87)
at
com.hp.hpl.jena.sparql.engine.main.QueryEngineMain$1.create(QueryEngineMain.java:113)
at
com.hp.hpl.jena.sparql.engine.QueryExecutionBase.getPlan(QueryExecutionBase.java:532)
at
com.hp.hpl.jena.sparql.engine.QueryExecutionBase.startQueryIterator(QueryExecutionBase.java:509)
at
com.hp.hpl.jena.sparql.engine.QueryExecutionBase.execResultSet(QueryExecutionBase.java:517)
at
com.hp.hpl.jena.sparql.engine.QueryExecutionBase.execSelect(QueryExecutionBase.java:215)
at
org.topbraid.spin.arq.SPINARQFunction.executeBody(SPINARQFunction.java:198)
at org.topbraid.spin.arq.SPINARQFunction.exec(SPINARQFunction.java:172)
at
com.hp.hpl.jena.sparql.expr.E_Function.evalSpecial(E_Function.java:71)
at
com.hp.hpl.jena.sparql.expr.ExprFunctionN.eval(ExprFunctionN.java:102)
at com.hp.hpl.jena.sparql.core.VarExprList.get(VarExprList.java:82)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterAssign.accept(QueryIterAssign.java:68)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterProcessBinding.hasNextBinding(QueryIterProcessBinding.java:64)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterConvert.hasNextBinding(QueryIterConvert.java:59)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorWrapper.hasNextBinding(QueryIteratorWrapper.java:40)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:108)
at
com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:72)
at
com.hp.hpl.jena.sparql.resultset.ResultSetMem.<init>(ResultSetMem.java:95)
at
com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:147)
at
com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:130)
at
com.hp.hpl.jena.sparql.resultset.TextOutput.write(TextOutput.java:118)
at
com.hp.hpl.jena.sparql.resultset.TextOutput.format(TextOutput.java:65)
at
com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:122)
at
com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:74)
at
com.hp.hpl.jena.query.ResultSetFormatter.out(ResultSetFormatter.java:65)
at
me.socure.service.ontoop.service.InferencingService.getRealUser(InferencingService.java:165)
at
me.socure.service.ontoop.service.InferencingService.main(InferencingService.java:153)
Thanks
Raj
On Fri, May 3, 2013 at 2:29 PM, Holger Knublauch <[email protected]>wrote:
> I don't think calling a function's exec function directly is a good
> practice in Jena - it would require preparing the environment etc. If you
> just want to call the body query manually, get a pointer to it via the
> SPIN.body triple and convert the object of that triple to Select via the
> SPINFactory. Once you have a Select, you can turn it into a Jena Query
> object etc. Sorry we cannot walk down all these details, maybe other
> community members can.
>
> But the cleanest approach would be to call the function embedded in a
> SPARQL query, so I would investigate this further. The query SELECT ( <
> http://spinrdf.org/spin#accountage>(30) AS ?user) {} should work. What is
> the output - any errors?
>
> Holger
>
>
>
> On 5/3/2013 18:53, Anand Raj wrote:
>
>
> Hi,
>
> I have registered the function, as suggested
>
> registry.registerAll(model, null);
>
> Function function = registry.getFunction("
> http://spinrdf.org/spin#accountage", model);
>
> SPINARQFunction spinarqFunction = new SPINARQFunction(function);
>
> I get the function too. Now I need an example how to execute this
> function using *exec* or *executeBody methods. *I am struck with
> supplying arguments to methods. How do I create variables and assign value
> to it.
>
> It would be of great help, if you could share me the sample code.
>
> Thanks
> Raj
>
>
> On Fri, May 3, 2013 at 2:14 PM, Holger Knublauch
> <[email protected]>wrote:
>
>> Hi Anand,
>>
>> any SPIN function needs to be registered with the Jena FunctionRegistry.
>> The KennedysInferencingAndConstraintsExample.java shows how to do this:
>>
>> // Register locally defined functions
>> SPINModuleRegistry.get().registerAll(ontModel, null);
>>
>> *However* this only registers your SPIN functions to Jena, and with OWLIM
>> you may be in a situation in which the whole query is executed server-side
>> using the native SPARQL engine of OWLIM, bypassing any locally registered
>> Jena functions. In a sense Jena is just the client then. I have not used
>> the OWLIM Jena bridge, but you can verify if an error is reported such as
>> unknown function coming from OWLIM directly.
>>
>> So please make sure the function is registered at all, and send us any
>> error message if it still happens.
>>
>> HTH
>> Holger
>>
>>
>>
>>
>> On 5/3/2013 17:01, Anand Raj wrote:
>>
>> I have done the bridging between OWLIM-SE and TopBraid Composer. I
>> have even created simple Functions and executed against OWLIM data from
>> TopBraid Composer.
>>
>> Now I would like to call this spin function using SPIN API on OWLIM
>> model,
>>
>> *Loading model from OWLIM,*
>> manager = RemoteRepositoryManager.getInstance(Preferences
>> .getRepositoryURL());
>> manager.initialize();
>> owlimRepository =
>> manager.getRepository(Preferences.Common.REPOSITORY_NAME);
>> owlimRepository.initialize();
>> dataset = new SesameDataset(con);
>> *model* = ModelFactory.createModelForGraph(dataset.getDefaultGraph());
>>
>> *Executing SPARQL*
>> queryFromSparqlTxt = "SELECT ( <http://spinrdf.org/spin#accountage>(30)
>> AS ?user) {}"
>> QueryExecution qExec = QueryExecutionFactory.create(queryFromSparqlTxt,
>> *model*);
>> return qExec.execSelect();
>>
>> Note:-
>>
>> http://spinrdf.org/spin#accountage is the function defined in TopBraid
>> Composer and stored back to OWLIM.
>>
>> Now, When I execute the SPARQL, I don't get the expected output.
>>
>> Please help me on this. Am I missing any spin registry?
>>
>> Thanks
>> Raj
>>
>>
>> On Thu, May 2, 2013 at 11:34 PM, Scott Henninger <
>> [email protected]> wrote:
>>
>>> Raj; The best way to do this is to download the OWLIM plug-in for
>>> TopBraid. Then you have both an ontology editor and your back-end.
>>>
>>> The plugin is maintained by Ontotext, so go to
>>> http://owlim.ontotext.com/display/OWLIMv50/OWLIM-SE+Installation to
>>> download. There is a section named "Using OWLIM-SE with TopBraid Composer"
>>> that explains how to update the OWLIM plug-in.
>>>
>>> If you want to execute the SPIN API as a stand-alone package, the API
>>> documentation is complete in terms of support for the API.
>>>
>>> -- Scott
>>>
>>>
>>> On 5/2/2013 5:48 AM, Raj wrote:
>>>
>>> Hi Thanks. I have gone through
>>> http://www.topquadrant.com/spin/tutorial/. I even tried all the samples
>>> and works fine for me. Now I would like to register the spin template using
>>> SPIN API and execute at the sesame repository (OWLIM-SE). Could you please
>>> provide me the sample code.
>>>
>>> Thanks
>>> Raj
>>>
>>> On Thursday, April 25, 2013 2:36:34 AM UTC+5:30, Scott Henninger wrote:
>>>>
>>>> Raj; I'd suggest taking a look at
>>>> http://topquadrant.com/products/SPIN.html. There are some tutorials
>>>> and references on the right-hand side of the page.
>>>>
>>>> -- Scott
>>>>
>>>> On 4/24/2013 3:16 PM, Raj wrote:
>>>>
>>>> Hi,
>>>> I am pretty much familiar with OWLIM, but not with SPIN.
>>>>
>>>> Could anyone guide me in executing a simple select user defined
>>>> template with a filter option upon OWLIM?
>>>>
>>>> Thanks in advance.
>>>>
>>>>
>>>>
>>>> --
>>>> -- 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, SPARQL Web Pages 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
>>>> Groups "TopBraid Suite Users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>> -- 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, SPARQL Web Pages 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
>>> Groups "TopBraid Suite Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>>
>>> --
>>> -- 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, SPARQL Web Pages 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 a topic in the
>>> Google Groups "TopBraid Suite Users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/topbraid-users/kFCKSd04fEw/unsubscribe?hl=en-US
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> [email protected].
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>> --
>> -- 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, SPARQL Web Pages 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 Groups
>> "TopBraid Suite Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>> --
>> -- 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, SPARQL Web Pages 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 a topic in the
>> Google Groups "TopBraid Suite Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/topbraid-users/kFCKSd04fEw/unsubscribe?hl=en-US
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
> --
> -- 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, SPARQL Web Pages 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 Groups
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
>
> --
> -- 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, SPARQL Web Pages 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 a topic in the
> Google Groups "TopBraid Suite Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/topbraid-users/kFCKSd04fEw/unsubscribe?hl=en-US
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
-- 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, SPARQL Web Pages 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 Groups
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.