package com.galactichorse;

import com.hp.hpl.jena.rdf.model.*;

import javax.servlet.http.*;
import java.io.*;

public class Ontology extends HttpServlet {
    private static final String ONTOLOGY_PATH = "WEB-INF/accessibility-ontology.ttl";

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        //@TODO: check file extension
        File f = new File(ONTOLOGY_PATH);
        InputStream is = new FileInputStream(f);
        Model model = ModelFactory.createOntologyModel();
        model.read(is, null, "TURTLE");
        model.write(resp.getOutputStream(), "JSON-LD");
    }
}

@@ -56,16 +56,50 @@
 model.*;
+%0Aimport org.apache.jena.riot.Lang;
 %0A%0Aimport
@@ -274,153 +274,511 @@
 l%22;%0A
-%0A    @Override%0A    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException %7B%0A        //@TODO: check file extension
+    private static final Lang ONTOLOGY_INPUT_LANGUAGE = Lang.TURTLE;%0A    private static final Lang ONTOLOGY_OUTPUT_LANGUAGE = Lang.JSONLD;%0A%0A    @Override%0A    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException %7B%0A            resp.setContentType(ONTOLOGY_OUTPUT_LANGUAGE.getHeaderString());%0A            getOntologyModel().write(resp.getOutputStream(), ONTOLOGY_OUTPUT_LANGUAGE.getLabel());%0A    %7D%0A%0A    public static Model getOntologyModel() throws FileNotFoundException %7B
 %0A   
@@ -788,16 +788,19 @@
   File f
+ile
  = new F
@@ -840,17 +840,26 @@
 Stream i
-s
+nputStream
  = new F
@@ -874,16 +874,19 @@
 Stream(f
+ile
 );%0A     
@@ -962,82 +962,83 @@
 ad(i
-s, null, %22TURTLE%22);%0A        model.write(resp.getOutputStream(), %22JSON-LD%22)
+nputStream, null, ONTOLOGY_INPUT_LANGUAGE.getLabel());%0A        return model
 ;%0A  

fix language configuration