I suggest to use sp:text instead of SPIN RDF syntax here. Why do you need that specific syntax?

Otherwise, why not just use TBC Free edition for such conversion tasks?

Holger


On 17/03/2016 8:47, Alexandre Rademaker wrote:
Hi Holger,

Thank you. Given that there is no such command line option, I am trying to adapt the example to translate a INSERT DATA to SPIN notation.

===
public class SPINParsingExample {

public static void main(String[] args) {
// Register system functions (such as sp:gt (>))
SPINModuleRegistry.get().init();
// Create an empty OntModel importing SP
Model model = ModelFactory.createDefaultModel();
model.setNsPrefix("rdf", RDF.getURI());
model.setNsPrefix("ex", "http://example.org/demo#";);
String query =
"SELECT ?person\n" +
"WHERE {\n" +
"    ?person a ex:Person .\n" +
"    ?person ex:age ?age .\n" +
"    FILTER (?age > 18) .\n" +
"}";
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);
}
}
==

I started thinking that it would be enough to change the lines:

model.setNsPrefix("rdf", RDF.getURI());
model.setNsPrefix("wn30", "https://w3id.org/own-pt/wn30/schema/";);
model.setNsPrefix("wn30pt", "https://w3id.org/own-pt/wn30-pt/instances/";);
String query = "INSERT DATA { graph <file://own-pt.nt <file://own-pt.nt/>> { wn30pt:synset-13299651-n wn30:containsWordSense [ rdfs:label \"pagamento\"@pt ; rdf:type wn30:WordSense ; wn30:word wn30pt:word-pagamento ] . wn30pt:word-pagamento wn30:lexicalForm \"pagamento\"@pt ; rdf:type wn30:Word . } }";

But I was wrong! The lines

Query arqQuery = ARQFactory.get().createQuery(model, query);
ARQ2SPIN arq2SPIN = new ARQ2SPIN(model);
Select spinQuery = (Select) arq2SPIN.createQuery(arqQuery, null);

Also need to be changed, right? How? What classes to use?

Best,
Alexandre

--
You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
---
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), 
Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, TopBraid Insight, 
SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to [email protected]
--- 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.

Reply via email to