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(ResourceImpl.jav
a:245)
        at
com.hp.hpl.jena.rdf.model.impl.ModelCom.createResource(ModelCom.java:449
)
        at
org.topbraid.spin.model.SPINFactory.createFunctionCall(SPINFactory.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(ElementFilter.java:25)
        at
org.topbraid.spin.arq.AbstractElementVisitor.visit(AbstractElementVisito
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