File tree Expand file tree Collapse file tree 4 files changed +32
-1
lines changed
src/main/java/org/foerderfunke/sem_ops_server Expand file tree Collapse file tree 4 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ repositories {
1919
2020dependencies {
2121 implementation " org.springframework.boot:spring-boot-starter-web"
22+ implementation(" org.aksw.thirdparty.org.spinrdf:spinrdf:2.0.0-jena5-1" )
2223 testImplementation " org.springframework.boot:spring-boot-starter-test"
2324 testRuntimeOnly " org.junit.platform:junit-platform-launcher"
2425}
Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ public class Controller {
88
99 @ GetMapping ("/sparqlToSpin" )
1010 public String sparqlToSpin (@ RequestParam (name = "sparql" ) String sparql ) {
11+
12+ Converter converter = new Converter ();
13+ converter .sparqlToSpin ();
14+
1115 return "TODO" ;
1216 }
1317}
Original file line number Diff line number Diff line change 1+ package org .foerderfunke .sem_ops_server ;
2+ import org .spinrdf .arq .ARQ2SPIN ;
3+ import org .spinrdf .system .SPINModuleRegistry ;
4+ import org .spinrdf .arq .ARQFactory ;
5+
6+ import org .apache .jena .rdf .model .Model ;
7+ import org .apache .jena .rdf .model .ModelFactory ;
8+
9+ import java .io .StringWriter ;
10+
11+ public class Converter {
12+
13+ public void sparqlToSpin () {
14+ String sparql = "SELECT * WHERE { ?s ?p ?o }" ;
15+
16+ SPINModuleRegistry .get ().init ();
17+ Model spinModel = ModelFactory .createDefaultModel ();
18+
19+ org .apache .jena .query .Query arqQuery = ARQFactory .get ().createQuery (spinModel , sparql );
20+ ARQ2SPIN converter = new ARQ2SPIN (spinModel );
21+ org .spinrdf .model .Query spinQuery = converter .createQuery (arqQuery , null );
22+
23+ StringWriter writer = new StringWriter ();
24+ spinModel .write (writer , "TURTLE" );
25+ System .out .println (writer );
26+ }
27+ }
Original file line number Diff line number Diff line change @@ -9,5 +9,4 @@ public class SemOpsServerApplication {
99 public static void main (String [] args ) {
1010 SpringApplication .run (SemOpsServerApplication .class , args );
1111 }
12-
1312}
You can’t perform that action at this time.
0 commit comments