As you say, Jena is using Lucene for indexing and searching here. If you check on Lucene querying you will see that it does not support using a wildcard as the first character.
http://lucene.apache.org/core/2_9_4/queryparsersyntax.html The requirement is based on how Lucene looks up the indexes. In the worst case, you could try a union between the various options that you expect. Regards, Paul On Thu, Jun 12, 2014 at 2:29 PM, Willie Milnor <[email protected]> wrote: > Hello, > > Perhaps I'm missing something in the docs, but when I attempt to execute > the query below, I am receiving the error below that. It looks like I > could fix this if I could access the CommonQueryParserConfiguration used > for Lucene, but I don't see how to do that. Is there a way to do what I'm > trying, or is there another way to allow a wildcard as the first character? > > > PREFIX text: <http://jena.apache.org/text#> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > SELECT DISTINCT ?s ?label > WHERE { > { > ?s text:query (rdfs:label "?has*") ; > rdfs:label ?label . > } > } > ORDER BY ?label > > > Caused by: org.apache.lucene.queryparser.classic.ParseException: Cannot > parse 'string:?has*': '*' or '?' not allowed as first character in > WildcardQuery > at > > org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:126) > at > org.apache.jena.query.text.TextIndexLucene.query$(TextIndexLucene.java:259) > at > org.apache.jena.query.text.TextIndexLucene.query(TextIndexLucene.java:244) > ... 34 more > Caused by: org.apache.lucene.queryparser.classic.ParseException: '*' or '?' > not allowed as first character in WildcardQuery > at > > org.apache.lucene.queryparser.classic.QueryParserBase.getWildcardQuery(QueryParserBase.java:1001) > at > > org.apache.lucene.queryparser.classic.QueryParserBase.handleBareTokenQuery(QueryParserBase.java:1099) > at > > org.apache.lucene.queryparser.classic.QueryParser.Term(QueryParser.java:358) > at > > org.apache.lucene.queryparser.classic.QueryParser.Clause(QueryParser.java:257) > at > > org.apache.lucene.queryparser.classic.QueryParser.Query(QueryParser.java:181) > at > > org.apache.lucene.queryparser.classic.QueryParser.TopLevelQuery(QueryParser.java:170) > at > > org.apache.lucene.queryparser.classic.QueryParserBase.parse(QueryParserBase.java:121) > -- > Cheers, > Willie >
