1

Is there any way to validate/check an SparQL query?

I'm asking for a a method simillar to oneClass.validateSparqlQuery(expectedSparQL).

And not forcing the exception "QueryException" while creating the SparQL, this way:

import com.hp.hpl.jena.query.Query;
import com.hp.hpl.jena.query.QueryException;
import com.hp.hpl.jena.query.QueryFactory;

public class myClass {

    public static void generic(String expectedSparQL) {
        try {
            Query q = QueryFactory.create(expectedSparQL);

        } catch (QueryException qe) {
            //do something if the expectedSparQL is not correct
        }

    }

}

javadoc: https://jena.apache.org/documentation/javadoc/arq/index.html

tremendows
  • 4,262
  • 3
  • 34
  • 51
  • 1
    What would be the difference? Either the query can be parsed correctly into a `Query` object, or it is not a valid SPARQL query. – UninformedUser Nov 17 '17 at 17:55
  • 2
    By the way, please don't use such an old version of Jena. I'm really wondering why people still use the older versions. The latest version is 3.5.0 – UninformedUser Nov 17 '17 at 17:55

0 Answers0