Ah yes, and I remember you sent me a work-around for this case  
(running SPIN API from source code and not from the .jar file). I have  
included your change for the next build.

Holger


On May 26, 2009, at 3:12 PM, Schmitz, Jeffrey A wrote:

>
> Just realized I've been down this path before.
>
> http://www.mail-archive.com/[email protected]/msg
> 01038.html
>
> I had to edit SPL.java to fix it, which I have since copied over with
> the new stuff and is why I'm seeing the problem again. I'll try  
> remaking
> the change.
>
> Jeff
>
>
>> -----Original Message-----
>> From: Schmitz, Jeffrey A
>> Sent: Tuesday, May 26, 2009 4:26 PM
>> To: [email protected]
>> Subject: [tbc-users] [SPIN] Error creating spin query with
>> function reference
>>
>>
>> Hello,
>>   I'm tring to execute a COSNTRUCT query that contains a
>> reference to a SPIN function that I have defined.  The code
>> I'm using is:
>>
>>              String arqQueryString = "PREFIX  SpinLib:
>> <http://www.boeing.com/IVHM/SpinLib.owl#>\n" +
>>                                      "PREFIX spinsquare:
>> <http://topbraid.org/examples/spinsquare#>\n" +
>>              "CONSTRUCT {\n" +
>>                  "?this spinsquare:area ?area .\n" +
>>              "}\n" +
>>              "WHERE {\n" +
>>              "    ?this spinsquare:width ?width .\n" +
>>              "    ?this spinsquare:height ?height .\n" +
>>              "   FILTER(?height = 6)" +
>>              "   LET (?area := spinsquare:twoDimArea(?width,
>> ?height)) .\n" +
>>              "}\n";
>>
>>      
>> SPINModuleRegistry.get().registerAll(spinsquareinstModel.memModel);
>>
>>              arqQuery = ARQFactory.get().createQuery(
>> spinsquareinstModel.memModel, arqQueryString);
>>              ARQ2SPIN a2s = new
>> ARQ2SPIN(spinsquareinstModel.memModel);
>>              org.topbraid.spin.model.Query spinQuery =
>> a2s.createQuery(arqQuery, null);
>>
>> When I run this code, I get a null pointer exception in the
>> a2s.createQuery call.  Stepping through the code, the real
>> problem is down in the call to ARQ2SPIN.getFunction (called
>> by SPINFactory.createExpression, line 411), which is
>> returning a null value.  Stepping through that function, the
>> ExprFunction parameter passed into it looks good, but:
>>
>> String iri = function.getFunctionIRI();
>>
>> Returns null, which I think causes the
>> SPINFactory.createFunctionCall shown on the exception stack
>> to get the exception.
>>
>>
>> java.lang.NullPointerException
>>      at
>> com.hp.hpl.jena.rdf.model.impl.ModelCom.add(ModelCom.java:939)
>>      at
>> com.hp.hpl.jena.rdf.model.impl.ResourceImpl.addProperty(Resour
>> ceImpl.jav
>> a:245)
>>      at
>> com.hp.hpl.jena.rdf.model.impl.ModelCom.createResource(ModelCo
>> m.java:449
>> )
>>      at
>> org.topbraid.spin.model.SPINFactory.createFunctionCall(SPINFac
>> tory.java:
>> 333)
>>      at
>> org.topbraid.spin.arq.ARQ2SPIN.createExpression(ARQ2SPIN.java:412)
>>      at org.topbraid.spin.arq.ARQ2SPIN.access$0(ARQ2SPIN.java:397)
>>      at org.topbraid.spin.arq.ARQ2SPIN$1.visit(ARQ2SPIN.java:295)
>>      at
>> com.hp.hpl.jena.sparql.syntax.ElementFilter.visit(ElementFilte
>> r.java:25)
>>      at
>> org.topbraid.spin.arq.AbstractElementVisitor.visit(AbstractEle
>> mentVisito
>> r.java:64)
>>      at org.topbraid.spin.arq.ARQ2SPIN$1.visit(ARQ2SPIN.java:304)
>>      at
>> com.hp.hpl.jena.sparql.syntax.ElementGroup.visit(ElementGroup.
>> java:104)
>>      at
>> org.topbraid.spin.arq.ARQ2SPIN.createElementList(ARQ2SPIN.java:281)
>>      at org.topbraid.spin.arq.ARQ2SPIN.createQuery(ARQ2SPIN.java:529)
>>      at com.boeing.sif.TestSPIN.main(TestSPIN.java:165)
>>
>> Any ideas on what I'm not doing correctly here?  I "think"
>> this used to work, but I haven't run it in awhile, and have
>> since updated to the final version 1 of the SPIN API.  Also,
>> I can execute the query in the SPARQL tab on the model in
>> TBC, so I think my models are setup correctly.  I can also
>> execute other queries on the model in my code, as long as
>> they don't reference a function.
>>
>> Thanks!
>> Jeff
>>
>>>
>>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
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-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to