Hi Pahl,

I believe the error is not in the SPIN conversion, but you have used
the wrong variable (query) when you create the QueryExecution: the
system then tries to parse the string again. ARQFactory.createQuery
has special logic that automatically adds PREFIX declarations to the
string, while QueryExecutionFactory (from Jena) does not do this. Use
arqQuery as argument to the execution factory.

I hope this helps, and sorry for the hiccups with your original email.

Regards,
Holger


On Apr 10, 5:14 am, Scott Henninger <[email protected]>
wrote:
> (Due to an error handling the group, the original post was deleted,
> but is posted here in its entirety.)
>
> Subject:
> Execute SPINFunction in SPIN API
> From:
> developer <[email protected]>
> Date:
> 4/9/12 7:53 AM
> To:
> TopBraid Suite Users <[email protected]>
>
> Hallo everybody,
>
> I'm a SPIN beginner and exploring the possibilities of SPIN. I've
> created an easy function in TBC and executed this function by using
> the SPARQL query editor. All worked perfect.
>
> In the next step I loaded the created ttl-File with the SPIN API and
> executed the same query. Now I'm getting an error that the default
> prefix name for the function could not be resolved.
>
> Can anybody help me?
>
> SPINModuleRegistry.get().init();
> OntModel testModel = loadModelWithImports("Test.ttl");
> SPINModuleRegistry.get().registerAll(testModel, null);
>
> System.out.println(testModel.getNsPrefixMap());
> String query = "SELECT ?x WHERE { BIND (:square(5) AS ?x) .}";
> Query arqQuery = ARQFactory.get().createQuery(testModel, query);
>
> QueryExecution execution = QueryExecutionFactory.create(query,
> testModel);
> ResultSet results = execution.execSelect();
> ResultSetFormatter.out(System.out, results, arqQuery);
> execution.close();
>
> Output:
> {=http://org.spin.test/Test#, arg=http://spinrdf.org/arg#,
> rdfs=http://www.w3.org/2000/01/rdf-schema#, spl=http://spinrdf.org/spl#,
> sp=http://
> spinrdf.org/sp#, xsd=http://www.w3.org/2001/XMLSchema#, 
> owl=http://www.w3.org/2002/07/owl#, spin=http://spinrdf.org/spin#, 
> rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#}
> Exception in thread "main" com.hp.hpl.jena.query.QueryParseException:
> Line 1, column 25: Unresolved prefixed name: :square
>         at
> com.hp.hpl.jena.sparql.lang.ParserBase.throwParseException(ParserBase.java:
> 538)

-- 
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 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

Reply via email to