Hi Alexander,
the first argument on the left hand side must either be a query (e.g.
instance of sp:Select) or a template *call*. It is not supported to
simply use the URI of the template itself. If you only have a template,
you need to make the extra "hop" such as in
|
SELECT *
WHERE {
test:Select1 spin:body ?query .
(?query "arg1" owl:Thing_1) spin:select (?c ?l) .
}
|
Alternative, create an *instance* of test:Select1 such as test:MySelect1
and call it using
(test:MySelect1 "arg1" owl:Thing_1) spin:select (?c ?l)
I will improve the error handling to make clearer what is expected.
HTH
Holger
On 10/1/2014 20:44, Alexander Hoem Rosbach wrote:
Hi,
I am experimenting with the new features in 4.5, specifically the
built-in magic property *spin:select*. When I call a simple select
template from the sparql interface in TBC I get a nullpointer exception.
I have the following spin select template:
|
test:Select1 a spin:SelectTemplate;
rdfs:subClassOf spin:SelectTemplates;
spin:body [a sp:Select;
sp:resultVariables ([sp:varName
"c"^^xsd:string][sp:varName
"l"^^xsd:string]);
sp:where([sp:object[sp:varName
"c"^^xsd:string];
sp:predicate
rdfs:comment ;
sp:subject
spin:_arg1
][sp:object[sp:varName "l"^^xsd:string];
sp:predicate rdfs:label ;
sp:subject spin:_arg1
])
];
spin:constraint [a spl:Argument;
spl:predicate sp:arg1 ;
spl:valueType rdfs:Resource
].
|
And I have defined the following instance:
|
owl:Thing_1 a owl:Thing ;
rdfs:comment "Dette er en kommentar"^^xsd:string ;
rdfs:label "Dette er en label"^^xsd:string .
|
Then I've tried these queries:
|
SELECT *
WHERE {
(test:Select1 "arg1" owl:Thing_1) spin:select (?c ?l) .
}
|
|
SELECT *
WHERE {
(test:Select1) spin:select (?c ?l) .
}
|
My goal is to create a select template that can be called both with
bound and unbound arguments, for different use cases. But both of the
above queries result in NullPointerException.
Here is the error message:
eclipse.buildId=unknown
java.version=1.7.0_65
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments: -data
/home/ahr/Development/tbc.workspaces/epim-elh-4.5 -os linux -ws
gtk -arch x86_64
Error
Wed Oct 01 12:43:16 CEST 2014
Failed to retrieve all query results
java.lang.NullPointerException
at
org.topbraid.spin.arq.ARQFactory.createCommandString(ARQFactory.java:125)
at org.topbraid.spin.arq.ARQFactory.createQuery(ARQFactory.java:229)
at
org.topbraid.spin.arq.functions.SelectPFunction.exec(SelectPFunction.java:81)
at
com.hp.hpl.jena.sparql.pfunction.PropertyFunctionBase$RepeatApplyIteratorPF.nextStage(PropertyFunctionBase.java:108)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.makeNextStage(QueryIterRepeatApply.java:115)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterRepeatApply.hasNextBinding(QueryIterRepeatApply.java:67)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIterProcedure.hasNextBinding(QueryIterProcedure.java:74)
at
com.hp.hpl.jena.sparql.engine.iterator.QueryIteratorBase.hasNext(QueryIteratorBase.java:112)
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:112)
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:112)
at
com.hp.hpl.jena.sparql.engine.ResultSetStream.hasNext(ResultSetStream.java:75)
at
org.topbraidcomposer.sparql.view.SPARQLView$9.handleResultSet(SPARQLView.java:413)
at
org.topbraidcomposer.sparql.view.SPARQLView$11.runSelectOrDescribe(SPARQLView.java:512)
at
org.topbraidcomposer.sparql.view.SPARQLView$11.run(SPARQLView.java:481)
at
org.topbraidcomposer.core.util.ThreadUtil$1$1.run(ThreadUtil.java:64)
at java.lang.Thread.run(Thread.java:745)
--
-- 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
Insight, 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]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
-- 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 Insight, 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/d/optout.