is there any sparql vocab parser available for java so I can use that to read SPARQL and create JPA criteria out of it

399 views Asked by At

Hi I want to accept sparql from my exposed rest services for adhoc queries the user wants to issue .My current framework is based on spring data rest and jpa which does most of the heavy lifting for exposes HAL based endpoints but I need to provide this extra hook for the user to do custom queries .Is there any efficient sparql parser around (some mentioned here SPARQL parser for Java Code ) which I can use in to then read and transform the sparql vocab into JPA based criteria query to be executed on my db backend .

I am trying to use apache jina arq but has anyone got an example of using those for parsing sparql and then trying it to convert into sql.

using apache jena I am doing

    String queryString = "PREFIX books:  <http://example.org/book/> PREFIX dc:  <http://purl.org/dc/elements/1.1/>"
        + " SELECT ?book ?title WHERE { ?book dc:title ?title}";
    Query query = QueryFactory.create(queryString);
    Op op = Algebra.compile(query);

Now I want to iterate through that Op with a visitor to use the same to transform it into Sql .I have tried OpWalker.walk(op, new EventSparqlVisitor()); but it doesnt iterate through all for me to generate the query .. any help

0

There are 0 answers