Hi Jorge,
to confirm: is your question how to convert from a SPIN RDF (Jena)
object into a string representation? This is done as below using
spinQuery.toString(). Additional options (such as whether to generate or
use prefixes) can be used via Printable.print(PrintContext) which is
implemented by all SPIN Command classes.
The Jena Query object is needed to go from a string to SPIN RDF, because
the SPIN API uses the Jena Query object model to build corresponding
SPIN RDF triples.
Does this answer your question?
Holger
On 7/29/14, 2:47 PM, Jorge Gastaldi wrote:
I'm quite new at SPIN-API. I'm trying to convert an SPARQL query to
SPIN SPARQL, modify the query using SPIN rules and rebuild the query
as a String, and I'm currently stuck at that last step.
I used the SPINParsingExample,java example from the SPIN-API
distribution for the text to Model convertion. The same example
rebuilds the query, but it does it this way:
Query arqQuery = ARQFactory.get().createQuery(model, query);
ARQ2SPIN arq2SPIN = new ARQ2SPIN(model);
Select spinQuery = (Select) arq2SPIN.createQuery(arqQuery, null);
System.out.println("SPIN query in Turtle:");
model.write(System.out, FileUtils.langTurtle);
System.out.println("-----");
String str = spinQuery.toString();
System.out.println("SPIN query:\n" + str);
// Now turn it back into a Jena Query
Query parsedBack = ARQFactory.get().createQuery(spinQuery);
System.out.println("Jena query:\n" + parsedBack);
All the convertion depends from the arqQuery that was built with
"query", the original string query. So, if I want to get the query
String of a model containing a different query I don't know where to
start.
Thanks in advance,
Jorge
--
-- 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.