Hi,

The SparqlStmt API built against jena 3.14.0 is now available on Maven Central 
[1]  in case one want to give it a try (example in [2]) and give feedback and 
whether one thinks it would be a useful contribution to Jena directly - and 
what changes would be necessary if so.


<dependency>
  <groupId>org.aksw.jena-sparql-api</groupId>
  <artifactId>jena-sparql-api-stmt</artifactId>
  <version>3.14.0-1</version>

</dependency>


[1] 
https://search.maven.org/artifact/org.aksw.jena-sparql-api/jena-sparql-api-stmt/3.14.0-1/jar

[2] 
https://github.com/SmartDataAnalytics/jena-sparql-api/blob/def0d3bdf0f4396fbf1ef0715f9697e9bb255029/jena-sparql-api-stmt/src/test/java/org/aksw/jena_sparql_api/stmt/TestSparqlStmtUtils.java#L54


Cheers,

Claus



On 18.03.20 16:04, Andy Seaborne wrote:
Note that parsing the string as a query aborts early as soon as it finds an 
update keyword so the cost of parsing isn't very large.

    Andy

On 18/03/2020 11:58, Marco Neumann wrote:
is there some utility function here in the code base now already to do
this, or do I still need to roll my own here?

On Tue, Jul 30, 2013 at 4:25 PM Andy Seaborne <[email protected]> wrote:

On 30/07/13 10:13, Arthur Vaïsse-Lesteven wrote:
Hi,

I would like to know if Jena offers a way to detect the type of an
unknow SPARQL request ?Starting from the query string.

At the moment the only way I succed to code it without "basic parsing"
of the query ( sort of thing I prefer avoid, manually parsing string with
short function often create errors )
looks like this :

[...]
         String queryString = "a query string, may be a select or an
update";

          try{
              Query select = QueryFactory.create(queryString);
              Service.process_select_query(select);//do some work with
the select
          }
          catch(QueryException e){
              UpdateRequest update = UpdateFactory.create(queryString);
              Service.process_update_query(update);//do some work with
the update
          }
          catch(ProcessException e){
              //handle this exception
          }

[...]

So is it possible ? Or not ?

Not currently.

You could use a regexp to spot the SELECT/CONSTRUCT/DESCRIBE/ASK keyword
coming after BASE/PREFIXES/Comments.

         Andy



--
Dipl. Inf. Claus Stadler
Department of Computer Science, University of Leipzig
Research Group: http://aksw.org/
Workpage & WebID: http://aksw.org/ClausStadler
Phone: +49 341 97-32260

Reply via email to